Skip to content

Commit c372f21

Browse files
xuejiufeitorvalds
authored andcommitted
ocfs2/dlm: return appropriate value when dlm_grab() returns NULL
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 <[email protected]> Reviewed-by: Joseph Qi <[email protected]> Reviewed-by: Yiwen Jiang <[email protected]> Cc: Mark Fasheh <[email protected]> Cc: Joel Becker <[email protected]> Cc: Junxiao Bi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 72865d9 commit c372f21

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

fs/ocfs2/dlm/dlmmaster.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3050,7 +3050,7 @@ int dlm_migrate_request_handler(struct o2net_msg *msg, u32 len, void *data,
30503050
int ret = 0;
30513051

30523052
if (!dlm_grab(dlm))
3053-
return -EINVAL;
3053+
return 0;
30543054

30553055
name = migrate->name;
30563056
namelen = migrate->namelen;

fs/ocfs2/dlm/dlmunlock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ int dlm_unlock_lock_handler(struct o2net_msg *msg, u32 len, void *data,
421421
}
422422

423423
if (!dlm_grab(dlm))
424-
return DLM_REJECTED;
424+
return DLM_FORWARD;
425425

426426
mlog_bug_on_msg(!dlm_domain_fully_joined(dlm),
427427
"Domain %s not fully joined!\n", dlm->name);

0 commit comments

Comments
 (0)