aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorxuejiufei <xuejiufei@huawei.com>2016-03-15 17:53:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-15 19:55:16 -0400
commitd277f33eda000ca03b1497fcf1c9e2ec33adf4c6 (patch)
treed870e8e541e9cb6ddd5ed33bedccaa31e5e5e29f /fs
parent8c0343968163dc3536e56268026f475b1bbf61b4 (diff)
ocfs2/dlm: return EINVAL when the lockres on migration target is in DROPPING_REF state
If master migrate this lock resource to node when it happened to purge it, a new lock resource will be created and inserted into hash list. If then master goes down, the lock resource being purged is recovered, so there exist two lock resource with different owner. So return error to master if the lock resource is in DROPPING state, master will retry to migrate this lock resource. Signed-off-by: xuejiufei <xuejiufei@huawei.com> Cc: Mark Fasheh <mfasheh@suse.de> Cc: Joel Becker <jlbec@evilplan.org> Cc: Junxiao Bi <junxiao.bi@oracle.com> Reviewed-by: Joseph Qi <joseph.qi@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/dlm/dlmrecovery.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index 1eee96e25565..213279db3f28 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -1403,12 +1403,24 @@ int dlm_mig_lockres_handler(struct o2net_msg *msg, u32 len, void *data,
1403 * and RECOVERY flag changed when it completes. */ 1403 * and RECOVERY flag changed when it completes. */
1404 hash = dlm_lockid_hash(mres->lockname, mres->lockname_len); 1404 hash = dlm_lockid_hash(mres->lockname, mres->lockname_len);
1405 spin_lock(&dlm->spinlock); 1405 spin_lock(&dlm->spinlock);
1406 res = __dlm_lookup_lockres(dlm, mres->lockname, mres->lockname_len, 1406 res = __dlm_lookup_lockres_full(dlm, mres->lockname, mres->lockname_len,
1407 hash); 1407 hash);
1408 if (res) { 1408 if (res) {
1409 /* this will get a ref on res */ 1409 /* this will get a ref on res */
1410 /* mark it as recovering/migrating and hash it */ 1410 /* mark it as recovering/migrating and hash it */
1411 spin_lock(&res->spinlock); 1411 spin_lock(&res->spinlock);
1412 if (res->state & DLM_LOCK_RES_DROPPING_REF) {
1413 mlog(0, "%s: node is attempting to migrate "
1414 "lockres %.*s, but marked as dropping "
1415 " ref!\n", dlm->name,
1416 mres->lockname_len, mres->lockname);
1417 ret = -EINVAL;
1418 spin_unlock(&res->spinlock);
1419 spin_unlock(&dlm->spinlock);
1420 dlm_lockres_put(res);
1421 goto leave;
1422 }
1423
1412 if (mres->flags & DLM_MRES_RECOVERY) { 1424 if (mres->flags & DLM_MRES_RECOVERY) {
1413 res->state |= DLM_LOCK_RES_RECOVERING; 1425 res->state |= DLM_LOCK_RES_RECOVERING;
1414 } else { 1426 } else {