aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorxuejiufei <xuejiufei@huawei.com>2016-03-15 17:53:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-15 19:55:16 -0400
commit842b90b62461d0848bd56ad776117d15a5fa95c0 (patch)
treea8e5c2248a2fc9f2e77d8624c75f271214715199 /fs
parent60d663cb527340c87c6cb98842e90a43243e1607 (diff)
ocfs2/dlm: return in progress if master can not clear the refmap bit right now
Master returns in-progress to non-master node when it can not clear the refmap bit right now. And non-master node will not purge the lock resource until receiving deref done message. Signed-off-by: xuejiufei <xuejiufei@huawei.com> Cc: Mark Fasheh <mfasheh@suse.de> Cc: Joel Becker <jlbec@evilplan.org> Cc: Junxiao Bi <junxiao.bi@oracle.com> Reviewed-by: Joseph Qi <joseph.qi@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/dlm/dlmcommon.h5
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c8
-rw-r--r--fs/ocfs2/dlm/dlmthread.c7
3 files changed, 17 insertions, 3 deletions
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h
index c9f97da9231a..3b77862fc85d 100644
--- a/fs/ocfs2/dlm/dlmcommon.h
+++ b/fs/ocfs2/dlm/dlmcommon.h
@@ -783,6 +783,11 @@ struct dlm_deref_lockres
783 u8 name[O2NM_MAX_NAME_LEN]; 783 u8 name[O2NM_MAX_NAME_LEN];
784}; 784};
785 785
786enum {
787 DLM_DEREF_RESPONSE_DONE = 0,
788 DLM_DEREF_RESPONSE_INPROG = 1,
789};
790
786struct dlm_deref_lockres_done { 791struct dlm_deref_lockres_done {
787 u32 pad1; 792 u32 pad1;
788 u16 pad2; 793 u16 pad2;
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 8913e7d443da..87e22541850e 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -2278,7 +2278,7 @@ int dlm_drop_lockres_ref(struct dlm_ctxt *dlm, struct dlm_lock_resource *res)
2278 dlm_print_one_lock_resource(res); 2278 dlm_print_one_lock_resource(res);
2279 BUG(); 2279 BUG();
2280 } 2280 }
2281 return ret; 2281 return ret ? ret : r;
2282} 2282}
2283 2283
2284int dlm_deref_lockres_handler(struct o2net_msg *msg, u32 len, void *data, 2284int dlm_deref_lockres_handler(struct o2net_msg *msg, u32 len, void *data,
@@ -2345,7 +2345,7 @@ int dlm_deref_lockres_handler(struct o2net_msg *msg, u32 len, void *data,
2345 res->lockname.len, res->lockname.name, node); 2345 res->lockname.len, res->lockname.name, node);
2346 dlm_print_one_lock_resource(res); 2346 dlm_print_one_lock_resource(res);
2347 } 2347 }
2348 ret = 0; 2348 ret = DLM_DEREF_RESPONSE_DONE;
2349 goto done; 2349 goto done;
2350 } 2350 }
2351 2351
@@ -2365,7 +2365,7 @@ int dlm_deref_lockres_handler(struct o2net_msg *msg, u32 len, void *data,
2365 spin_unlock(&dlm->work_lock); 2365 spin_unlock(&dlm->work_lock);
2366 2366
2367 queue_work(dlm->dlm_worker, &dlm->dispatched_work); 2367 queue_work(dlm->dlm_worker, &dlm->dispatched_work);
2368 return 0; 2368 return DLM_DEREF_RESPONSE_INPROG;
2369 2369
2370done: 2370done:
2371 if (res) 2371 if (res)
@@ -2511,6 +2511,8 @@ static void dlm_deref_lockres_worker(struct dlm_work_item *item, void *data)
2511 } 2511 }
2512 spin_unlock(&res->spinlock); 2512 spin_unlock(&res->spinlock);
2513 2513
2514 dlm_drop_lockres_ref_done(dlm, res, node);
2515
2514 if (cleared) { 2516 if (cleared) {
2515 mlog(0, "%s:%.*s node %u ref dropped in dispatch\n", 2517 mlog(0, "%s:%.*s node %u ref dropped in dispatch\n",
2516 dlm->name, res->lockname.len, res->lockname.name, node); 2518 dlm->name, res->lockname.len, res->lockname.name, node);
diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c
index c5f6c241ecd7..22e6eb8b8d22 100644
--- a/fs/ocfs2/dlm/dlmthread.c
+++ b/fs/ocfs2/dlm/dlmthread.c
@@ -202,6 +202,13 @@ static void dlm_purge_lockres(struct dlm_ctxt *dlm,
202 dlm->purge_count--; 202 dlm->purge_count--;
203 } 203 }
204 204
205 if (!master && ret != 0) {
206 mlog(0, "%s: deref %.*s in progress or master goes down\n",
207 dlm->name, res->lockname.len, res->lockname.name);
208 spin_unlock(&res->spinlock);
209 return;
210 }
211
205 if (!__dlm_lockres_unused(res)) { 212 if (!__dlm_lockres_unused(res)) {
206 mlog(ML_ERROR, "%s: res %.*s in use after deref\n", 213 mlog(ML_ERROR, "%s: res %.*s in use after deref\n",
207 dlm->name, res->lockname.len, res->lockname.name); 214 dlm->name, res->lockname.len, res->lockname.name);