+test_403() {
+ local file1=$DIR/$tfile.1
+ local file2=$DIR/$tfile.2
+ local tfile=$TMP/$tfile
+
+ rm -f $file1 $file2 $tfile
+
+ touch $file1
+ ln $file1 $file2
+
+ # 30 sec OBD_TIMEOUT in ll_getattr()
+ # right before populating st_nlink
+ $LCTL set_param fail_loc=0x80001409
+ stat -c %h $file1 > $tfile &
+
+ # create an alias, drop all locks and reclaim the dentry
+ < $file2
+ cancel_lru_locks mdc
+ cancel_lru_locks osc
+ sysctl -w vm.drop_caches=2
+
+ wait
+
+ [ `cat $tfile` -gt 0 ] || error "wrong nlink count: `cat $tfile`"
+
+ rm -f $tfile $file1 $file2
+}
+run_test 403 "i_nlink should not drop to zero due to aliasing"
+
+test_404() { # LU-6601
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ local mosps=$(do_facet $SINGLEMDS $LCTL dl |
+ awk '/osp .*-osc-MDT/ { print $4}')
+
+ local osp
+ for osp in $mosps; do
+ echo "Deactivate: " $osp
+ do_facet $SINGLEMDS $LCTL --device %$osp deactivate
+ local stat=$(do_facet $SINGLEMDS $LCTL dl |
+ awk -vp=$osp '$4 == p { print $2 }')
+ [ $stat = IN ] || {
+ do_facet $SINGLEMDS $LCTL dl | grep -w $osp
+ error "deactivate error"
+ }
+ echo "Activate: " $osp
+ do_facet $SINGLEMDS $LCTL --device %$osp activate
+ local stat=$(do_facet $SINGLEMDS $LCTL dl |
+ awk -vp=$osp '$4 == p { print $2 }')
+ [ $stat = UP ] || {
+ do_facet $SINGLEMDS $LCTL dl | grep -w $osp
+ error "activate error"
+ }
+ done
+}
+run_test 404 "validate manual {de}activated works properly for OSPs"
+
+test_405() {
+ [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.6.92) ] &&
+ skip "Layout swap lock is not supported" && return
+
+ check_swap_layouts_support && return 0
+
+ test_mkdir -p $DIR/$tdir
+ swap_lock_test -d $DIR/$tdir ||
+ error "One layout swap locked test failed"
+}
+run_test 405 "Various layout swap lock tests"
+
+test_406() {
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
+ [ -n "$FILESET" ] && skip "SKIP due to FILESET set" && return
+ [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.8.50) ] &&
+ skip "Need MDS version at least 2.8.50" && return
+
+ local def_stripenr=$($GETSTRIPE -c $MOUNT)
+ local def_stripe_size=$($GETSTRIPE -S $MOUNT)
+ local def_stripe_offset=$($GETSTRIPE -i $MOUNT)
+ local def_pool=$($GETSTRIPE -p $MOUNT)
+
+ local test_pool=$TESTNAME
+ pool_add $test_pool || error "pool_add failed"
+ pool_add_targets $test_pool 0 $(($OSTCOUNT - 1)) 1 ||
+ error "pool_add_targets failed"
+
+ # parent set default stripe count only, child will stripe from both
+ # parent and fs default
+ $SETSTRIPE -c 1 -i 1 -S $((def_stripe_size * 2)) -p $test_pool $MOUNT ||
+ error "setstripe $MOUNT failed"
+ $LFS mkdir -c $MDSCOUNT $DIR/$tdir || error "mkdir $tdir failed"
+ $SETSTRIPE -c $OSTCOUNT $DIR/$tdir || error "setstripe $tdir failed"
+ for i in $(seq 10); do
+ local f=$DIR/$tdir/$tfile.$i
+ touch $f || error "touch failed"
+ local count=$($GETSTRIPE -c $f)
+ [ $count -eq $OSTCOUNT ] ||
+ error "$f stripe count $count != $OSTCOUNT"
+ local offset=$($GETSTRIPE -i $f)
+ [ $offset -eq 1 ] || error "$f stripe offset $offset != 1"
+ local size=$($GETSTRIPE -S $f)
+ [ $size -eq $((def_stripe_size * 2)) ] ||
+ error "$f stripe size $size != $((def_stripe_size * 2))"
+ local pool=$($GETSTRIPE -p $f)
+ [ $pool == $test_pool ] || error "$f pool $pool != $test_pool"
+ done
+
+ # change fs default striping, delete parent default striping, now child
+ # will stripe from new fs default striping only
+ $SETSTRIPE -c 1 -S $def_stripe_size -i 0 $MOUNT ||
+ error "change $MOUNT default stripe failed"
+ $SETSTRIPE -c 0 $DIR/$tdir || error "delete $tdir default stripe failed"
+ for i in $(seq 11 20); do
+ local f=$DIR/$tdir/$tfile.$i
+ touch $f || error "touch $f failed"
+ local count=$($GETSTRIPE -c $f)
+ [ $count -eq 1 ] || error "$f stripe count $count != 1"
+ local offset=$($GETSTRIPE -i $f)
+ [ $offset -eq 0 ] || error "$f stripe offset $offset != 0"
+ local size=$($GETSTRIPE -S $f)
+ [ $size -eq $def_stripe_size ] ||
+ error "$f stripe size $size != $def_stripe_size"
+ local pool=$($GETSTRIPE -p $f)
+ [ "#$pool" == "#" ] || error "$f pool $pool is set"
+
+ done
+
+ unlinkmany $DIR/$tdir/$tfile. 1 20
+
+ # restore FS default striping
+ if [ -z $def_pool ]; then
+ $SETSTRIPE -c $def_stripenr -S $def_stripe_size \
+ -i $def_stripe_offset $MOUNT ||
+ error "restore default striping failed"
+ else
+ $SETSTRIPE -c $def_stripenr -S $def_stripe_size -p $def_pool \
+ -i $def_stripe_offset $MOUNT ||
+ error "restore default striping with $def_pool failed"
+ fi
+
+ local f=$DIR/$tdir/$tfile
+ pool_remove_all_targets $test_pool $f
+ pool_remove $test_pool $f
+}
+run_test 406 "DNE support fs default striping"
+
+test_407() {
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+
+ [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.8.55) ]] &&
+ skip "Need MDS version at least 2.8.55" && return
+
+ $LFS mkdir -i 0 -c 1 $DIR/$tdir.0 ||
+ error "$LFS mkdir -i 0 -c 1 $tdir.0 failed"
+ $LFS mkdir -i 1 -c 1 $DIR/$tdir.1 ||
+ error "$LFS mkdir -i 1 -c 1 $tdir.1 failed"
+ touch $DIR/$tdir.0/$tfile.0 || error "touch $tdir.0/$tfile.0 failed"
+
+ #define OBD_FAIL_DT_TXN_STOP 0x2019
+ for idx in $(seq $MDSCOUNT); do
+ do_facet mds$idx "lctl set_param fail_loc=0x2019"
+ done
+ $LFS mkdir -c 2 $DIR/$tdir && error "$LFS mkdir -c 2 $tdir should fail"
+ mv $DIR/$tdir.0/$tfile.0 $DIR/$tdir.1/$tfile.1 &&
+ error "mv $tdir.0/$tfile.0 $tdir.1/$tfile.1 should fail"
+ true
+}
+run_test 407 "transaction fail should cause operation fail"
+