drbd: bitmap: don't count unused bits (fix non-terminating resync)
authorLars Ellenberg <lars.ellenberg@linbit.com>
Wed, 15 Dec 2010 22:21:39 +0000 (23:21 +0100)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 10 Mar 2011 10:36:38 +0000 (11:36 +0100)
commit7777a8ba1fc980e5edfe492ebf5a1676497b8db2
tree9eb81d2bee5bf63a796ae4df0b9cf352b3f0360b
parent1b881ef77537f1077482f9946a6a99b4e2dd54b2
drbd: bitmap: don't count unused bits (fix non-terminating resync)

We trusted the on-disk bitmap to have unused bits cleared.
In case that is not true for whatever reason,
and we take a code path where the unused bits don't get cleared
elsewhere (bm_clear_surplus is not called), we may miscount the bits,
and get confused during resync, waiting for bits to get cleared that we
don't even use: the resync process would not terminate.

Fix this by masking out unused bits in __bm_count_bits.

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