Whamcloud - gitweb
LU-2871 lod: stripe data across the OSTs correctly
[fs/lustre-release.git] / lustre / tests / sanity.sh
index fe49708..fb22df9 100644 (file)
@@ -9,7 +9,7 @@ set -e
 
 ONLY=${ONLY:-"$*"}
 # bug number for skipped test: 13297 2108 9789 3637 9789 3561 12622 5188
-ALWAYS_EXCEPT="                27u   42a  42b  42c  42d  45   51d   68b   $SANITY_EXCEPT"
+ALWAYS_EXCEPT="                42a  42b  42c  42d  45   51d   68b   $SANITY_EXCEPT"
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 # with LOD/OSP landing
@@ -17,11 +17,6 @@ ALWAYS_EXCEPT="                27u   42a  42b  42c  42d  45   51d   68b   $SANIT
 ALWAYS_EXCEPT="                 76     $ALWAYS_EXCEPT"
 
 
-# Tests that fail on uml
-CPU=`awk '/model/ {print $4}' /proc/cpuinfo`
-#                                    buffer i/o errs             sock spc runas
-[ "$CPU" = "UML" ] && EXCEPT="$EXCEPT 27m 27n 27o 27p 27q 27r 31d 54a  64b 99a 99b 99c 99d 99e 99f 101a"
-
 SRCDIR=$(cd $(dirname $0); echo $PWD)
 export PATH=$PATH:/sbin
 
@@ -63,7 +58,11 @@ init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/${NAME}.sh}
 init_logging
 
-[ "$SLOW" = "no" ] && EXCEPT_SLOW="24o 24v 27m 36f 36g 36h 51b 60c 63 64b 68 71 73 77f 78 101a 103 115 120g 124b"
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="24o 24v 27m 36f 36g 36h 51b 60c 63 64b 68 71 73 77f 78 101a 115 120g 124b"
+
+[ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
+# bug number for skipped test:        LU-2834 LU-1593 LU-2610 LU-2833 LU-1957 LU-2805
+       ALWAYS_EXCEPT="$ALWAYS_EXCEPT 18      34h     40      48a     180     184c"
 
 FAIL_ON_ERROR=false
 
@@ -1485,6 +1484,7 @@ test_27u() { # bug 4900
 #define OBD_FAIL_MDS_OSC_PRECREATE      0x139
         do_facet $SINGLEMDS lctl set_param fail_loc=0x139
         test_mkdir -p $DIR/$tdir
+       rm -rf $DIR/$tdir/*
         createmany -o $DIR/$tdir/t- 1000
         do_facet $SINGLEMDS lctl set_param fail_loc=0
 
@@ -1639,6 +1639,19 @@ test_27y() {
                        do_facet $SINGLEMDS lctl --device %$OSC activate
                fi
        done
+
+       # all osp devices get activated, hence -1 stripe count restored
+       local stripecnt=0
+
+       # sleep 2*lod_qos_maxage seconds waiting for lod qos to notice osp
+       # devices get activated.
+       sleep_maxage
+       $SETSTRIPE -c -1 $DIR/$tfile
+       stripecnt=$($GETSTRIPE -c $DIR/$tfile)
+       rm -f $DIR/$tfile
+       [ $stripecnt -ne $OSTCOUNT ] &&
+               error "Of $OSTCOUNT OSTs, only $stripecnt is available"
+       return 0
 }
 run_test 27y "create files while OST0 is degraded and the rest inactive"
 
@@ -1769,6 +1782,55 @@ test_27A() { # b=19102
 }
 run_test 27A "check filesystem-wide default LOV EA values"
 
+test_27B() { # LU-2523
+       test_mkdir -p $DIR/$tdir
+       rm -f $DIR/$tdir/f0 $DIR/$tdir/f1
+       touch $DIR/$tdir/f0
+       # open f1 with O_LOV_DELAY_CREATE
+       # rename f0 onto f1
+       # call setstripe ioctl on open file descriptor for f1
+       # close
+       multiop $DIR/$tdir/f1 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:nB1c \
+               $DIR/$tdir/f0
+
+       rm -f $DIR/$tdir/f1
+       # open f1 with O_LOV_DELAY_CREATE
+       # unlink f1
+       # call setstripe ioctl on open file descriptor for f1
+       # close
+       multiop $DIR/$tdir/f1 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:uB1c
+
+       # Allow multiop to fail in imitation of NFS's busted semantics.
+       true
+}
+run_test 27B "call setstripe on open unlinked file/rename victim"
+
+test_27C() { #LU-2871
+       [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
+
+       declare -a ost_idx
+       local index
+       local i
+       local j
+
+       test_mkdir -p $DIR/$tdir
+       cd $DIR/$tdir
+       for i in $(seq 0 $((OSTCOUNT - 1))); do
+               # set stripe across all OSTs starting from OST$i
+               $SETSTRIPE -i $i -c -1 $tfile$i
+               # get striping information
+               ost_idx=($($GETSTRIPE $tfile$i |
+                        tail -n $((OSTCOUNT + 1)) | awk '{print $1}'))
+               echo ${ost_idx[@]}
+               # check the layout
+               for j in $(seq 0 $((OSTCOUNT - 1))); do
+                       index=$(((i + j) % OSTCOUNT))
+                       [ ${ost_idx[$j]} -eq $index ] || error
+               done
+       done
+}
+run_test 27C "check full striping across all OSTs"
+
 # createtest also checks that device nodes are created and
 # then visible correctly (#2091)
 test_28() { # bug 2091
@@ -2002,6 +2064,22 @@ test_31m() {
 }
 run_test 31m "link to file: the same, non-existing, dir==============="
 
+test_31n() {
+       [ -e /proc/self/fd/173 ] && echo "skipping, fd 173 is in use" && return
+       touch $DIR/$tfile || error "cannot create '$DIR/$tfile'"
+       nlink=$(stat --format=%h $DIR/$tfile)
+       [ ${nlink:--1} -eq 1 ] || error "nlink is $nlink, expected 1"
+       exec 173<$DIR/$tfile
+       trap "exec 173<&-" EXIT
+       nlink=$(stat --dereference --format=%h /proc/self/fd/173)
+       [ ${nlink:--1} -eq 1 ] || error "nlink is $nlink, expected 1"
+       rm $DIR/$tfile || error "cannot remove '$DIR/$tfile'"
+       nlink=$(stat --dereference --format=%h /proc/self/fd/173)
+       [ ${nlink:--1} -eq 0 ] || error "nlink is $nlink, expected 0"
+       exec 173<&-
+}
+run_test 31n "check link count of unlinked file"
+
 cleanup_test32_mount() {
        trap 0
        $UMOUNT $DIR/$tdir/ext2-mountpoint
@@ -2446,6 +2524,8 @@ test_34h() {
        local sz=1000
 
        dd if=/dev/zero of=$DIR/$tfile bs=1M count=10 || error
+       sync # Flush the cache so that multiop below does not block on cache
+            # flush when getting the group lock
        $MULTIOP $DIR/$tfile OG${gid}T${sz}g${gid}c &
        MULTIPID=$!
        sleep 2
@@ -5513,7 +5593,6 @@ test_101a() {
        local s
        local discard
        local nreads=10000
-       [ "$CPU" = "UML" ] && nreads=1000
        local cache_limit=32
 
        $LCTL set_param -n osc.*-osc*.rpc_stats 0
@@ -6148,8 +6227,12 @@ test_103 () {
     run_acl_subtest inheritance || error "inheritance test failed"
     rm -f make-tree
 
-    echo "LU-974 ignore umask when acl is enabled..."
-    run_acl_subtest 974 || error "LU-974 test failed"
+       echo "LU-974 ignore umask when acl is enabled..."
+       run_acl_subtest 974 || error "LU-974 test failed"
+       if [ $MDSCOUNT -ge 2 ]; then
+               run_acl_subtest 974_remote ||
+                       error "LU-974 test failed under remote dir"
+       fi
 
     echo "LU-2561 newly created file is same size as directory..."
     run_acl_subtest 2561 || error "LU-2561 test failed"
@@ -6471,6 +6554,7 @@ test_117() # bug 10891
 }
 run_test 117 "verify fsfilt_extend =========="
 
+NO_SLOW_RESENDCOUNT=4
 export OLD_RESENDCOUNT=""
 set_resend_count () {
        local PROC_RESENDCOUNT="osc.${FSNAME}-OST*-osc-*.resend_count"
@@ -6479,7 +6563,8 @@ set_resend_count () {
        echo resend_count is set to $(lctl get_param -n $PROC_RESENDCOUNT)
 }
 
-[ "$SLOW" = "no" ] && set_resend_count 4 # for reduce test_118* time (bug 14842)
+# for reduce test_118* time (b=14842)
+[ "$SLOW" = "no" ] && set_resend_count $NO_SLOW_RESENDCOUNT
 
 # Reset async IO behavior after error case
 reset_async() {
@@ -6549,6 +6634,10 @@ run_test 118b "Reclaim dirty pages on fatal error =========="
 test_118c()
 {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+
+       # for 118c, restore the original resend count, LU-1940
+       [ "$SLOW" = "no" ] && [ -n "$OLD_RESENDCOUNT" ] &&
+                               set_resend_count $OLD_RESENDCOUNT
        remote_ost_nodsh && skip "remote OST with nodsh" && return
 
        reset_async
@@ -6591,6 +6680,9 @@ test_118c()
 }
 run_test 118c "Fsync blocks on EROFS until dirty pages are flushed =========="
 
+# continue to use small resend count to reduce test_118* time (b=14842)
+[ "$SLOW" = "no" ] && set_resend_count $NO_SLOW_RESENDCOUNT
+
 test_118d()
 {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
@@ -7886,7 +7978,7 @@ get_ost_param() {
                 [ x$gl = x"" ] && gl=0
                 gl_sum=$((gl_sum + gl))
         done
-        echo $gl
+        echo $gl_sum
 }
 
 som_mode_switch() {
@@ -8249,6 +8341,36 @@ test_133e() {
 }
 run_test 133e "Verifying OST {read,write}_bytes nid stats ================="
 
+test_133f() {
+       local proc_dirs="/proc/fs/lustre/ /proc/sys/lnet/ /proc/sys/lustre/"
+       local facet
+
+       # First without trusting modes.
+       find $proc_dirs \
+               -exec cat '{}' \; &> /dev/null
+
+       # Second verifying readability.
+       find $proc_dirs \
+               -type f \
+               -readable \
+               -exec cat '{}' \; > /dev/null ||
+                       error "proc file read failed"
+
+       for facet in $SINGLEMDS ost1; do
+               do_facet $facet find $proc_dirs \
+                       -not -name req_history \
+                       -exec cat '{}' \\\; &> /dev/null
+
+           do_facet $facet     find $proc_dirs \
+                       -not -name req_history \
+                       -type f \
+                       -readable \
+                       -exec cat '{}' \\\; > /dev/null ||
+                               error "proc file read failed"
+       done
+}
+run_test 133f "Check for LBUGs/Oopses/unreadable files in /proc"
+
 test_140() { #bug-17379
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
         test_mkdir -p $DIR/$tdir || error "Creating dir $DIR/$tdir"
@@ -8360,15 +8482,29 @@ test_151() {
 
        set_osd_param $list '' writethrough_cache_enable 1
 
-        # pages should be in the case right after write
-        dd if=/dev/urandom of=$DIR/$tfile bs=4k count=$CPAGES || error "dd failed"
-        local BEFORE=`roc_hit`
-        cancel_lru_locks osc
-        cat $DIR/$tfile >/dev/null
-        local AFTER=`roc_hit`
-        if ! let "AFTER - BEFORE == CPAGES"; then
-                error "NOT IN CACHE: before: $BEFORE, after: $AFTER"
-        fi
+       # check write cache is enabled on all obdfilters
+       if get_osd_param $list '' writethrough_cache_enable | grep 0; then
+               echo "oss write cache is NOT enabled"
+               return 0
+       fi
+
+#define OBD_FAIL_OBD_NO_LRU  0x609
+       do_nodes $list $LCTL set_param fail_loc=0x609
+
+       # pages should be in the case right after write
+       dd if=/dev/urandom of=$DIR/$tfile bs=4k count=$CPAGES ||
+               error "dd failed"
+
+       local BEFORE=`roc_hit`
+       cancel_lru_locks osc
+       cat $DIR/$tfile >/dev/null
+       local AFTER=`roc_hit`
+
+       do_nodes $list $LCTL set_param fail_loc=0
+
+       if ! let "AFTER - BEFORE == CPAGES"; then
+               error "NOT IN CACHE: before: $BEFORE, after: $AFTER"
+       fi
 
         # the following read invalidates the cache
         cancel_lru_locks osc
@@ -8418,18 +8554,10 @@ test_153() {
 }
 run_test 153 "test if fdatasync does not crash ======================="
 
-test_154() {
-       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
-       [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ]] ||
-               { skip "Need MDS version at least 2.2.51"; return 0; }
-
-       cp /etc/hosts $DIR/$tfile
-
-       fid=$($LFS path2fid $DIR/$tfile)
-       rc=$?
-       [ $rc -ne 0 ] && error "error: could not get fid for $DIR/$tfile."
-
-       ffid=$DIR/.lustre/fid/$fid
+dot_lustre_fid_permission_check() {
+       local fid=$1
+       local ffid=$MOUNT/.lustre/fid/$fid
+       local test_dir=$2
 
        echo "stat fid $fid"
        stat $ffid > /dev/null || error "stat $ffid failed."
@@ -8442,14 +8570,16 @@ test_154() {
        echo "append write to fid $fid"
        cat /etc/hosts >> $ffid || error "append write $ffid failed."
        echo "rename fid $fid"
-       mv $ffid $DIR/$tfile.1 && error "rename $ffid to $tfile.1 should fail."
-       touch $DIR/$tfile.1
-       mv $DIR/$tfile.1 $ffid && error "rename $tfile.1 to $ffid should fail."
-       rm -f $DIR/$tfile.1
+       mv $ffid $test_dir/$tfile.1 &&
+               error "rename $ffid to $tfile.1 should fail."
+       touch $test_dir/$tfile.1
+       mv $test_dir/$tfile.1 $ffid &&
+               error "rename $tfile.1 to $ffid should fail."
+       rm -f $test_dir/$tfile.1
        echo "truncate fid $fid"
        $TRUNCATE $ffid 777 || error "truncate $ffid failed."
        echo "link fid $fid"
-       ln -f $ffid $DIR/tfile.lnk || error "link $ffid failed."
+       ln -f $ffid $test_dir/tfile.lnk || error "link $ffid failed."
        if [ -n $(lctl get_param -n mdc.*-mdc-*.connect_flags | grep acl) ]; then
                echo "setfacl fid $fid"
                setfacl -R -m u:bin:rwx $ffid || error "setfacl $ffid failed."
@@ -8457,80 +8587,136 @@ test_154() {
                getfacl $ffid >/dev/null || error "getfacl $ffid failed."
        fi
        echo "unlink fid $fid"
-       unlink $DIR/.lustre/fid/$fid && error "unlink $ffid should fail."
+       unlink $MOUNT/.lustre/fid/$fid && error "unlink $ffid should fail."
        echo "mknod fid $fid"
        mknod $ffid c 1 3 && error "mknod $ffid should fail."
 
        fid=[0xf00000400:0x1:0x0]
-       ffid=$DIR/.lustre/fid/$fid
+       ffid=$MOUNT/.lustre/fid/$fid
 
        echo "stat non-exist fid $fid"
        stat $ffid > /dev/null && error "stat non-exist $ffid should fail."
        echo "write to non-exist fid $fid"
        cat /etc/hosts > $ffid && error "write non-exist $ffid should fail."
        echo "link new fid $fid"
-       ln $DIR/$tfile $ffid && error "link $ffid should fail."
+       ln $test_dir/$tfile $ffid && error "link $ffid should fail."
 
-       test_mkdir -p $DIR/$tdir
-       touch $DIR/$tdir/$tfile
-       fid=$($LFS path2fid $DIR/$tdir)
+       mkdir -p $test_dir/$tdir
+       touch $test_dir/$tdir/$tfile
+       fid=$($LFS path2fid $test_dir/$tdir)
        rc=$?
-       [ $rc -ne 0 ] && error "error: could not get fid for $DIR/$tfile."
+       [ $rc -ne 0 ] &&
+               error "error: could not get fid for $test_dir/$dir/$tfile."
 
-       ffid=$DIR/.lustre/fid/$fid
+       ffid=$MOUNT/.lustre/fid/$fid
 
        echo "ls $fid"
        ls $ffid > /dev/null || error "ls $ffid failed."
        echo "touch $fid/$tfile.1"
        touch $ffid/$tfile.1 || error "touch $ffid/$tfile.1 failed."
 
-       echo "touch $DIR/.lustre/fid/$tfile"
-       touch $DIR/.lustre/fid/$tfile && \
-               error "touch $DIR/.lustre/fid/$tfile should fail."
+       echo "touch $MOUNT/.lustre/fid/$tfile"
+       touch $MOUNT/.lustre/fid/$tfile && \
+               error "touch $MOUNT/.lustre/fid/$tfile should fail."
 
-       echo "setxattr to $DIR/.lustre/fid"
-       setfattr -n trusted.name1 -v value1 $DIR/.lustre/fid &&
+       echo "setxattr to $MOUNT/.lustre/fid"
+       setfattr -n trusted.name1 -v value1 $MOUNT/.lustre/fid &&
                error "setxattr should fail."
 
-       echo "listxattr for $DIR/.lustre/fid"
-       getfattr -d -m "^trusted" $DIR/.lustre/fid &&
+       echo "listxattr for $MOUNT/.lustre/fid"
+       getfattr -d -m "^trusted" $MOUNT/.lustre/fid &&
                error "listxattr should fail."
 
-       echo "delxattr from $DIR/.lustre/fid"
-       setfattr -x trusted.name1 $DIR/.lustre/fid &&
+       echo "delxattr from $MOUNT/.lustre/fid"
+       setfattr -x trusted.name1 $MOUNT/.lustre/fid &&
                error "delxattr should fail."
 
-       echo "touch invalid fid: $DIR/.lustre/fid/[0x200000400:0x2:0x3]"
-       touch $DIR/.lustre/fid/[0x200000400:0x2:0x3] &&
+       echo "touch invalid fid: $MOUNT/.lustre/fid/[0x200000400:0x2:0x3]"
+       touch $MOUNT/.lustre/fid/[0x200000400:0x2:0x3] &&
                error "touch invalid fid should fail."
 
-       echo "touch non-normal fid: $DIR/.lustre/fid/[0x1:0x2:0x0]"
-       touch $DIR/.lustre/fid/[0x1:0x2:0x0] &&
+       echo "touch non-normal fid: $MOUNT/.lustre/fid/[0x1:0x2:0x0]"
+       touch $MOUNT/.lustre/fid/[0x1:0x2:0x0] &&
                error "touch non-normal fid should fail."
 
-       echo "rename $tdir to $DIR/.lustre/fid"
-       mrename $DIR/$tdir $DIR/.lustre/fid &&
-               error "rename to $DIR/.lustre/fid should fail."
+       echo "rename $tdir to $MOUNT/.lustre/fid"
+       mrename $test_dir/$tdir $MOUNT/.lustre/fid &&
+               error "rename to $MOUNT/.lustre/fid should fail."
 
        echo "rename .lustre to itself"
-       fid=$($LFS path2fid $DIR)
-       mrename $DIR/.lustre $DIR/.lustre/fid/$fid/.lustre &&
+       fid=$($LFS path2fid $MOUNT)
+       mrename $MOUNT/.lustre $MOUNT/.lustre/fid/$fid/.lustre &&
                error "rename .lustre to itself should fail."
 
-       $OPENFILE -f O_LOV_DELAY_CREATE:O_CREAT $DIR/$tfile-2
-       fid=$($LFS path2fid $DIR/$tfile-2)
-       echo "cp /etc/passwd $DIR/.lustre/fid/$fid"
-       cp /etc/passwd $DIR/.lustre/fid/$fid &&
+       $OPENFILE -f O_LOV_DELAY_CREATE:O_CREAT $test_dir/$tfile-2
+       fid=$($LFS path2fid $test_dir/$tfile-2)
+       echo "cp /etc/passwd $MOUNT/.lustre/fid/$fid"
+       cp /etc/passwd $MOUNT/.lustre/fid/$fid &&
                error "create lov data thru .lustre should fail."
-       echo "cp /etc/passwd $DIR/$tfile-2"
-       cp /etc/passwd $DIR/$tfile-2 || error "copy to $DIR/$tfile-2 failed."
-       echo "diff /etc/passwd $DIR/.lustre/fid/$fid"
-       diff /etc/passwd $DIR/.lustre/fid/$fid ||
-               error "diff /etc/passwd $DIR/.lustre/fid/$fid failed."
+       echo "cp /etc/passwd $test_dir/$tfile-2"
+       cp /etc/passwd $test_dir/$tfile-2 ||
+               error "copy to $test_dir/$tfile-2 failed."
+       echo "diff /etc/passwd $MOUNT/.lustre/fid/$fid"
+       diff /etc/passwd $MOUNT/.lustre/fid/$fid ||
+               error "diff /etc/passwd $MOUNT/.lustre/fid/$fid failed."
 
-       echo "Open-by-FID succeeded"
+       rm -rf $test_dir/tfile.lnk
+       rm -rf $test_dir/$tfile-2
 }
-run_test 154 "Open-by-FID"
+
+test_154a() {
+       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ]] ||
+               { skip "Need MDS version at least 2.2.51"; return 0; }
+
+       cp /etc/hosts $DIR/$tfile
+
+       fid=$($LFS path2fid $DIR/$tfile)
+       rc=$?
+       [ $rc -ne 0 ] && error "error: could not get fid for $DIR/$tfile."
+
+       dot_lustre_fid_permission_check "$fid" $DIR ||
+               error "dot lustre permission check $fid failed"
+
+       rm -rf $MOUNT/.lustre && error ".lustre is not allowed to be unlinked"
+       chmod 777 $MOUNT/.lustre && error ".lustre is not allowed to be chmod"
+
+       touch $MOUNT/.lustre/file &&
+               error "creation is not allowed under .lustre"
+
+       mkdir $MOUNT/.lustre/dir &&
+               error "mkdir is not allowed under .lustre"
+
+       rm -rf $DIR/$tfile
+}
+run_test 154a "Open-by-FID"
+
+test_154b() {
+       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ]] ||
+               { skip "Need MDS version at least 2.2.51"; return 0; }
+
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+
+       local remote_dir=$DIR/$tdir/remote_dir
+       local MDTIDX=1
+       local rc=0
+
+       mkdir -p $DIR/$tdir
+       $LFS mkdir -i $MDTIDX $remote_dir ||
+               error "create remote directory failed"
+
+       cp /etc/hosts $remote_dir/$tfile
+
+       fid=$($LFS path2fid $remote_dir/$tfile)
+       rc=$?
+       [ $rc -ne 0 ] && error "error: could not get fid for $remote_dir/$tfile"
+
+       dot_lustre_fid_permission_check "$fid" $remote_dir ||
+               error "dot lustre permission check $fid failed"
+       rm -rf $DIR/$tdir
+}
+run_test 154b "Open-by-FID for remote directory"
 
 test_155_small_load() {
     local temp=$TMP/$tfile
@@ -9371,23 +9557,27 @@ run_test 184b "Forbidden layout swap (will generate errors)"
 test_184c() {
        check_swap_layouts_support && return 0
 
-       dir0=$DIR/$tdir/$testnum
+       local dir0=$DIR/$tdir/$testnum
        mkdir -p $dir0 || error "creating dir $dir0"
-       ref1=$dir0/ref1
-       ref2=$dir0/ref2
-       file1=$dir0/file1
-       file2=$dir0/file2
+
+       local ref1=$dir0/ref1
+       local ref2=$dir0/ref2
+       local file1=$dir0/file1
+       local file2=$dir0/file2
        # create a file large enough for the concurent test
        dd if=/dev/urandom of=$ref1 bs=1M count=$((RANDOM % 50 + 20))
        dd if=/dev/urandom of=$ref2 bs=1M count=$((RANDOM % 50 + 20))
        echo "ref file size: ref1(`stat -c %s $ref1`), ref2(`stat -c %s $ref2`)"
 
        cp $ref2 $file2
-       dd if=$ref1 of=$file1 bs=64k &
-       sleep 0.$((RANDOM % 5 + 1))
+       dd if=$ref1 of=$file1 bs=16k &
+       local DD_PID=$!
+
+       # Make sure dd starts to copy file
+       while [ ! -f $file1 ]; do sleep 0.1; done
 
        $LFS swap_layouts $file1 $file2
-       rc=$?
+       local rc=$?
        wait $DD_PID
        [[ $? == 0 ]] || error "concurrent write on $file1 failed"
        [[ $rc == 0 ]] || error "swap of $file1 and $file2 failed"
@@ -9398,7 +9588,7 @@ test_184c() {
        remaining=$((remaining - copied))
        echo "Copied $copied bytes before swapping layout..."
 
-       cmp -n $copied $file1 $ref2 ||
+       cmp -n $copied $file1 $ref2 | grep differ &&
                error "Content mismatch [0, $copied) of ref2 and file1"
        cmp -n $copied $file2 $ref1 ||
                error "Content mismatch [0, $copied) of ref1 and file2"
@@ -10649,7 +10839,20 @@ test_230b() {
        [ $rc -ne 0 ] &&
           error "create remote directory failed after set enable_remote_dir"
 
-       rm -r $DIR/$tdir || error "unlink remote directory failed"
+       rm -rf $remote_dir || error "first unlink remote directory failed"
+
+       $RUNAS -G$RUNAS_GID $LFS mkdir -i $MDTIDX $DIR/$tfile &&
+                                                       error "chown worked"
+
+       do_facet mds$MDTIDX lctl set_param \
+                               mdt.*.enable_remote_dir_gid=$RUNAS_GID
+       $LFS mkdir -i $MDTIDX $remote_dir || rc=$?
+       do_facet mds$MDTIDX lctl set_param mdt.*.enable_remote_dir_gid=0
+
+       [ $rc -ne 0 ] &&
+          error "create remote dir failed after set enable_remote_dir_gid"
+
+       rm -r $DIR/$tdir || error "second unlink remote directory failed"
 }
 run_test 230b "nested remote directory should be failed"
 
@@ -10703,6 +10906,20 @@ test_231b() {
 }
 run_test 231b "must not assert on fully utilized OST request buffer"
 
+test_232() {
+       mkdir -p $DIR/$tdir
+       #define OBD_FAIL_LDLM_OST_LVB            0x31c
+       $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
+       umount_client $MOUNT || error "umount failed"
+       mount_client $MOUNT || error "mount failed"
+}
+run_test 232 "failed lock should not block umount"
+
 #
 # tests that do cleanup/setup should be run at the end
 #