diff options
author | Sunil Mushran <sunil.mushran@oracle.com> | 2008-12-16 18:49:19 -0500 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-01-05 11:40:35 -0500 |
commit | 2b83256407687613e906bee93d98a25339128a4d (patch) | |
tree | 5886c51adcb20b3d735ccf38e1f7e70671aefb43 /fs/ocfs2/dlm/dlmmaster.c | |
parent | 58896c4d0e5868360ea0693c607d5bf74f79da6b (diff) |
ocfs2/dlm: Fix a race between migrate request and exit domain
Patch address a racing migrate request message and an exit domain message.
Instead of blocking exit domains for the duration of the migrate, we ignore
failure to deliver that message. This is because an exiting domain should
not have any active locks and thus has no role to play in the migration.
Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/dlm/dlmmaster.c')
-rw-r--r-- | fs/ocfs2/dlm/dlmmaster.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 44f87caf3683..92fd1d7d6126 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -2949,7 +2949,7 @@ static int dlm_do_migrate_request(struct dlm_ctxt *dlm, | |||
2949 | struct dlm_node_iter *iter) | 2949 | struct dlm_node_iter *iter) |
2950 | { | 2950 | { |
2951 | struct dlm_migrate_request migrate; | 2951 | struct dlm_migrate_request migrate; |
2952 | int ret, status = 0; | 2952 | int ret, skip, status = 0; |
2953 | int nodenum; | 2953 | int nodenum; |
2954 | 2954 | ||
2955 | memset(&migrate, 0, sizeof(migrate)); | 2955 | memset(&migrate, 0, sizeof(migrate)); |
@@ -2966,12 +2966,27 @@ static int dlm_do_migrate_request(struct dlm_ctxt *dlm, | |||
2966 | nodenum == new_master) | 2966 | nodenum == new_master) |
2967 | continue; | 2967 | continue; |
2968 | 2968 | ||
2969 | /* We could race exit domain. If exited, skip. */ | ||
2970 | spin_lock(&dlm->spinlock); | ||
2971 | skip = (!test_bit(nodenum, dlm->domain_map)); | ||
2972 | spin_unlock(&dlm->spinlock); | ||
2973 | if (skip) { | ||
2974 | clear_bit(nodenum, iter->node_map); | ||
2975 | continue; | ||
2976 | } | ||
2977 | |||
2969 | ret = o2net_send_message(DLM_MIGRATE_REQUEST_MSG, dlm->key, | 2978 | ret = o2net_send_message(DLM_MIGRATE_REQUEST_MSG, dlm->key, |
2970 | &migrate, sizeof(migrate), nodenum, | 2979 | &migrate, sizeof(migrate), nodenum, |
2971 | &status); | 2980 | &status); |
2972 | if (ret < 0) | 2981 | if (ret < 0) { |
2973 | mlog_errno(ret); | 2982 | mlog(0, "migrate_request returned %d!\n", ret); |
2974 | else if (status < 0) { | 2983 | if (!dlm_is_host_down(ret)) { |
2984 | mlog(ML_ERROR, "unhandled error=%d!\n", ret); | ||
2985 | BUG(); | ||
2986 | } | ||
2987 | clear_bit(nodenum, iter->node_map); | ||
2988 | ret = 0; | ||
2989 | } else if (status < 0) { | ||
2975 | mlog(0, "migrate request (node %u) returned %d!\n", | 2990 | mlog(0, "migrate request (node %u) returned %d!\n", |
2976 | nodenum, status); | 2991 | nodenum, status); |
2977 | ret = status; | 2992 | ret = status; |