Skip to content

Commit

Permalink
drbd: in drbd_suspend_al, set AL_SUSPENDED before unlocking the activ…
Browse files Browse the repository at this point in the history
…ity log

As using an empty activity log is the whole point of the excercise,
make sure it is still empty when setting AL_SUSPENDED.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
  • Loading branch information
Lars Ellenberg authored and Philipp Reisner committed Oct 14, 2011
1 parent 867f574 commit 6161042
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/block/drbd/drbd_nl.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,19 +901,17 @@ static void drbd_suspend_al(struct drbd_conf *mdev)
{
int s = 0;

if (lc_try_lock(mdev->act_log)) {
drbd_al_shrink(mdev);
lc_unlock(mdev->act_log);
} else {
if (!lc_try_lock(mdev->act_log)) {
dev_warn(DEV, "Failed to lock al in drbd_suspend_al()\n");
return;
}

drbd_al_shrink(mdev);
spin_lock_irq(&mdev->tconn->req_lock);
if (mdev->state.conn < C_CONNECTED)
s = !test_and_set_bit(AL_SUSPENDED, &mdev->flags);

spin_unlock_irq(&mdev->tconn->req_lock);
lc_unlock(mdev->act_log);

if (s)
dev_info(DEV, "Suspended AL updates\n");
Expand Down

0 comments on commit 6161042

Please sign in to comment.