Whamcloud - gitweb
LU-5982 lfsck: not unlock the object repeatedly 43/12943/3
authorFan Yong <fan.yong@intel.com>
Wed, 24 Sep 2014 04:10:29 +0000 (12:10 +0800)
committerAndreas Dilger <andreas.dilger@intel.com>
Sat, 6 Dec 2014 21:41:12 +0000 (21:41 +0000)
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 <fan.yong@intel.com>
Change-Id: I3901d5cea8afde362dca8ee25a8d2a44e9f6ffea
Reviewed-on: http://review.whamcloud.com/12943
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
lustre/lfsck/lfsck_namespace.c
lustre/tests/sanity-lfsck.sh

index 9b67144..7032827 100644 (file)
@@ -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));
 
 
        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);
 
        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;
                rc = 1;
-       else if (rc == -EEXIST)
+       } else if (rc == -EEXIST) {
+               orphan->do_lu.lo_header->loh_attr |= LOHA_EXISTS;
                rc = 0;
                rc = 0;
+       }
 
        GOTO(out, rc);
 
 
        GOTO(out, rc);
 
index e563d03..d725d64 100644 (file)
@@ -28,7 +28,7 @@ SAVED_OSTCOUNT=${OSTCOUNT}
 # do not use too small MDSSIZE/OSTSIZE, which affect the default journal size
 MDSSIZE=100000
 OSTSIZE=100000
 # 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.
 [ $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 "#####"
 
 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 "#####"
        echo "will be recorded in the linkEA. Under such case, LFSCK should"
        echo "skip the nlink verification for this object."
        echo "#####"