ocfs2/dlm: return in progress if master can not clear the refmap bit right now
PATCH 2/4 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 <[email protected]>
--- fs/ocfs2/dlm/dlmcommon.h | 5 +++++ fs/ocfs2/dlm/dlmmaster.c | 8 +++++--- fs/ocfs2/dlm/dlmthread.c | 7 +++++++ 3 files changed, 17 insertions(+), 3 deletions(-)
fs/ocfs2/dlm/dlmcommon.h +5 -0
@@ -783,6 +783,11 @@ struct dlm_deref_lockresu8 name[O2NM_MAX_NAME_LEN ]; }; +enum { +DLM_DEREF_RESPONSE_DONE =0 , +DLM_DEREF_RESPONSE_INPROG =1 , +}; +struct dlm_deref_lockres_done {u32 pad1;u16 pad2;
fs/ocfs2/dlm/dlmmaster.c +5 -3
@@ -2278,7 +2278,7 @@ int dlm_drop_lockres_ref(struct dlm_ctxt *dlm, struct dlm_lock_resource *res)dlm_print_one_lock_resource (res);BUG (); } -return ret; +return ret ? ret : r; } int 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, res->lockname.len, res->lockname.name, node);dlm_print_one_lock_resource (res); } - ret =0 ; + ret =DLM_DEREF_RESPONSE_DONE ; goto done; }
@@ -2365,7 +2365,7 @@ int dlm_deref_lockres_handler(struct o2net_msg *msg, u32 len, void *data,spin_unlock (&dlm->work_lock);queue_work (dlm->dlm_worker, &dlm->dispatched_work); -return 0 ; +return DLM_DEREF_RESPONSE_INPROG ; done:if (res)
@@ -2511,6 +2511,8 @@ static void dlm_deref_lockres_worker(struct dlm_work_item *item, void *data) }spin_unlock (&res->spinlock); +dlm_drop_lockres_ref_done (dlm, res, node); +if (cleared) {mlog (0 ,"%s:%.*s node %u ref dropped in dispatch\n" , dlm->name, res->lockname.len, res->lockname.name, node);
fs/ocfs2/dlm/dlmthread.c +7 -0
@@ -202,6 +202,13 @@ static void dlm_purge_lockres(struct dlm_ctxt *dlm, dlm->purge_count--; } +if (!master && ret !=0 ) { +mlog (0 ,"%s: deref %.*s in progress or master goes down\n" , + dlm->name, res->lockname.len, res->lockname.name); +spin_unlock (&res->spinlock); +return ; + } +if (!__dlm_lockres_unused (res)) {mlog (ML_ERROR ,"%s: res %.*s in use after deref\n" , dlm->name, res->lockname.len, res->lockname.name);
Signature · 1 line
1.8.4.3
PATCH 2/4 ocfs2/dlm: return in progress if master can not clear the refmap bit right now
Quoted 5 lines · xuejiufei
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 <[email protected]>
Reviewed-by Joseph Qi <[email protected]>
Quoted 81 lines
--- fs/ocfs2/dlm/dlmcommon.h | 5 +++++ fs/ocfs2/dlm/dlmmaster.c | 8 +++++--- fs/ocfs2/dlm/dlmthread.c | 7 +++++++ 3 files changed, 17 insertions(+), 3 deletions(-)fs/ocfs2/dlm/dlmcommon.h +5
-0@@ -783,6 +783,11 @@ struct dlm_deref_lockresu8 name[O2NM_MAX_NAME_LEN ]; }; +enum { +DLM_DEREF_RESPONSE_DONE =0 , +DLM_DEREF_RESPONSE_INPROG =1 , +}; +struct dlm_deref_lockres_done {u32 pad1;u16 pad2;fs/ocfs2/dlm/dlmmaster.c +5
-3@@ -2278,7 +2278,7 @@ int dlm_drop_lockres_ref(struct dlm_ctxt *dlm, struct dlm_lock_resource *res)dlm_print_one_lock_resource (res);BUG (); } -return ret; +return ret ? ret : r; } int 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, res->lockname.len, res->lockname.name, node);dlm_print_one_lock_resource (res); } - ret =0 ; + ret =DLM_DEREF_RESPONSE_DONE ; goto done; }@@ -2365,7 +2365,7 @@ int dlm_deref_lockres_handler(struct o2net_msg *msg, u32 len, void *data,spin_unlock (&dlm->work_lock);queue_work (dlm->dlm_worker, &dlm->dispatched_work); -return 0 ; +return DLM_DEREF_RESPONSE_INPROG ; done:if (res)@@ -2511,6 +2511,8 @@ static void dlm_deref_lockres_worker(struct dlm_work_item *item, void *data) }spin_unlock (&res->spinlock); +dlm_drop_lockres_ref_done (dlm, res, node); +if (cleared) {mlog (0 ,"%s:%.*s node %u ref dropped in dispatch\n" , dlm->name, res->lockname.len, res->lockname.name, node);fs/ocfs2/dlm/dlmthread.c +7
-0@@ -202,6 +202,13 @@ static void dlm_purge_lockres(struct dlm_ctxt *dlm, dlm->purge_count--; } +if (!master && ret !=0 ) { +mlog (0 ,"%s: deref %.*s in progress or master goes down\n" , + dlm->name, res->lockname.len, res->lockname.name); +spin_unlock (&res->spinlock); +return ; + } +if (!__dlm_lockres_unused (res)) {mlog (ML_ERROR ,"%s: res %.*s in use after deref\n" , dlm->name, res->lockname.len, res->lockname.name);