@@ -3032,8 +3032,12 @@ static void rbd_acquire_lock(struct work_struct *work)
}
} else if (ret < 0) {
rbd_warn(rbd_dev, "error requesting lock: %d", ret);
- mod_delayed_work(rbd_dev->task_wq, &rbd_dev->lock_dwork,
- RBD_RETRY_DELAY);
+ spin_lock_irq(&rbd_dev->lock);
+ if (!test_bit(RBD_DEV_FLAG_REMOVING, &rbd_dev->flags)) {
+ mod_delayed_work(rbd_dev->task_wq, &rbd_dev->lock_dwork,
+ RBD_RETRY_DELAY);
+ }
+ spin_unlock_irq(&rbd_dev->lock);
} else {
/*
* lock owner acked, but resend if we don't see them
@@ -3041,8 +3045,12 @@ static void rbd_acquire_lock(struct work_struct *work)
*/
dout("%s rbd_dev %p requeueing lock_dwork\n", __func__,
rbd_dev);
- mod_delayed_work(rbd_dev->task_wq, &rbd_dev->lock_dwork,
- msecs_to_jiffies(2 * RBD_NOTIFY_TIMEOUT * MSEC_PER_SEC));
+ spin_lock_irq(&rbd_dev->lock);
+ if (!test_bit(RBD_DEV_FLAG_REMOVING, &rbd_dev->flags)) {
+ mod_delayed_work(rbd_dev->task_wq, &rbd_dev->lock_dwork,
+ msecs_to_jiffies(2 * RBD_NOTIFY_TIMEOUT * MSEC_PER_SEC));
+ }
+ spin_unlock_irq(&rbd_dev->lock);
}
}
We should not queue a lock delayed work after cancel_delayed_work_sync(&rbd_dev->lock_dwork); So let's don't queue lock delayed work when we are removing device. Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn> --- drivers/block/rbd.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)