drbd: Fix a race condition that can lead to a BUG()
authorPhilipp Reisner <philipp.reisner@linbit.com>
Tue, 21 Aug 2012 18:34:07 +0000 (20:34 +0200)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Fri, 9 Nov 2012 13:08:20 +0000 (14:08 +0100)
commitc1fd29a11f433ca8ae37723768016ffe6cdd487b
treed297c9ee730f292a2a789f9bbeceffde075afc26
parent0ee98e2eb0c85f27b6f24a15d59fb54f99a93840
drbd: Fix a race condition that can lead to a BUG()

If the preconditions for a state change change after the wait_event() we
might hit the BUG() statement in conn_set_state().

With holding the spin_lock while evaluating the condition AND until the
actual state change we ensure the the preconditions can not change anymore.

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