diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2011-10-06 12:29:14 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-05-09 09:15:53 -0400 |
commit | aaae506d545bb9d06f4d8362f670f406f12e4b58 (patch) | |
tree | 4fb88894b2ce6e03ea44d188752170ef7b719260 /drivers/block/drbd | |
parent | 6a9a92f4ef05bb3e94bbfe123c21482fa5da9866 (diff) |
drbd: Fixed a race condition between detach and start of resync
drbd_state_lock() is only there to serialize cluster wide state
changes. Testing the local disk state needs to happen while
holding the global_state_lock.
Otherwise you might see something like this (Oct 6 on kugel)
14:20:24 drbd0: conn( WFSyncUUID -> Connected ) disk( Inconsistent -> Failed )
14:20:24 drbd0: helper command: /sbin/drbdadm before-resync-target minor-0 exit code 0 (0x0)
14:20:24 drbd0: conn( Connected -> SyncTarget ) disk( Failed -> Inconsistent )
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd')
-rw-r--r-- | drivers/block/drbd/drbd_worker.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index 62bde5ae17f7..5fc60f622bed 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c | |||
@@ -1537,14 +1537,14 @@ void drbd_start_resync(struct drbd_conf *mdev, enum drbd_conns side) | |||
1537 | } | 1537 | } |
1538 | 1538 | ||
1539 | drbd_state_lock(mdev); | 1539 | drbd_state_lock(mdev); |
1540 | 1540 | write_lock_irq(&global_state_lock); | |
1541 | if (!get_ldev_if_state(mdev, D_NEGOTIATING)) { | 1541 | if (!get_ldev_if_state(mdev, D_NEGOTIATING)) { |
1542 | write_unlock_irq(&global_state_lock); | ||
1542 | drbd_state_unlock(mdev); | 1543 | drbd_state_unlock(mdev); |
1543 | return; | 1544 | return; |
1544 | } | 1545 | } |
1545 | 1546 | ||
1546 | write_lock_irq(&global_state_lock); | 1547 | ns.i = mdev->state.i; |
1547 | ns = mdev->state; | ||
1548 | 1548 | ||
1549 | ns.aftr_isp = !_drbd_may_sync_now(mdev); | 1549 | ns.aftr_isp = !_drbd_may_sync_now(mdev); |
1550 | 1550 | ||