]> git.baikalelectronics.ru Git - kernel.git/commit
drbd: add missing spinlock to bitmap receive
authorLars Ellenberg <lars.ellenberg@linbit.com>
Fri, 3 Jun 2011 19:18:13 +0000 (21:18 +0200)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 30 Jun 2011 07:23:41 +0000 (09:23 +0200)
commit873a18765e1b69c107557b765d52c2a93a2a294d
tree3774c1a3abb72bcc5ab0b37a23fdd9727ca188e4
parent05efeb5b43f15fec24a752bac1e6e4a937932d3f
drbd: add missing spinlock to bitmap receive

During bitmap exchange, when using the RLE bitmap compression scheme,
we have a code path that can set the whole bitmap at once.

To avoid holding spin_lock_irq() for too long, we used to lock out other
bitmap modifications during bitmap exchange by other means, and then,
knowing we have exclusive access to the bitmap, modify it without
the spinlock, and with IRQs enabled.

Since we now allow local IO to continue, potentially setting additional
bits during the bitmap receive phase, this is no longer true, and we get
uncoordinated updates of bitmap members, causing bm_set to no longer
accurately reflect the total number of set bits.

To actually see this, you'd need to have a large bitmap, use RLE bitmap
compression, and have busy IO during sync handshake and bitmap exchange.

Fix this by taking the spin_lock_irq() in this code path as well, but
calling cond_resched_lock() after each page worth of bits processed.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_bitmap.c