From ddb28cadcaaf4a443aa341e450ae651863816ac8 Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Sat, 13 Jul 2013 14:35:15 +0800 Subject: [PATCH] LU-3649 lfsck: release object reference when reset lfsck 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 Change-Id: I2f5dd9933e0870849d85d03909b2d7926d244029 Reviewed-on: http://review.whamcloud.com/7190 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Patrick Farrell --- lustre/lfsck/lfsck_namespace.c | 2 ++ lustre/tests/sanity-lfsck.sh | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c index 01bead5..3f49e3c 100644 --- a/lustre/lfsck/lfsck_namespace.c +++ b/lustre/lfsck/lfsck_namespace.c @@ -675,6 +675,8 @@ static int lfsck_namespace_reset(const struct lu_env *env, 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, diff --git a/lustre/tests/sanity-lfsck.sh b/lustre/tests/sanity-lfsck.sh index 9ab0b9a..9e038e6 100644 --- a/lustre/tests/sanity-lfsck.sh +++ b/lustre/tests/sanity-lfsck.sh @@ -128,6 +128,21 @@ test_0() { 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" -- 1.8.3.1