Skip to content

Commit

Permalink
ocfs2/dlm: return appropriate value when dlm_grab() returns NULL
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
xuejiufei authored and torvalds committed Jan 15, 2016
1 parent 72865d9 commit c372f21
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fs/ocfs2/dlm/dlmmaster.c
Original file line number Diff line number Diff line change
Expand Up @@ -3050,7 +3050,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;
Expand Down
2 changes: 1 addition & 1 deletion fs/ocfs2/dlm/dlmunlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c372f21

Please sign in to comment.