+test_240() {
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+
+ mkdir -p $DIR/$tdir
+
+ $LFS mkdir -i 0 $DIR/$tdir/d0 ||
+ error "failed to mkdir $DIR/$tdir/d0 on MDT0"
+ $LFS mkdir -i 1 $DIR/$tdir/d0/d1 ||
+ error "failed to mkdir $DIR/$tdir/d0/d1 on MDT1"
+
+ umount_client $MOUNT || error "umount failed"
+ #define OBD_FAIL_TGT_DELAY_CONDITIONAL 0x713
+ do_facet mds2 lctl set_param fail_loc=0x713 fail_val=1
+ mount_client $MOUNT || error "failed to mount client"
+
+ echo "stat $DIR/$tdir/d0/d1, should not fail/ASSERT"
+ stat $DIR/$tdir/d0/d1 || error "fail to stat $DIR/$tdir/d0/d1"
+}
+run_test 240 "race between ldlm enqueue and the connection RPC (no ASSERT)"
+
+test_241_bio() {
+ for LOOP in $(seq $1); do
+ dd if=$DIR/$tfile of=/dev/null bs=40960 count=1 2>/dev/null
+ cancel_lru_locks osc
+ done
+}
+
+test_241_dio() {
+ for LOOP in $(seq $1); do
+ dd if=$DIR/$tfile of=/dev/null bs=40960 count=1 \
+ iflag=direct 2>/dev/null
+ done
+}
+
+test_241() {
+ dd if=/dev/zero of=$DIR/$tfile count=1 bs=40960
+ ls -la $DIR/$tfile
+ cancel_lru_locks osc
+ test_241_bio 1000 &
+ PID=$!
+ test_241_dio 1000
+ wait $PID
+}
+run_test 241 "bio vs dio"
+
+test_241b() {
+ dd if=/dev/zero of=$DIR/$tfile count=1 bs=40960
+ ls -la $DIR/$tfile
+ test_241_dio 1000 &
+ PID=$!
+ test_241_dio 1000
+ wait $PID
+}
+run_test 241b "dio vs dio"
+
+test_242() {
+ mkdir -p $DIR/$tdir
+ touch $DIR/$tdir/$tfile
+
+ #define OBD_FAIL_MDS_READPAGE_PACK 0x105
+ do_facet mds1 lctl set_param fail_loc=0x105
+ /bin/ls $DIR/$tdir && error "ls $DIR/$tdir should fail"
+
+ do_facet mds1 lctl set_param fail_loc=0
+ /bin/ls $DIR/$tdir || error "ls $DIR/$tdir failed"
+}
+run_test 242 "mdt_readpage failure should not cause directory unreadable"
+
+test_243()
+{
+ test_mkdir -p $DIR/$tdir
+ group_lock_test -d $DIR/$tdir || error "A group lock test failed"
+}
+run_test 243 "various group lock tests"
+
+test_244()
+{
+ test_mkdir -p $DIR/$tdir
+ dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=35
+ sendfile_grouplock $DIR/$tdir/$tfile || \
+ error "sendfile+grouplock failed"
+ rm -rf $DIR/$tdir
+}
+run_test 244 "sendfile with group lock tests"
+
+test_245() {
+ local flagname="multi_mod_rpcs"
+ local connect_data_name="max_mod_rpcs"
+ local out
+
+ # check if multiple modify RPCs flag is set
+ out=$($LCTL get_param mdc.$FSNAME-MDT0000-*.import |
+ grep "connect_flags:")
+ echo "$out"
+
+ echo "$out" | grep -qw $flagname
+ if [ $? -ne 0 ]; then
+ echo "connect flag $flagname is not set"
+ return
+ fi
+
+ # check if multiple modify RPCs data is set
+ out=$($LCTL get_param mdc.$FSNAME-MDT0000-*.import)
+ echo "$out"
+
+ echo "$out" | grep -qw $connect_data_name ||
+ error "import should have connect data $connect_data_name"
+}
+run_test 245 "check mdc connection flag/data: multiple modify RPCs"
+
+test_250() {
+ [ "$(facet_fstype ost$(($($GETSTRIPE -i $DIR/$tfile) + 1)))" = "zfs" ] \
+ && skip "no 16TB file size limit on ZFS" && return
+
+ $SETSTRIPE -c 1 $DIR/$tfile
+ # ldiskfs extent file size limit is (16TB - 4KB - 1) bytes
+ local size=$((16 * 1024 * 1024 * 1024 * 1024 - 4096 - 1))
+ $TRUNCATE $DIR/$tfile $size || error "truncate $tfile to $size failed"
+ dd if=/dev/zero of=$DIR/$tfile bs=10 count=1 oflag=append \
+ conv=notrunc,fsync && error "append succeeded"
+ return 0
+}
+run_test 250 "Write above 16T limit"
+
+test_251() {
+ $SETSTRIPE -c -1 -S 1048576 $DIR/$tfile
+
+ #define OBD_FAIL_LLITE_LOST_LAYOUT 0x1407
+ #Skip once - writing the first stripe will succeed
+ $LCTL set_param fail_loc=0xa0001407 fail_val=1
+ $MULTIOP $DIR/$tfile o:O_RDWR:w2097152c 2>&1 | grep -q "short write" &&
+ error "short write happened"
+
+ $LCTL set_param fail_loc=0xa0001407 fail_val=1
+ $MULTIOP $DIR/$tfile or2097152c 2>&1 | grep -q "short read" &&
+ error "short read happened"
+
+ rm -f $DIR/$tfile
+}
+run_test 251 "Handling short read and write correctly"
+
+test_252() {
+ local tgt
+ local dev
+ local out
+ local uuid
+ local num
+ local gen
+
+ if [ "$(facet_fstype ost1)" != "ldiskfs" -o \
+ "$(facet_fstype mds1)" != "ldiskfs" ]; then
+ skip "can only run lr_reader on ldiskfs target"
+ return
+ fi
+
+ # check lr_reader on OST0000
+ tgt=ost1
+ dev=$(facet_device $tgt)
+ out=$(do_facet $tgt $LR_READER $dev)
+ [ $? -eq 0 ] || error "$LR_READER failed on target $tgt device $dev"
+ echo "$out"
+ uuid=$(echo "$out" | grep -i uuid | awk '{ print $2 }')
+ [ "$uuid" == "$(ostuuid_from_index 0)" ] ||
+ error "Invalid uuid returned by $LR_READER on target $tgt"
+ echo -e "uuid returned by $LR_READER is '$uuid'\n"
+
+ # check lr_reader -c on MDT0000
+ tgt=mds1
+ dev=$(facet_device $tgt)
+ if ! do_facet $tgt $LR_READER -h | grep -q OPTIONS; then
+ echo "$LR_READER does not support additional options"
+ return 0
+ fi
+ out=$(do_facet $tgt $LR_READER -c $dev)
+ [ $? -eq 0 ] || error "$LR_READER failed on target $tgt device $dev"
+ echo "$out"
+ num=$(echo "$out" | grep -c "mdtlov")
+ [ "$num" -eq $((MDSCOUNT - 1)) ] ||
+ error "Invalid number of mdtlov clients returned by $LR_READER"
+ echo -e "Number of mdtlov clients returned by $LR_READER is '$num'\n"
+
+ # check lr_reader -cr on MDT0000
+ out=$(do_facet $tgt $LR_READER -cr $dev)
+ [ $? -eq 0 ] || error "$LR_READER failed on target $tgt device $dev"
+ echo "$out"
+ echo "$out" | grep -q "^reply_data:$" ||
+ error "$LR_READER should have returned 'reply_data' section"
+ num=$(echo "$out" | grep -c "client_generation")
+ echo -e "Number of reply data returned by $LR_READER is '$num'\n"
+}
+run_test 252 "check lr_reader tool"
+
+