Whamcloud - gitweb
LU-10302 ldlm: destroy lock if LVB init fails 77/30477/3
authorJohn L. Hammond <john.hammond@intel.com>
Mon, 11 Dec 2017 19:03:20 +0000 (13:03 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 22 Dec 2017 06:49:35 +0000 (06:49 +0000)
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 <john.hammond@intel.com>
Change-Id: I18e9594b9a2461afbc66128f477d3185a6627bc0
Reviewed-on: https://review.whamcloud.com/30477
Reviewed-by: Quentin Bouget <quentin.bouget@cea.fr>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ldlm/ldlm_request.c
lustre/tests/sanity.sh

index b901a46..c4b9e6f 100644 (file)
@@ -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);
        }
 
index 78db3fd..b1b61eb 100755 (executable)
@@ -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) ] ||