Commit d6385db9 authored by Guoqing Jiang's avatar Guoqing Jiang Committed by Shaohua Li

md-cluster: make resync lock also could be interruptted

When one node is perform resync or recovery, other nodes
can't get resync lock and could block for a while before
it holds the lock, so we can't stop array immediately for
this scenario.

To make array could be stop quickly, we check MD_CLOSING
in dlm_lock_sync_interruptible to make us can interrupt
the lock request.
Reviewed-by: default avatarNeilBrown <neilb@suse.com>
Signed-off-by: default avatarGuoqing Jiang <gqjiang@suse.com>
Signed-off-by: default avatarShaohua Li <shli@fb.com>
parent 7bcda714
...@@ -161,7 +161,8 @@ static int dlm_lock_sync_interruptible(struct dlm_lock_resource *res, int mode, ...@@ -161,7 +161,8 @@ static int dlm_lock_sync_interruptible(struct dlm_lock_resource *res, int mode,
return ret; return ret;
wait_event(res->sync_locking, res->sync_locking_done wait_event(res->sync_locking, res->sync_locking_done
|| kthread_should_stop()); || kthread_should_stop()
|| test_bit(MD_CLOSING, &mddev->flags));
if (!res->sync_locking_done) { if (!res->sync_locking_done) {
/* /*
* the convert queue contains the lock request when request is * the convert queue contains the lock request when request is
...@@ -1045,7 +1046,7 @@ static void metadata_update_cancel(struct mddev *mddev) ...@@ -1045,7 +1046,7 @@ static void metadata_update_cancel(struct mddev *mddev)
static int resync_start(struct mddev *mddev) static int resync_start(struct mddev *mddev)
{ {
struct md_cluster_info *cinfo = mddev->cluster_info; struct md_cluster_info *cinfo = mddev->cluster_info;
return dlm_lock_sync(cinfo->resync_lockres, DLM_LOCK_EX); return dlm_lock_sync_interruptible(cinfo->resync_lockres, DLM_LOCK_EX, mddev);
} }
static int resync_info_update(struct mddev *mddev, sector_t lo, sector_t hi) static int resync_info_update(struct mddev *mddev, sector_t lo, sector_t hi)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment