* [Ocfs2-devel] [PATCH] ocfs2/dlm: return appropriate value when dlm_grab() returns NULL
@ 2015-12-18 3:26 Xue jiufei
0 siblings, 0 replies; only message in thread
From: Xue jiufei @ 2015-12-18 3:26 UTC (permalink / raw)
To: ocfs2-devel
Function dlm_grab() may return NULL when the node is doing unmount.
When doing code review, we found that some dlm handlers may return
error to caller when dlm_grab() returns NULL and make caller
BUG or other problems. Here is an example:
Node 1 Node 2
receives migration message
from node 3, and send
migrate request to others
start unmounting
receives migrate request
from node 1 and call
dlm_migrate_request_handler()
unmount thread unregisters
domain handlers and removes
dlm_context from dlm_domains
dlm_migrate_request_handlers()
returns -EINVAL to node 1
Exit migration neither clearing the
migration state nor sending
assert master message to node 3 which
cause node 3 hung.
Signed-off-by: Jiufei Xue <xuejiufei@huawei.com>
Reviewed-by: Joseph Qi <joseph.qi@huawei.com>
Reviewed-by: Yiwen Jiang <jiangyiwen@huawei.com>
---
fs/ocfs2/dlm/dlmmaster.c | 2 +-
fs/ocfs2/dlm/dlmunlock.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index ce38b4c..c43da7f 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -3048,7 +3048,7 @@ int dlm_migrate_request_handler(struct o2net_msg *msg, u32 len, void *data,
int ret = 0;
if (!dlm_grab(dlm))
- return -EINVAL;
+ return 0;
name = migrate->name;
namelen = migrate->namelen;
diff --git a/fs/ocfs2/dlm/dlmunlock.c b/fs/ocfs2/dlm/dlmunlock.c
index 2e3c9db..1082b2c 100644
--- a/fs/ocfs2/dlm/dlmunlock.c
+++ b/fs/ocfs2/dlm/dlmunlock.c
@@ -421,7 +421,7 @@ int dlm_unlock_lock_handler(struct o2net_msg *msg, u32 len, void *data,
}
if (!dlm_grab(dlm))
- return DLM_REJECTED;
+ return DLM_FORWARD;
mlog_bug_on_msg(!dlm_domain_fully_joined(dlm),
"Domain %s not fully joined!\n", dlm->name);
--
1.8.4.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-12-18 3:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-18 3:26 [Ocfs2-devel] [PATCH] ocfs2/dlm: return appropriate value when dlm_grab() returns NULL Xue jiufei
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.