Whamcloud - gitweb
LU-3649 lfsck: release object reference when reset lfsck 90/7190/5
authorFan Yong <fan.yong@intel.com>
Sat, 13 Jul 2013 06:35:15 +0000 (14:35 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 26 Aug 2013 15:08:52 +0000 (15:08 +0000)
When reset lfsck, related lfsck tracing file will be re-created,
but we forgot to release the object reference of the old tracing
file, then trigger LASSERT() when related device to be released.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I2f5dd9933e0870849d85d03909b2d7926d244029
Reviewed-on: http://review.whamcloud.com/7190
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Patrick Farrell <paf@cray.com>
lustre/lfsck/lfsck_namespace.c
lustre/tests/sanity-lfsck.sh

index 01bead5..3f49e3c 100644 (file)
@@ -675,6 +675,8 @@ static int lfsck_namespace_reset(const struct lu_env *env,
        if (rc != 0)
                GOTO(out, rc);
 
        if (rc != 0)
                GOTO(out, rc);
 
+       lfsck_object_put(env, com->lc_obj);
+       com->lc_obj = NULL;
        dto = local_index_find_or_create(env, lfsck->li_los, lfsck->li_local_root,
                                         lfsck_namespace_name,
                                         S_IFREG | S_IRUGO | S_IWUSR,
        dto = local_index_find_or_create(env, lfsck->li_los, lfsck->li_local_root,
                                         lfsck_namespace_name,
                                         S_IFREG | S_IRUGO | S_IWUSR,
index 9ab0b9a..9e038e6 100644 (file)
@@ -128,6 +128,21 @@ test_0() {
                         awk '/^updated_phase1/ { print $2 }')
        [ $repaired -eq 0 ] ||
                error "(10) Expect nothing to be repaired, but got: $repaired"
                         awk '/^updated_phase1/ { print $2 }')
        [ $repaired -eq 0 ] ||
                error "(10) Expect nothing to be repaired, but got: $repaired"
+
+       local scanned1=$($SHOW_NAMESPACE | awk '/^success_count/ { print $2 }')
+       $START_NAMESPACE -r || error "(11) Fail to reset LFSCK!"
+       sleep 3
+
+       STATUS=$($SHOW_NAMESPACE | awk '/^status/ { print $2 }')
+       [ "$STATUS" == "completed" ] ||
+               error "(12) Expect 'completed', but got '$STATUS'"
+
+       local scanned2=$($SHOW_NAMESPACE | awk '/^success_count/ { print $2 }')
+       [ $((scanned1 + 1)) -eq $scanned2 ] ||
+               error "(13) Expect success $((scanned1 + 1)), but got $scanned2"
+
+       echo "stopall, should NOT crash LU-3649"
+       stopall > /dev/null
 }
 run_test 0 "Control LFSCK manually"
 
 }
 run_test 0 "Control LFSCK manually"