From: John L. Hammond Date: Mon, 11 Dec 2017 19:03:20 +0000 (-0600) Subject: LU-10302 ldlm: destroy lock if LVB init fails X-Git-Tag: 2.10.57~70 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=c91cb6ee81e7751b719228efa58dc32fdea836e5 LU-10302 ldlm: destroy lock if LVB init fails In ldlm_cli_enqueue_local(), destroy the newly created lock if ldlm_lvbo_init() fails. Rename sanity test_232() to test_232a(), fix the fail_loc setting to happen on the correct node, and check that the OST can be unmounted after the failed write. Add sanity test_232b() to do the same but for data version since that uses a different LDLM path. Signed-off-by: John L. Hammond Change-Id: I18e9594b9a2461afbc66128f477d3185a6627bc0 Reviewed-on: https://review.whamcloud.com/30477 Reviewed-by: Quentin Bouget Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin --- diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index b901a46..c4b9e6f 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -466,6 +466,7 @@ int ldlm_cli_enqueue_local(struct ldlm_namespace *ns, err = ldlm_lvbo_init(lock->l_resource); if (err < 0) { LDLM_ERROR(lock, "delayed lvb init failed (rc %d)", err); + ldlm_lock_destroy_nolock(lock); GOTO(out, err); } diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 78db3fd..b1b61eb 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -14202,19 +14202,44 @@ test_231b() { } run_test 231b "must not assert on fully utilized OST request buffer" -test_232() { +test_232a() { mkdir -p $DIR/$tdir + $LFS setstripe -c1 -i0 $DIR/$tdir/$tfile + #define OBD_FAIL_LDLM_OST_LVB 0x31c - $LCTL set_param fail_loc=0x31c + do_facet ost1 $LCTL set_param fail_loc=0x31c # ignore dd failure dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=1 || true - $LCTL set_param fail_loc=0 + do_facet ost1 $LCTL set_param fail_loc=0 + umount_client $MOUNT || error "umount failed" + mount_client $MOUNT || error "mount failed" + stop ost1 || error "cannot stop ost1" + start ost1 $(ostdevname 1) $OST_MOUNT_OPTS || error "cannot start ost1" +} +run_test 232a "failed lock should not block umount" + +test_232b() { + mkdir -p $DIR/$tdir + $LFS setstripe -c1 -i0 $DIR/$tdir/$tfile + dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=1 + sync + cancel_lru_locks osc + + #define OBD_FAIL_LDLM_OST_LVB 0x31c + do_facet ost1 $LCTL set_param fail_loc=0x31c + + # ignore failure + $LFS data_version $DIR/$tdir/$tfile || true + + do_facet ost1 $LCTL set_param fail_loc=0 umount_client $MOUNT || error "umount failed" mount_client $MOUNT || error "mount failed" + stop ost1 || error "cannot stop ost1" + start ost1 $(ostdevname 1) $OST_MOUNT_OPTS || error "cannot start ost1" } -run_test 232 "failed lock should not block umount" +run_test 232b "failed data version lock should not block umount" test_233a() { [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.3.64) ] ||