+test_246() { # LU-7371
+ [ $(lustre_version_code ost1) -lt $(version_code 2.7.62) ] &&
+ skip "Need OST version >= 2.7.62" && return 0
+ do_facet ost1 $LCTL set_param fail_val=4095
+#define OBD_FAIL_OST_READ_SIZE 0x234
+ do_facet ost1 $LCTL set_param fail_loc=0x234
+ $LFS setstripe $DIR/$tfile -i 0 -c 1
+ dd if=/dev/zero of=$DIR/$tfile bs=4095 count=1 > /dev/null 2>&1
+ cancel_lru_locks $FSNAME-OST0000
+ dd if=$DIR/$tfile of=/dev/null bs=1048576 || error "Read failed"
+}
+run_test 246 "Read file of size 4095 should return right length"
+
+test_247a() {
+ lctl get_param -n mdc.$FSNAME-MDT0000*.import |
+ grep -q subtree ||
+ { skip "Fileset feature is not supported"; return; }
+
+ local submount=${MOUNT}_$tdir
+
+ mkdir $MOUNT/$tdir
+ mkdir -p $submount || error "mkdir $submount failed"
+ FILESET="$FILESET/$tdir" mount_client $submount ||
+ error "mount $submount failed"
+ echo foo > $submount/$tfile || error "write $submount/$tfile failed"
+ [ $(cat $MOUNT/$tdir/$tfile) = "foo" ] ||
+ error "read $MOUNT/$tdir/$tfile failed"
+ umount_client $submount || error "umount $submount failed"
+ rmdir $submount
+}
+run_test 247a "mount subdir as fileset"
+
+test_247b() {
+ lctl get_param -n mdc.$FSNAME-MDT0000*.import | grep -q subtree ||
+ { skip "Fileset feature is not supported"; return; }
+
+ local submount=${MOUNT}_$tdir
+
+ rm -rf $MOUNT/$tdir
+ mkdir -p $submount || error "mkdir $submount failed"
+ SKIP_FILESET=1
+ FILESET="$FILESET/$tdir" mount_client $submount &&
+ error "mount $submount should fail"
+ rmdir $submount
+}
+run_test 247b "mount subdir that dose not exist"
+
+test_247c() {
+ lctl get_param -n mdc.$FSNAME-MDT0000*.import | grep -q subtree ||
+ { skip "Fileset feature is not supported"; return; }
+
+ local submount=${MOUNT}_$tdir
+
+ mkdir -p $MOUNT/$tdir/dir1
+ mkdir -p $submount || error "mkdir $submount failed"
+ FILESET="$FILESET/$tdir" mount_client $submount ||
+ error "mount $submount failed"
+ local fid=$($LFS path2fid $MOUNT/)
+ $LFS fid2path $submount $fid && error "fid2path should fail"
+ umount_client $submount || error "umount $submount failed"
+ rmdir $submount
+}
+run_test 247c "running fid2path outside root"
+
+test_247d() {
+ lctl get_param -n mdc.$FSNAME-MDT0000*.import | grep -q subtree ||
+ { skip "Fileset feature is not supported"; return; }
+
+ local submount=${MOUNT}_$tdir
+
+ mkdir -p $MOUNT/$tdir/dir1
+ mkdir -p $submount || error "mkdir $submount failed"
+ FILESET="$FILESET/$tdir" mount_client $submount ||
+ error "mount $submount failed"
+ local fid=$($LFS path2fid $submount/dir1)
+ $LFS fid2path $submount $fid || error "fid2path should succeed"
+ umount_client $submount || error "umount $submount failed"
+ rmdir $submount
+}
+run_test 247d "running fid2path inside root"
+
+# LU-8037
+test_247e() {
+ lctl get_param -n mdc.$FSNAME-MDT0000*.import |
+ grep -q subtree ||
+ { skip "Fileset feature is not supported"; return; }
+
+ local submount=${MOUNT}_$tdir
+
+ mkdir $MOUNT/$tdir
+ mkdir -p $submount || error "mkdir $submount failed"
+ FILESET="$FILESET/.." mount_client $submount &&
+ error "mount $submount should fail"
+ rmdir $submount
+}
+run_test 247e "mount .. as fileset"
+
+test_248() {
+ local my_error=error
+
+ # This test case is time sensitive and maloo uses kvm to run auto test.
+ # Therefore the complete time of I/O task is unreliable and depends on
+ # the work load on the host machine when the task is running.
+ which virt-what 2> /dev/null && [ "$(virt-what)" != "kvm" ] ||
+ { echo "no virt-what installed or running in kvm; ignore error";
+ my_error="error_ignore env=kvm"; }
+
+ # create a large file for fast read verification
+ dd if=/dev/zero of=$DIR/$tfile bs=128M count=1 > /dev/null 2>&1
+
+ # make sure the file is created correctly
+ $CHECKSTAT -s $((128*1024*1024)) $DIR/$tfile ||
+ { rm -f $DIR/$tfile; skip "file creation error" && return; }
+
+ local saved_fast_read=$($LCTL get_param -n llite.*.fast_read)
+
+ echo "Test 1: verify that fast read is 4 times faster on cache read"
+
+ # small read with fast read enabled
+ $LCTL set_param -n llite.*.fast_read=1
+ local t_fast=$(eval time -p dd if=$DIR/$tfile of=/dev/null bs=4k 2>&1 |
+ awk '/real/ { print $2 }')
+
+ # small read with fast read disabled
+ $LCTL set_param -n llite.*.fast_read=0
+ local t_slow=$(eval time -p dd if=$DIR/$tfile of=/dev/null bs=4k 2>&1 |
+ awk '/real/ { print $2 }')
+
+ # verify that fast read is 4 times faster for cache read
+ [ $(bc <<< "4 * $t_fast < $t_slow") -eq 1 ] ||
+ $my_error "fast read was not 4 times faster: $t_fast vs $t_slow"
+
+ echo "Test 2: verify the performance between big and small read"
+ $LCTL set_param -n llite.*.fast_read=1
+
+ # 1k non-cache read
+ cancel_lru_locks osc
+ local t_1k=$(eval time -p dd if=$DIR/$tfile of=/dev/null bs=1k 2>&1 |
+ awk '/real/ { print $2 }')
+
+ # 1M non-cache read
+ cancel_lru_locks osc
+ local t_1m=$(eval time -p dd if=$DIR/$tfile of=/dev/null bs=1M 2>&1 |
+ awk '/real/ { print $2 }')
+
+ # verify that big IO is not 4 times faster than small IO
+ [ $(bc <<< "4 * $t_1k >= $t_1m") -eq 1 ] ||
+ $my_error "bigger IO is way too fast: $t_1k vs $t_1m"
+
+ $LCTL set_param -n llite.*.fast_read=$saved_fast_read
+ rm -f $DIR/$tfile
+}
+run_test 248 "fast read verification"
+
+test_249() { # LU-7890
+ rm -f $DIR/$tfile
+ $SETSTRIPE -c 1 $DIR/$tfile
+
+ [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.8.53) ] &&
+ skip "Need at least version 2.8.54"
+
+ # Offset 2T == 4k * 512M
+ dd if=/dev/zero of=$DIR/$tfile bs=4k count=1 seek=512M ||
+ error "dd to 2T offset failed"
+}
+run_test 249 "Write above 2T file size"
+