From: Fan Yong Date: Wed, 24 Sep 2014 04:10:29 +0000 (+0800) Subject: LU-5982 lfsck: not unlock the object repeatedly X-Git-Tag: 2.6.92~85 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=8ee9c59a3688e5026ebb914190b63970135ce2e5 LU-5982 lfsck: not unlock the object repeatedly There was wrong logic in lfsck_namespace_insert_orphan() that tried to unlock the same object twice if failed to update the object's linkEA, then triggered low layer LBUG(). Fix it. On the other hand, the remote orphan parent object should be marked as LOHA_EXISTS after lfsck_namespace_create_orphan_remote() done. Some test scripts cleanup. Signed-off-by: Fan Yong Change-Id: I3901d5cea8afde362dca8ee25a8d2a44e9f6ffea Reviewed-on: http://review.whamcloud.com/12943 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Alex Zhuravlev --- diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c index 9b67144..7032827 100644 --- a/lustre/lfsck/lfsck_namespace.c +++ b/lustre/lfsck/lfsck_namespace.c @@ -997,10 +997,8 @@ static int lfsck_namespace_insert_orphan(const struct lu_env *env, } } - if (rc != 0) - GOTO(unlock, rc); - - rc = dt_attr_set(env, orphan, la, th, BYPASS_CAPA); + if (rc == 0) + rc = dt_attr_set(env, orphan, la, th, BYPASS_CAPA); GOTO(stop, rc = (rc == 0 ? 1 : rc)); @@ -1245,10 +1243,13 @@ static int lfsck_namespace_create_orphan_remote(const struct lu_env *env, rc = ptlrpc_queue_wait(req); ptlrpc_req_finished(req); - if (rc == 0) + if (rc == 0) { + orphan->do_lu.lo_header->loh_attr |= LOHA_EXISTS; rc = 1; - else if (rc == -EEXIST) + } else if (rc == -EEXIST) { + orphan->do_lu.lo_header->loh_attr |= LOHA_EXISTS; rc = 0; + } GOTO(out, rc); diff --git a/lustre/tests/sanity-lfsck.sh b/lustre/tests/sanity-lfsck.sh index e563d03..d725d64 100644 --- a/lustre/tests/sanity-lfsck.sh +++ b/lustre/tests/sanity-lfsck.sh @@ -28,7 +28,7 @@ SAVED_OSTCOUNT=${OSTCOUNT} # do not use too small MDSSIZE/OSTSIZE, which affect the default journal size MDSSIZE=100000 OSTSIZE=100000 -# no need too much OSTs, to reduce the format/start/stop overhead +# no need too many OSTs, to reduce the format/start/stop overhead [ $OSTCOUNT -gt 4 ] && OSTCOUNT=4 # build up a clean test environment. @@ -3590,8 +3590,8 @@ run_test 29b "LFSCK can repair bad nlink count (2)" test_29c() { echo "#####" - echo "There are too much hard links to the object, and exceeds the - echo object's linkEA limitation, as to NOT all the known name entries" + echo "There are too many hard links to the object, and exceeds the" + echo "object's linkEA limitation, as to NOT all the known name entries" echo "will be recorded in the linkEA. Under such case, LFSCK should" echo "skip the nlink verification for this object." echo "#####"