3 # Run select tests by setting ONLY, or as arguments to the script.
4 # Skip specific tests by setting EXCEPT.
6 # e.g. ONLY="22 23" or ONLY="`seq 32 39`" or EXCEPT="31"
11 # Check Grants after these tests
12 GRANT_CHECK_LIST="$GRANT_CHECK_LIST 42a 42b 42c 42d 42e 63a 63b 64a 64b 64c 64d"
17 CREATETEST=${CREATETEST:-createtest}
18 LVERIFY=${LVERIFY:-ll_dirstripe_verify}
19 OPENFILE=${OPENFILE:-openfile}
20 OPENUNLINK=${OPENUNLINK:-openunlink}
21 READS=${READS:-"reads"}
22 MUNLINK=${MUNLINK:-munlink}
23 SOCKETSERVER=${SOCKETSERVER:-socketserver}
24 SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
25 MEMHOG=${MEMHOG:-memhog}
26 DIRECTIO=${DIRECTIO:-directio}
27 ACCEPTOR_PORT=${ACCEPTOR_PORT:-988}
29 CHECK_GRANT=${CHECK_GRANT:-"yes"}
30 GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
31 export PARALLEL=${PARALLEL:-"no"}
34 LUSTRE=${LUSTRE:-$(dirname $0)/..}
35 LUSTRE_TESTS_API_DIR=${LUSTRE_TESTS_API_DIR:-${LUSTRE}/tests/clientapi}
36 . $LUSTRE/tests/test-framework.sh
41 ALWAYS_EXCEPT="$SANITY_EXCEPT "
42 # bug number for skipped test: LU-9693 LU-6493 LU-9693
43 ALWAYS_EXCEPT+=" 42a 42b 42c "
44 # bug number: LU-8411 LU-9054
45 ALWAYS_EXCEPT+=" 407 312"
48 # bug number: LU-14181 LU-14181
49 ALWAYS_EXCEPT+=" 64e 64f"
52 selinux_status=$(getenforce)
53 if [ "$selinux_status" != "Disabled" ]; then
58 # skip the grant tests for ARM until they are fixed
59 if [[ $(uname -m) = aarch64 ]]; then
60 # bug number: LU-11596
61 ALWAYS_EXCEPT+=" $GRANT_CHECK_LIST"
62 # bug number: LU-11671
64 # bug number: LU-14067 LU-14067
65 ALWAYS_EXCEPT+=" 400a 400b"
68 # skip nfs tests on kernels >= 4.12.0 until they are fixed
69 if [ $LINUX_VERSION_CODE -ge $(version_code 4.12.0) ]; then
70 # bug number: LU-12661
73 # skip cgroup tests on RHEL8.1 kernels until they are fixed
74 if (( $LINUX_VERSION_CODE >= $(version_code 4.18.0) &&
75 $LINUX_VERSION_CODE < $(version_code 5.4.0) )); then
76 # bug number: LU-13063
81 [ "$SLOW" = "no" ] && EXCEPT_SLOW="27m 60i 64b 68 71 115 135 136 230d 300o"
83 if [ "$mds1_FSTYPE" = "zfs" ]; then
84 # bug number for skipped test:
87 [ "$SLOW" = "no" ] && EXCEPT_SLOW="$EXCEPT_SLOW 51b"
90 if [ "$ost1_FSTYPE" = "zfs" ]; then
91 # bug number for skipped test: LU-1941 LU-1941 LU-1941 LU-1941
92 ALWAYS_EXCEPT+=" 130a 130b 130c 130d 130e 130f 130g"
95 proc_regexp="/{proc,sys}/{fs,sys,kernel/debug}/{lustre,lnet}/"
97 # Get the SLES distro version
99 # Returns a version string that should only be used in comparing
100 # strings returned by version_code()
103 local version=$(grep VERSION_ID /etc/os-release | cut -d'"' -f2)
105 # All SuSE Linux versions have one decimal. version_code expects two
106 local sles_version=$version.0
107 version_code $sles_version
110 # Check if we are running on Ubuntu or SLES so we can make decisions on
112 if [ -r /etc/SuSE-release ]; then
113 sles_version=$(sles_version_code)
114 [ $sles_version -lt $(version_code 11.4.0) ] &&
115 # bug number for skipped test: LU-4341
116 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 170"
117 [ $sles_version -lt $(version_code 12.0.0) ] &&
118 # bug number for skipped test: LU-3703
119 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 234"
120 elif [ -r /etc/os-release ]; then
121 if grep -qi ubuntu /etc/os-release; then
122 ubuntu_version=$(version_code $(sed -n -e 's/"//g' \
123 -e 's/^VERSION=//p' \
127 if [[ $ubuntu_version -gt $(version_code 16.0.0) ]]; then
128 # bug number for skipped test:
130 ALWAYS_EXCEPT+=" 103a 410"
140 pgrep ll_sa > /dev/null && { echo "There are ll_sa thread not exit!"; exit 20; }
141 cleanupall ${FORCE} $* || { echo "FAILed to clean up"; exit 20; }
150 check_swap_layouts_support()
152 $LCTL get_param -n llite.*.sbi_flags | grep -q layout ||
153 skip "Does not support layout lock."
156 check_swap_layout_no_dom()
159 local SUPP=$(lfs getstripe $FOLDER | grep "pattern: mdt" | wc -l)
160 [ $SUPP -eq 0 ] || skip "layout swap does not support DOM files so far"
163 check_and_setup_lustre
167 MAXFREE=${MAXFREE:-$((300000 * $OSTCOUNT))}
169 [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
170 [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
171 rm -rf $DIR/[Rdfs][0-9]*
173 # $RUNAS_ID may get set incorrectly somewhere else
174 [ $UID -eq 0 -a $RUNAS_ID -eq 0 ] &&
175 error "\$RUNAS_ID set to 0, but \$UID is also 0!"
177 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
179 if [ "${ONLY}" = "MOUNT" ] ; then
180 echo "Lustre is up, please go on"
184 echo "preparing for tests involving mounts"
185 EXT2_DEV=${EXT2_DEV:-$TMP/SANITY.LOOP}
187 mke2fs -j -F $EXT2_DEV 8000 > /dev/null
188 echo # add a newline after mke2fs.
192 OLDDEBUG=$(lctl get_param -n debug 2> /dev/null)
193 lctl set_param debug=-1 2> /dev/null || true
196 $CHECKSTAT -t file $DIR/$tfile || error "$tfile is not a file"
198 $CHECKSTAT -a $DIR/$tfile || error "$tfile was not removed"
200 run_test 0a "touch; rm ====================="
203 chmod 0755 $DIR || error "chmod 0755 $DIR failed"
204 $CHECKSTAT -p 0755 $DIR || error "$DIR permission is not 0755"
206 run_test 0b "chmod 0755 $DIR ============================="
209 $LCTL get_param mdc.*.import | grep "state: FULL" ||
210 error "import not FULL"
211 $LCTL get_param mdc.*.import | grep "target: $FSNAME-MDT" ||
214 run_test 0c "check import proc"
216 test_0d() { # LU-3397
217 [ $MGS_VERSION -lt $(version_code 2.10.57) ] &&
218 skip "proc exports not supported before 2.10.57"
220 local mgs_exp="mgs.MGS.exports"
221 local client_uuid=$($LCTL get_param -n mgc.*.uuid)
223 local exp_client_version
226 local temp_imp=$DIR/$tfile.import
227 local temp_exp=$DIR/$tfile.export
229 # save mgc import file to $temp_imp
230 $LCTL get_param mgc.*.import | tee $temp_imp
231 # Check if client uuid is found in MGS export
232 for exp_client_nid in $(do_facet mgs $LCTL get_param -N $mgs_exp.*); do
233 [ $(do_facet mgs $LCTL get_param -n $exp_client_nid.uuid) == \
237 # save mgs export file to $temp_exp
238 do_facet mgs $LCTL get_param $exp_client_nid.export | tee $temp_exp
240 # Compare the value of field "connect_flags"
241 imp_val=$(grep "connect_flags" $temp_imp)
242 exp_val=$(grep "connect_flags" $temp_exp)
243 [ "$exp_val" == "$imp_val" ] ||
244 error "export flags '$exp_val' != import flags '$imp_val'"
246 # Compare client versions. Only compare top-3 fields for compatibility
247 exp_client_version=$(awk '/target_version:/ { print $2 }' $temp_exp)
248 exp_val=$(version_code $(cut -d. -f1,2,3 <<<$exp_client_version))
249 imp_val=$(version_code $(lustre_build_version client | cut -d. -f1,2,3))
250 [ "$exp_val" == "$imp_val" ] ||
251 error "exp version '$exp_client_version'($exp_val) != " \
252 "'$(lustre_build_version client)'($imp_val)"
254 run_test 0d "check export proc ============================="
256 test_0e() { # LU-13417
257 (( $MDSCOUNT > 1 )) ||
258 skip "We need at least 2 MDTs for this test"
260 (( $MDS1_VERSION >= $(version_code 2.14.51) )) ||
261 skip "Need server version at least 2.14.51"
263 local default_lmv_count=$($LFS getdirstripe -D -c $MOUNT)
264 local default_lmv_index=$($LFS getdirstripe -D -i $MOUNT)
266 [ $default_lmv_count -eq 1 ] ||
267 error "$MOUNT default stripe count $default_lmv_count"
269 [ $default_lmv_index -eq -1 ] ||
270 error "$MOUNT default stripe index $default_lmv_index"
272 mkdir $MOUNT/$tdir.1 || error "mkdir $MOUNT/$tdir.1 failed"
273 mkdir $MOUNT/$tdir.2 || error "mkdir $MOUNT/$tdir.2 failed"
275 local mdt_index1=$($LFS getdirstripe -i $MOUNT/$tdir.1)
276 local mdt_index2=$($LFS getdirstripe -i $MOUNT/$tdir.2)
278 [ $mdt_index1 -eq $mdt_index2 ] &&
279 error "directories are on the same MDT $mdt_index1=$mdt_index2"
281 rmdir $MOUNT/$tdir.1 $MOUNT/$tdir.2
283 run_test 0e "Enable DNE MDT balancing for mkdir in the ROOT"
286 test_mkdir $DIR/$tdir
287 test_mkdir $DIR/$tdir/d2
288 mkdir $DIR/$tdir/d2 && error "we expect EEXIST, but not returned"
289 $CHECKSTAT -t dir $DIR/$tdir/d2 || error "$tdir/d2 is not a dir"
292 $CHECKSTAT -a $DIR/$tdir || error "$tdir was not removed"
294 run_test 1 "mkdir; remkdir; rmdir"
297 test_mkdir $DIR/$tdir
298 touch $DIR/$tdir/$tfile || error "touch $tdir/$tfile failed"
299 $CHECKSTAT -t file $DIR/$tdir/$tfile || error "$tdir/$tfile not a file"
301 $CHECKSTAT -a $DIR/$tdir/$tfile || error "$tdir/$file is not removed"
303 run_test 2 "mkdir; touch; rmdir; check file"
306 test_mkdir $DIR/$tdir
307 $CHECKSTAT -t dir $DIR/$tdir || error "$tdir is not a directory"
308 touch $DIR/$tdir/$tfile
309 $CHECKSTAT -t file $DIR/$tdir/$tfile || error "$tdir/$tfile not a file"
311 $CHECKSTAT -a $DIR/$tdir || error "$tdir is not removed"
313 run_test 3 "mkdir; touch; rmdir; check dir"
315 # LU-4471 - failed rmdir on remote directories still removes directory on MDT0
317 test_mkdir -i 1 $DIR/$tdir
319 touch $DIR/$tdir/$tfile ||
320 error "Create file under remote directory failed"
323 error "Expect error removing in-use dir $DIR/$tdir"
325 test -d $DIR/$tdir || error "Remote directory disappeared"
327 rm -rf $DIR/$tdir || error "remove remote dir error"
329 run_test 4 "mkdir; touch dir/file; rmdir; checkdir (expect error)"
332 test_mkdir $DIR/$tdir
333 test_mkdir $DIR/$tdir/d2
334 chmod 0707 $DIR/$tdir/d2 || error "chmod 0707 $tdir/d2 failed"
335 $CHECKSTAT -t dir -p 0707 $DIR/$tdir/d2 || error "$tdir/d2 not mode 707"
336 $CHECKSTAT -t dir $DIR/$tdir/d2 || error "$tdir/d2 is not a directory"
338 run_test 5 "mkdir .../d5 .../d5/d2; chmod .../d5/d2"
341 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
342 chmod 0666 $DIR/$tfile || error "chmod 0666 $tfile failed"
343 $CHECKSTAT -t file -p 0666 -u \#$UID $DIR/$tfile ||
344 error "$tfile does not have perm 0666 or UID $UID"
345 $RUNAS chmod 0444 $DIR/$tfile && error "chmod $tfile worked on UID $UID"
346 $CHECKSTAT -t file -p 0666 -u \#$UID $DIR/$tfile ||
347 error "$tfile should be 0666 and owned by UID $UID"
349 run_test 6a "touch f6a; chmod f6a; $RUNAS chmod f6a (should return error) =="
352 [ $RUNAS_ID -eq $UID ] && skip_env "RUNAS_ID = UID = $UID"
355 chown $RUNAS_ID $DIR/$tfile || error "chown $RUNAS_ID $file failed"
356 $CHECKSTAT -t file -u \#$RUNAS_ID $DIR/$tfile ||
357 error "$tfile should be owned by UID $RUNAS_ID"
358 $RUNAS chown $UID $DIR/$tfile && error "chown $UID $file succeeded"
359 $CHECKSTAT -t file -u \#$RUNAS_ID $DIR/$tfile ||
360 error "$tfile should be owned by UID $RUNAS_ID"
362 run_test 6c "touch f6c; chown f6c; $RUNAS chown f6c (should return error) =="
365 [ $RUNAS_ID -eq $UID ] && skip_env "RUNAS_ID = UID = $UID"
368 chgrp $RUNAS_ID $DIR/$tfile || error "chgrp $RUNAS_ID $file failed"
369 $CHECKSTAT -t file -u \#$UID -g \#$RUNAS_ID $DIR/$tfile ||
370 error "$tfile should be owned by GID $UID"
371 $RUNAS chgrp $UID $DIR/$tfile && error "chgrp $UID $file succeeded"
372 $CHECKSTAT -t file -u \#$UID -g \#$RUNAS_ID $DIR/$tfile ||
373 error "$tfile should be owned by UID $UID and GID $RUNAS_ID"
375 run_test 6e "touch+chgrp $tfile; $RUNAS chgrp $tfile (should return error)"
378 [ $RUNAS_ID -eq $UID ] && skip_env "RUNAS_ID = UID = $UID"
380 test_mkdir $DIR/$tdir
381 chmod 777 $DIR/$tdir || error "chmod 0777 $tdir failed"
382 $RUNAS mkdir $DIR/$tdir/d || error "mkdir $tdir/d failed"
383 chmod g+s $DIR/$tdir/d || error "chmod g+s $tdir/d failed"
384 test_mkdir $DIR/$tdir/d/subdir
385 $CHECKSTAT -g \#$RUNAS_GID $DIR/$tdir/d/subdir ||
386 error "$tdir/d/subdir should be GID $RUNAS_GID"
387 if [[ $MDSCOUNT -gt 1 ]]; then
388 # check remote dir sgid inherite
389 $LFS mkdir -i 0 $DIR/$tdir.local ||
390 error "mkdir $tdir.local failed"
391 chmod g+s $DIR/$tdir.local ||
392 error "chmod $tdir.local failed"
393 chgrp $RUNAS_GID $DIR/$tdir.local ||
394 error "chgrp $tdir.local failed"
395 $LFS mkdir -i 1 $DIR/$tdir.local/$tdir.remote ||
396 error "mkdir $tdir.remote failed"
397 $CHECKSTAT -g \#$RUNAS_GID $DIR/$tdir.local/$tdir.remote ||
398 error "$tdir.remote should be owned by $UID.$RUNAS_ID"
399 $CHECKSTAT -p 02755 $DIR/$tdir.local/$tdir.remote ||
400 error "$tdir.remote should be mode 02755"
403 run_test 6g "verify new dir in sgid dir inherits group"
405 test_6h() { # bug 7331
406 [ $RUNAS_ID -eq $UID ] && skip_env "RUNAS_ID = UID = $UID"
408 touch $DIR/$tfile || error "touch failed"
409 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile || error "initial chown failed"
410 $RUNAS -G$RUNAS_GID chown $RUNAS_ID:0 $DIR/$tfile &&
411 error "chown $RUNAS_ID:0 $tfile worked as GID $RUNAS_GID"
412 $CHECKSTAT -t file -u \#$RUNAS_ID -g \#$RUNAS_GID $DIR/$tfile ||
413 error "$tdir/$tfile should be UID $RUNAS_UID GID $RUNAS_GID"
415 run_test 6h "$RUNAS chown RUNAS_ID.0 .../$tfile (should return error)"
418 test_mkdir $DIR/$tdir
419 $MCREATE $DIR/$tdir/$tfile
420 chmod 0666 $DIR/$tdir/$tfile
421 $CHECKSTAT -t file -p 0666 $DIR/$tdir/$tfile ||
422 error "$tdir/$tfile should be mode 0666"
424 run_test 7a "mkdir .../d7; mcreate .../d7/f; chmod .../d7/f ===="
427 if [ ! -d $DIR/$tdir ]; then
428 test_mkdir $DIR/$tdir
430 $MCREATE $DIR/$tdir/$tfile
431 echo -n foo > $DIR/$tdir/$tfile
432 [ "$(cat $DIR/$tdir/$tfile)" = "foo" ] || error "$tdir/$tfile not 'foo'"
433 $CHECKSTAT -t file -s 3 $DIR/$tdir/$tfile || error "$tfile size not 3"
435 run_test 7b "mkdir .../d7; mcreate d7/f2; echo foo > d7/f2 ====="
438 test_mkdir $DIR/$tdir
439 touch $DIR/$tdir/$tfile
440 chmod 0666 $DIR/$tdir/$tfile
441 $CHECKSTAT -t file -p 0666 $DIR/$tdir/$tfile ||
442 error "$tfile mode not 0666"
444 run_test 8 "mkdir .../d8; touch .../d8/f; chmod .../d8/f ======="
447 test_mkdir $DIR/$tdir
448 test_mkdir $DIR/$tdir/d2
449 test_mkdir $DIR/$tdir/d2/d3
450 $CHECKSTAT -t dir $DIR/$tdir/d2/d3 || error "$tdir/d2/d3 not a dir"
452 run_test 9 "mkdir .../d9 .../d9/d2 .../d9/d2/d3 ================"
455 test_mkdir $DIR/$tdir
456 test_mkdir $DIR/$tdir/d2
457 touch $DIR/$tdir/d2/$tfile
458 $CHECKSTAT -t file $DIR/$tdir/d2/$tfile ||
459 error "$tdir/d2/$tfile not a file"
461 run_test 10 "mkdir .../d10 .../d10/d2; touch .../d10/d2/f ======"
464 test_mkdir $DIR/$tdir
465 test_mkdir $DIR/$tdir/d2
466 chmod 0666 $DIR/$tdir/d2
467 chmod 0705 $DIR/$tdir/d2
468 $CHECKSTAT -t dir -p 0705 $DIR/$tdir/d2 ||
469 error "$tdir/d2 mode not 0705"
471 run_test 11 "mkdir .../d11 d11/d2; chmod .../d11/d2 ============"
474 test_mkdir $DIR/$tdir
475 touch $DIR/$tdir/$tfile
476 chmod 0666 $DIR/$tdir/$tfile
477 chmod 0654 $DIR/$tdir/$tfile
478 $CHECKSTAT -t file -p 0654 $DIR/$tdir/$tfile ||
479 error "$tdir/d2 mode not 0654"
481 run_test 12 "touch .../d12/f; chmod .../d12/f .../d12/f ========"
484 test_mkdir $DIR/$tdir
485 dd if=/dev/zero of=$DIR/$tdir/$tfile count=10
487 $CHECKSTAT -t file -s 0 $DIR/$tdir/$tfile ||
488 error "$tdir/$tfile size not 0 after truncate"
490 run_test 13 "creat .../d13/f; dd .../d13/f; > .../d13/f ========"
493 test_mkdir $DIR/$tdir
494 touch $DIR/$tdir/$tfile
496 $CHECKSTAT -a $DIR/$tdir/$tfile || error "$tdir/$tfile not removed"
498 run_test 14 "touch .../d14/f; rm .../d14/f; rm .../d14/f ======="
501 test_mkdir $DIR/$tdir
502 touch $DIR/$tdir/$tfile
503 mv $DIR/$tdir/$tfile $DIR/$tdir/${tfile}_2
504 $CHECKSTAT -t file $DIR/$tdir/${tfile}_2 ||
505 error "$tdir/${tfile_2} not a file after rename"
506 rm $DIR/$tdir/${tfile}_2 || error "unlink failed after rename"
508 run_test 15 "touch .../d15/f; mv .../d15/f .../d15/f2 =========="
511 test_mkdir $DIR/$tdir
512 touch $DIR/$tdir/$tfile
513 rm -rf $DIR/$tdir/$tfile
514 $CHECKSTAT -a $DIR/$tdir/$tfile || error "$tdir/$tfile not removed"
516 run_test 16 "touch .../d16/f; rm -rf .../d16/f"
519 test_mkdir $DIR/$tdir
520 touch $DIR/$tdir/$tfile
521 ln -s $DIR/$tdir/$tfile $DIR/$tdir/l-exist
523 $CHECKSTAT -l $DIR/$tdir/$tfile $DIR/$tdir/l-exist ||
524 error "$tdir/l-exist not a symlink"
525 $CHECKSTAT -f -t f $DIR/$tdir/l-exist ||
526 error "$tdir/l-exist not referencing a file"
527 rm -f $DIR/$tdir/l-exist
528 $CHECKSTAT -a $DIR/$tdir/l-exist || error "$tdir/l-exist not removed"
530 run_test 17a "symlinks: create, remove (real)"
533 test_mkdir $DIR/$tdir
534 ln -s no-such-file $DIR/$tdir/l-dangle
536 $CHECKSTAT -l no-such-file $DIR/$tdir/l-dangle ||
537 error "$tdir/l-dangle not referencing no-such-file"
538 $CHECKSTAT -fa $DIR/$tdir/l-dangle ||
539 error "$tdir/l-dangle not referencing non-existent file"
540 rm -f $DIR/$tdir/l-dangle
541 $CHECKSTAT -a $DIR/$tdir/l-dangle || error "$tdir/l-dangle not removed"
543 run_test 17b "symlinks: create, remove (dangling)"
545 test_17c() { # bug 3440 - don't save failed open RPC for replay
546 test_mkdir $DIR/$tdir
547 ln -s foo $DIR/$tdir/$tfile
548 cat $DIR/$tdir/$tfile && error "opened non-existent symlink" || true
550 run_test 17c "symlinks: open dangling (should return error)"
553 test_mkdir $DIR/$tdir
554 ln -s foo $DIR/$tdir/$tfile
555 touch $DIR/$tdir/$tfile || error "creating to new symlink"
557 run_test 17d "symlinks: create dangling"
560 test_mkdir $DIR/$tdir
561 local foo=$DIR/$tdir/$tfile
562 ln -s $foo $foo || error "create symlink failed"
563 ls -l $foo || error "ls -l failed"
564 ls $foo && error "ls not failed" || true
566 run_test 17e "symlinks: create recursive symlink (should return error)"
569 test_mkdir $DIR/$tdir
570 ln -s 1234567890/2234567890/3234567890/4234567890 $DIR/$tdir/111
571 ln -s 1234567890/2234567890/3234567890/4234567890/5234567890/6234567890 $DIR/$tdir/222
572 ln -s 1234567890/2234567890/3234567890/4234567890/5234567890/6234567890/7234567890/8234567890 $DIR/$tdir/333
573 ln -s 1234567890/2234567890/3234567890/4234567890/5234567890/6234567890/7234567890/8234567890/9234567890/a234567890/b234567890 $DIR/$tdir/444
574 ln -s 1234567890/2234567890/3234567890/4234567890/5234567890/6234567890/7234567890/8234567890/9234567890/a234567890/b234567890/c234567890/d234567890/f234567890 $DIR/$tdir/555
575 ln -s 1234567890/2234567890/3234567890/4234567890/5234567890/6234567890/7234567890/8234567890/9234567890/a234567890/b234567890/c234567890/d234567890/f234567890/aaaaaaaaaa/bbbbbbbbbb/cccccccccc/dddddddddd/eeeeeeeeee/ffffffffff/ $DIR/$tdir/666
578 run_test 17f "symlinks: long and very long symlink name"
580 # str_repeat(S, N) generate a string that is string S repeated N times
585 while [ $((n -= 1)) -ge 0 ]; do
591 # Long symlinks and LU-2241
593 test_mkdir $DIR/$tdir
594 local TESTS="59 60 61 4094 4095"
596 # Fix for inode size boundary in 2.1.4
597 [ $MDS1_VERSION -lt $(version_code 2.1.4) ] &&
600 # Patch not applied to 2.2 or 2.3 branches
601 [ $MDS1_VERSION -ge $(version_code 2.2.0) ] &&
602 [ $MDS1_VERSION -le $(version_code 2.3.55) ] &&
606 local SYMNAME=$(str_repeat 'x' $i)
607 ln -s $SYMNAME $DIR/$tdir/f$i || error "failed $i-char symlink"
608 readlink $DIR/$tdir/f$i || error "failed $i-char readlink"
611 run_test 17g "symlinks: really long symlink name and inode boundaries"
613 test_17h() { #bug 17378
614 [ $PARALLEL == "yes" ] && skip "skip parallel run"
615 remote_mds_nodsh && skip "remote MDS with nodsh"
619 test_mkdir $DIR/$tdir
620 mdt_idx=$($LFS getdirstripe -i $DIR/$tdir)
621 $LFS setstripe -c -1 $DIR/$tdir
622 #define OBD_FAIL_MDS_LOV_PREP_CREATE 0x141
623 do_facet mds$((mdt_idx + 1)) lctl set_param fail_loc=0x80000141
624 touch $DIR/$tdir/$tfile || true
626 run_test 17h "create objects: lov_free_memmd() doesn't lbug"
628 test_17i() { #bug 20018
629 [ $PARALLEL == "yes" ] && skip "skip parallel run"
630 remote_mds_nodsh && skip "remote MDS with nodsh"
632 local foo=$DIR/$tdir/$tfile
635 test_mkdir -c1 $DIR/$tdir
636 mdt_idx=$($LFS getdirstripe -i $DIR/$tdir)
637 ln -s $foo $foo || error "create symlink failed"
638 #define OBD_FAIL_MDS_READLINK_EPROTO 0x143
639 do_facet mds$((mdt_idx + 1)) lctl set_param fail_loc=0x80000143
640 ls -l $foo && error "error not detected"
643 run_test 17i "don't panic on short symlink (should return error)"
645 test_17k() { #bug 22301
646 [ $PARALLEL == "yes" ] && skip "skip parallel run"
647 [[ -z "$(which rsync 2>/dev/null)" ]] &&
648 skip "no rsync command"
649 rsync --help | grep -q xattr ||
650 skip_env "$(rsync --version | head -n1) does not support xattrs"
651 test_mkdir $DIR/$tdir
652 test_mkdir $DIR/$tdir.new
653 touch $DIR/$tdir/$tfile
654 ln -s $DIR/$tdir/$tfile $DIR/$tdir/$tfile.lnk
655 rsync -av -X $DIR/$tdir/ $DIR/$tdir.new ||
656 error "rsync failed with xattrs enabled"
658 run_test 17k "symlinks: rsync with xattrs enabled"
660 test_17l() { # LU-279
661 [[ -z "$(which getfattr 2>/dev/null)" ]] &&
662 skip "no getfattr command"
664 test_mkdir $DIR/$tdir
665 touch $DIR/$tdir/$tfile
666 ln -s $DIR/$tdir/$tfile $DIR/$tdir/$tfile.lnk
667 for path in "$DIR/$tdir" "$DIR/$tdir/$tfile" "$DIR/$tdir/$tfile.lnk"; do
668 # -h to not follow symlinks. -m '' to list all the xattrs.
669 # grep to remove first line: '# file: $path'.
670 for xattr in `getfattr -hm '' $path 2>/dev/null | grep -v '^#'`;
672 lgetxattr_size_check $path $xattr ||
673 error "lgetxattr_size_check $path $xattr failed"
677 run_test 17l "Ensure lgetxattr's returned xattr size is consistent"
681 [ $PARALLEL == "yes" ] && skip "skip parallel run"
682 [ "$mds1_FSTYPE" != "ldiskfs" ] && skip_env "ldiskfs only test"
683 remote_mds_nodsh && skip "remote MDS with nodsh"
684 [ $MDS1_VERSION -ge $(version_code 2.2.0) ] &&
685 [ $MDS1_VERSION -le $(version_code 2.2.93) ] &&
686 skip "MDS 2.2.0-2.2.93 do not NUL-terminate symlinks"
688 local short_sym="0123456789"
689 local wdir=$DIR/$tdir
694 # create a long symlink file
695 for ((i = 0; i < 4; ++i)); do
696 long_sym=${long_sym}${long_sym}
699 echo "create 512 short and long symlink files under $wdir"
700 for ((i = 0; i < 256; ++i)); do
701 ln -sf ${long_sym}"a5a5" $wdir/long-$i
702 ln -sf ${short_sym}"a5a5" $wdir/short-$i
708 wait_delete_completed
710 echo "recreate the 512 symlink files with a shorter string"
711 for ((i = 0; i < 512; ++i)); do
712 # rewrite the symlink file with a shorter string
713 ln -sf ${long_sym} $wdir/long-$i || error "long_sym failed"
714 ln -sf ${short_sym} $wdir/short-$i || error "short_sym failed"
717 local mds_index=$(($($LFS getstripe -m $wdir) + 1))
718 local devname=$(mdsdevname $mds_index)
720 echo "stop and checking mds${mds_index}:"
721 # e2fsck should not return error
723 run_e2fsck $(facet_active_host mds${mds_index}) $devname -n
726 start mds${mds_index} $devname $MDS_MOUNT_OPTS ||
727 error "start mds${mds_index} failed"
728 df $MOUNT > /dev/null 2>&1
730 error "e2fsck detected error for short/long symlink: rc=$rc"
733 run_test 17m "run e2fsck against MDT which contains short/long symlink"
735 check_fs_consistency_17n() {
739 # create/unlink in 17n only change 2 MDTs(MDT1/MDT2),
740 # so it only check MDT1/MDT2 instead of all of MDTs.
741 for mdt_index in 1 2; do
742 local devname=$(mdsdevname $mdt_index)
743 # e2fsck should not return error
745 run_e2fsck $(facet_active_host mds$mdt_index) $devname -n ||
748 start mds${mdt_index} $devname $MDS_MOUNT_OPTS ||
749 error "mount mds$mdt_index failed"
750 df $MOUNT > /dev/null 2>&1
756 [[ $MDSCOUNT -lt 2 ]] && skip_env "needs >= 2 MDTs"
757 [ $PARALLEL == "yes" ] && skip "skip parallel run"
758 [ "$mds1_FSTYPE" != "ldiskfs" ] && skip_env "ldiskfs only test"
759 remote_mds_nodsh && skip "remote MDS with nodsh"
760 [ $MDS1_VERSION -ge $(version_code 2.2.0) ] &&
761 [ $MDS1_VERSION -le $(version_code 2.2.93) ] &&
762 skip "MDS 2.2.0-2.2.93 do not NUL-terminate symlinks"
766 test_mkdir $DIR/$tdir
767 for ((i=0; i<10; i++)); do
768 $LFS mkdir -i1 -c2 $DIR/$tdir/remote_dir_${i} ||
769 error "create remote dir error $i"
770 createmany -o $DIR/$tdir/remote_dir_${i}/f 10 ||
771 error "create files under remote dir failed $i"
774 check_fs_consistency_17n ||
775 error "e2fsck report error after create files under remote dir"
777 for ((i = 0; i < 10; i++)); do
778 rm -rf $DIR/$tdir/remote_dir_${i} ||
779 error "destroy remote dir error $i"
782 check_fs_consistency_17n ||
783 error "e2fsck report error after unlink files under remote dir"
785 [ $MDS1_VERSION -lt $(version_code 2.4.50) ] &&
786 skip "lustre < 2.4.50 does not support migrate mv"
788 for ((i = 0; i < 10; i++)); do
789 mkdir -p $DIR/$tdir/remote_dir_${i}
790 createmany -o $DIR/$tdir/remote_dir_${i}/f 10 ||
791 error "create files under remote dir failed $i"
792 $LFS migrate --mdt-index 1 $DIR/$tdir/remote_dir_${i} ||
793 error "migrate remote dir error $i"
795 check_fs_consistency_17n || error "e2fsck report error after migration"
797 for ((i = 0; i < 10; i++)); do
798 rm -rf $DIR/$tdir/remote_dir_${i} ||
799 error "destroy remote dir error $i"
802 check_fs_consistency_17n || error "e2fsck report error after unlink"
804 run_test 17n "run e2fsck against master/slave MDT which contains remote dir"
807 remote_mds_nodsh && skip "remote MDS with nodsh"
808 [ $MDS1_VERSION -lt $(version_code 2.3.64) ] &&
809 skip "Need MDS version at least 2.3.64"
811 local wdir=$DIR/${tdir}o
817 mdt_index=$($LFS getstripe -m $wdir/$tfile)
818 mdt_index=$((mdt_index + 1))
821 #fail mds will wait the failover finish then set
822 #following fail_loc to avoid interfer the recovery process.
825 #define OBD_FAIL_OSD_LMA_INCOMPAT 0x194
826 do_facet mds${mdt_index} lctl set_param fail_loc=0x194
827 ls -l $wdir/$tfile && rc=1
828 do_facet mds${mdt_index} lctl set_param fail_loc=0
829 [[ $rc -eq 0 ]] || error "stat file should fail"
831 run_test 17o "stat file with incompat LMA feature"
834 touch $DIR/$tfile || error "Failed to touch $DIR/$tfile: $?"
835 ls $DIR || error "Failed to ls $DIR: $?"
837 run_test 18 "touch .../f ; ls ... =============================="
843 $CHECKSTAT -a $DIR/$tfile || error "$tfile was not removed"
845 run_test 19a "touch .../f19 ; ls -l ... ; rm .../f19 ==========="
848 ls -l $DIR/$tfile && error "ls -l $tfile failed"|| true
850 run_test 19b "ls -l .../f19 (should return error) =============="
853 [ $RUNAS_ID -eq $UID ] &&
854 skip_env "RUNAS_ID = UID = $UID -- skipping"
856 $RUNAS touch $DIR/$tfile && error "create non-root file failed" || true
858 run_test 19c "$RUNAS touch .../f19 (should return error) =="
861 cat $DIR/f19 && error || true
863 run_test 19d "cat .../f19 (should return error) =============="
872 $CHECKSTAT -a $DIR/$tfile || error "$tfile was not removed"
874 run_test 20 "touch .../f ; ls -l ..."
877 test_mkdir $DIR/$tdir
878 [ -f $DIR/$tdir/dangle ] && rm -f $DIR/$tdir/dangle
879 ln -s dangle $DIR/$tdir/link
880 echo foo >> $DIR/$tdir/link
881 cat $DIR/$tdir/dangle
882 $CHECKSTAT -t link $DIR/$tdir/link || error "$tdir/link not a link"
883 $CHECKSTAT -f -t file $DIR/$tdir/link ||
884 error "$tdir/link not linked to a file"
886 run_test 21 "write to dangling link"
889 local wdir=$DIR/$tdir
891 chown $RUNAS_ID:$RUNAS_GID $wdir
892 (cd $wdir || error "cd $wdir failed";
893 $RUNAS tar cf - /etc/hosts /etc/sysconfig/network |
895 ls -lR $wdir/etc || error "ls -lR $wdir/etc failed"
896 $CHECKSTAT -t dir $wdir/etc || error "checkstat -t dir failed"
897 $CHECKSTAT -u \#$RUNAS_ID -g \#$RUNAS_GID $wdir/etc ||
898 error "checkstat -u failed"
900 run_test 22 "unpack tar archive as non-root user"
904 test_mkdir $DIR/$tdir
905 local file=$DIR/$tdir/$tfile
907 openfile -f O_CREAT:O_EXCL $file || error "$file create failed"
908 openfile -f O_CREAT:O_EXCL $file &&
909 error "$file recreate succeeded" || true
911 run_test 23a "O_CREAT|O_EXCL in subdir"
913 test_23b() { # bug 18988
914 test_mkdir $DIR/$tdir
915 local file=$DIR/$tdir/$tfile
918 echo foo > $file || error "write filed"
919 echo bar >> $file || error "append filed"
920 $CHECKSTAT -s 8 $file || error "wrong size"
923 run_test 23b "O_APPEND check"
925 # LU-9409, size with O_APPEND and tiny writes
927 local file=$DIR/$tfile
930 dd conv=notrunc oflag=append if=/dev/zero of=$file bs=8 count=800
931 $CHECKSTAT -s 6400 $file || error "wrong size, expected 6400"
935 dd conv=notrunc oflag=append if=/dev/zero of=$file bs=8 count=800 &
936 dd conv=notrunc oflag=append if=/dev/zero of=$file bs=8 count=800 &
938 $CHECKSTAT -s 12800 $file || error "wrong size, expected 12800"
941 #racing tiny & normal writes
942 dd conv=notrunc oflag=append if=/dev/zero of=$file bs=4096 count=4 &
943 dd conv=notrunc oflag=append if=/dev/zero of=$file bs=8 count=100 &
945 $CHECKSTAT -s 17184 $file || error "wrong size, expected 17184"
948 #racing tiny & normal writes 2, ugly numbers
949 dd conv=notrunc oflag=append if=/dev/zero of=$file bs=4099 count=11 &
950 dd conv=notrunc oflag=append if=/dev/zero of=$file bs=17 count=173 &
952 $CHECKSTAT -s 48030 $file || error "wrong size, expected 48030"
955 run_test 23c "O_APPEND size checks for tiny writes"
957 # LU-11069 file offset is correct after appending writes
959 local file=$DIR/$tfile
962 echo CentaurHauls > $file
963 offset=$($MULTIOP $file oO_WRONLY:O_APPEND:w13Zp)
964 if ((offset != 26)); then
965 error "wrong offset, expected 26, got '$offset'"
968 run_test 23d "file offset is correct after appending writes"
972 echo '-- same directory rename'
973 test_mkdir $DIR/$tdir
974 touch $DIR/$tdir/$tfile.1
975 mv $DIR/$tdir/$tfile.1 $DIR/$tdir/$tfile.2
976 $CHECKSTAT -t file $DIR/$tdir/$tfile.2 || error "$tfile.2 not a file"
978 run_test 24a "rename file to non-existent target"
981 test_mkdir $DIR/$tdir
982 touch $DIR/$tdir/$tfile.{1,2}
983 mv $DIR/$tdir/$tfile.1 $DIR/$tdir/$tfile.2
984 $CHECKSTAT -a $DIR/$tdir/$tfile.1 || error "$tfile.1 exists"
985 $CHECKSTAT -t file $DIR/$tdir/$tfile.2 || error "$tfile.2 not a file"
987 run_test 24b "rename file to existing target"
990 test_mkdir $DIR/$tdir
991 test_mkdir $DIR/$tdir/d$testnum.1
992 mv $DIR/$tdir/d$testnum.1 $DIR/$tdir/d$testnum.2
993 $CHECKSTAT -a $DIR/$tdir/d$testnum.1 || error "d$testnum.1 exists"
994 $CHECKSTAT -t dir $DIR/$tdir/d$testnum.2 || error "d$testnum.2 not dir"
996 run_test 24c "rename directory to non-existent target"
999 test_mkdir -c1 $DIR/$tdir
1000 test_mkdir -c1 $DIR/$tdir/d$testnum.1
1001 test_mkdir -c1 $DIR/$tdir/d$testnum.2
1002 mrename $DIR/$tdir/d$testnum.1 $DIR/$tdir/d$testnum.2
1003 $CHECKSTAT -a $DIR/$tdir/d$testnum.1 || error "d$testnum.1 exists"
1004 $CHECKSTAT -t dir $DIR/$tdir/d$testnum.2 || error "d$testnum.2 not dir"
1006 run_test 24d "rename directory to existing target"
1009 echo '-- cross directory renames --'
1013 mv $DIR/R5a/f $DIR/R5b/g
1014 $CHECKSTAT -a $DIR/R5a/f || error "$DIR/R5a/f exists"
1015 $CHECKSTAT -t file $DIR/R5b/g || error "$DIR/R5b/g not file type"
1017 run_test 24e "touch .../R5a/f; rename .../R5a/f .../R5b/g ======"
1022 touch $DIR/R6a/f $DIR/R6b/g
1023 mv $DIR/R6a/f $DIR/R6b/g
1024 $CHECKSTAT -a $DIR/R6a/f || error "$DIR/R6a/f exists"
1025 $CHECKSTAT -t file $DIR/R6b/g || error "$DIR/R6b/g not file type"
1027 run_test 24f "touch .../R6a/f R6b/g; mv .../R6a/f .../R6b/g ===="
1032 test_mkdir $DIR/R7a/d
1033 mv $DIR/R7a/d $DIR/R7b/e
1034 $CHECKSTAT -a $DIR/R7a/d || error "$DIR/R7a/d exists"
1035 $CHECKSTAT -t dir $DIR/R7b/e || error "$DIR/R7b/e not dir type"
1037 run_test 24g "mkdir .../R7{a,b}/d; mv .../R7a/d .../R7b/e ======"
1040 test_mkdir -c1 $DIR/R8a
1041 test_mkdir -c1 $DIR/R8b
1042 test_mkdir -c1 $DIR/R8a/d
1043 test_mkdir -c1 $DIR/R8b/e
1044 mrename $DIR/R8a/d $DIR/R8b/e
1045 $CHECKSTAT -a $DIR/R8a/d || error "$DIR/R8a/d exists"
1046 $CHECKSTAT -t dir $DIR/R8b/e || error "$DIR/R8b/e not dir type"
1048 run_test 24h "mkdir .../R8{a,b}/{d,e}; rename .../R8a/d .../R8b/e"
1051 echo "-- rename error cases"
1053 test_mkdir $DIR/R9/a
1055 mrename $DIR/R9/f $DIR/R9/a
1056 $CHECKSTAT -t file $DIR/R9/f || error "$DIR/R9/f not file type"
1057 $CHECKSTAT -t dir $DIR/R9/a || error "$DIR/R9/a not dir type"
1058 $CHECKSTAT -a $DIR/R9/a/f || error "$DIR/R9/a/f exists"
1060 run_test 24i "rename file to dir error: touch f ; mkdir a ; rename f a"
1064 mrename $DIR/R10/f $DIR/R10/g
1065 $CHECKSTAT -t dir $DIR/R10 || error "$DIR/R10 not dir type"
1066 $CHECKSTAT -a $DIR/R10/f || error "$DIR/R10/f exists"
1067 $CHECKSTAT -a $DIR/R10/g || error "$DIR/R10/g exists"
1069 run_test 24j "source does not exist ============================"
1072 test_mkdir $DIR/R11a
1073 test_mkdir $DIR/R11a/d
1075 mv $DIR/R11a/f $DIR/R11a/d
1076 $CHECKSTAT -a $DIR/R11a/f || error "$DIR/R11a/f exists"
1077 $CHECKSTAT -t file $DIR/R11a/d/f || error "$DIR/R11a/d/f not file type"
1079 run_test 24k "touch .../R11a/f; mv .../R11a/f .../R11a/d ======="
1081 # bug 2429 - rename foo foo foo creates invalid file
1084 $MULTIOP $f OcNs || error "rename of ${f} to itself failed"
1086 run_test 24l "Renaming a file to itself ========================"
1090 $MULTIOP $f OcLN ${f}2 ${f}2 || error "link ${f}2 ${f}2 failed"
1091 # on ext3 this does not remove either the source or target files
1092 # though the "expected" operation would be to remove the source
1093 $CHECKSTAT -t file ${f} || error "${f} missing"
1094 $CHECKSTAT -t file ${f}2 || error "${f}2 missing"
1096 run_test 24m "Renaming a file to a hard link to itself ========="
1100 # this stats the old file after it was renamed, so it should fail
1102 $CHECKSTAT ${f} || error "${f} missing"
1104 $CHECKSTAT ${f}.rename || error "${f}.rename missing"
1105 $CHECKSTAT -a ${f} || error "${f} exists"
1107 run_test 24n "Statting the old file after renaming (Posix rename 2)"
1110 test_mkdir $DIR/$tdir
1111 rename_many -s random -v -n 10 $DIR/$tdir
1113 run_test 24o "rename of files during htree split"
1116 test_mkdir $DIR/R12a
1117 test_mkdir $DIR/R12b
1118 DIRINO=`ls -lid $DIR/R12a | awk '{ print $1 }'`
1119 mrename $DIR/R12a $DIR/R12b
1120 $CHECKSTAT -a $DIR/R12a || error "$DIR/R12a exists"
1121 $CHECKSTAT -t dir $DIR/R12b || error "$DIR/R12b not dir type"
1122 DIRINO2=`ls -lid $DIR/R12b | awk '{ print $1 }'`
1123 [ "$DIRINO" = "$DIRINO2" ] || error "R12a $DIRINO != R12b $DIRINO2"
1125 run_test 24p "mkdir .../R12{a,b}; rename .../R12a .../R12b"
1127 cleanup_multiop_pause() {
1129 kill -USR1 $MULTIPID
1133 [ $PARALLEL == "yes" ] && skip "skip parallel run"
1135 test_mkdir $DIR/R13a
1136 test_mkdir $DIR/R13b
1137 local DIRINO=$(ls -lid $DIR/R13a | awk '{ print $1 }')
1138 multiop_bg_pause $DIR/R13b D_c || error "multiop failed to start"
1141 trap cleanup_multiop_pause EXIT
1142 mrename $DIR/R13a $DIR/R13b
1143 $CHECKSTAT -a $DIR/R13a || error "R13a still exists"
1144 $CHECKSTAT -t dir $DIR/R13b || error "R13b does not exist"
1145 local DIRINO2=$(ls -lid $DIR/R13b | awk '{ print $1 }')
1146 [ "$DIRINO" = "$DIRINO2" ] || error "R13a $DIRINO != R13b $DIRINO2"
1147 cleanup_multiop_pause
1148 wait $MULTIPID || error "multiop close failed"
1150 run_test 24q "mkdir .../R13{a,b}; open R13b rename R13a R13b ==="
1152 test_24r() { #bug 3789
1153 test_mkdir $DIR/R14a
1154 test_mkdir $DIR/R14a/b
1155 mrename $DIR/R14a $DIR/R14a/b && error "rename to subdir worked!"
1156 $CHECKSTAT -t dir $DIR/R14a || error "$DIR/R14a missing"
1157 $CHECKSTAT -t dir $DIR/R14a/b || error "$DIR/R14a/b missing"
1159 run_test 24r "mkdir .../R14a/b; rename .../R14a .../R14a/b ====="
1162 test_mkdir $DIR/R15a
1163 test_mkdir $DIR/R15a/b
1164 test_mkdir $DIR/R15a/b/c
1165 mrename $DIR/R15a $DIR/R15a/b/c && error "rename to sub-subdir worked!"
1166 $CHECKSTAT -t dir $DIR/R15a || error "$DIR/R15a missing"
1167 $CHECKSTAT -t dir $DIR/R15a/b/c || error "$DIR/R15a/b/c missing"
1169 run_test 24s "mkdir .../R15a/b/c; rename .../R15a .../R15a/b/c ="
1171 test_mkdir $DIR/R16a
1172 test_mkdir $DIR/R16a/b
1173 test_mkdir $DIR/R16a/b/c
1174 mrename $DIR/R16a/b/c $DIR/R16a && error "rename to sub-subdir worked!"
1175 $CHECKSTAT -t dir $DIR/R16a || error "$DIR/R16a missing"
1176 $CHECKSTAT -t dir $DIR/R16a/b/c || error "$DIR/R16a/b/c missing"
1178 run_test 24t "mkdir .../R16a/b/c; rename .../R16a/b/c .../R16a ="
1180 test_24u() { # bug12192
1181 $MULTIOP $DIR/$tfile C2w$((2048 * 1024))c || error "multiop failed"
1182 $CHECKSTAT -s $((2048 * 1024)) $DIR/$tfile || error "wrong file size"
1184 run_test 24u "create stripe file"
1186 simple_cleanup_common() {
1189 [ -z "$DIR" ] || [ -z "$tdir" ] && return 0
1191 local start=$SECONDS
1194 wait_delete_completed
1195 echo "cleanup time $((SECONDS - start))"
1199 max_pages_per_rpc() {
1200 local mdtname="$(printf "MDT%04x" ${1:-0})"
1201 $LCTL get_param -n mdc.*$mdtname*.max_pages_per_rpc
1205 [ $PARALLEL == "yes" ] && skip "skip parallel run"
1207 local nrfiles=${COUNT:-100000}
1208 local fname="$DIR/$tdir/$tfile"
1210 # Performance issue on ZFS see LU-4072 (c.f. LU-2887)
1211 [ "$mds1_FSTYPE" = "zfs" ] && nrfiles=${COUNT:-10000}
1213 test_mkdir "$(dirname $fname)"
1214 # assume MDT0000 has the fewest inodes
1215 local stripes=$($LFS getdirstripe -c $(dirname $fname))
1216 local free_inodes=$(($(mdt_free_inodes 0) * stripes))
1217 [[ $free_inodes -lt $nrfiles ]] && nrfiles=$free_inodes
1219 trap simple_cleanup_common EXIT
1221 createmany -m "$fname" $nrfiles
1223 cancel_lru_locks mdc
1224 lctl set_param mdc.*.stats clear
1226 # was previously test_24D: LU-6101
1227 # readdir() returns correct number of entries after cursor reload
1228 local num_ls=$(ls $DIR/$tdir | wc -l)
1229 local num_uniq=$(ls $DIR/$tdir | sort -u | wc -l)
1230 local num_all=$(ls -a $DIR/$tdir | wc -l)
1231 if [ $num_ls -ne $nrfiles ] || [ $num_uniq -ne $nrfiles ] ||
1232 [ $num_all -ne $((nrfiles + 2)) ]; then
1233 error "Expected $nrfiles files, got $num_ls " \
1234 "($num_uniq unique $num_all .&..)"
1236 # LU-5 large readdir
1237 # dirent_size = 32 bytes for sizeof(struct lu_dirent) +
1238 # N bytes for name (len($nrfiles) rounded to 8 bytes) +
1239 # 8 bytes for luda_type (4 bytes rounded to 8 bytes)
1240 # take into account of overhead in lu_dirpage header and end mark in
1241 # each page, plus one in rpc_num calculation.
1242 local dirent_size=$((32 + (${#tfile} | 7) + 1 + 8))
1243 local page_entries=$(((PAGE_SIZE - 24) / dirent_size))
1244 local mdt_idx=$($LFS getdirstripe -i $(dirname $fname))
1245 local rpc_pages=$(max_pages_per_rpc $mdt_idx)
1246 local rpc_max=$((nrfiles / (page_entries * rpc_pages) + stripes))
1247 local mds_readpage=$(calc_stats mdc.*.stats mds_readpage)
1248 echo "readpages: $mds_readpage rpc_max: $rpc_max"
1249 (( $mds_readpage < $rpc_max - 2 || $mds_readpage > $rpc_max + 1)) &&
1250 error "large readdir doesn't take effect: " \
1251 "$mds_readpage should be about $rpc_max"
1253 simple_cleanup_common
1255 run_test 24v "list large directory (test hash collision, b=17560)"
1257 test_24w() { # bug21506
1259 dd if=/dev/zero of=$DIR/$tfile bs=1M count=1 seek=4096 || return 1
1260 dd if=/dev/zero bs=$SZ1 count=1 >> $DIR/$tfile || return 2
1261 dd if=$DIR/$tfile of=$DIR/${tfile}_left bs=1M skip=4097 || return 3
1262 SZ2=`ls -l $DIR/${tfile}_left | awk '{print $5}'`
1263 [[ "$SZ1" -eq "$SZ2" ]] ||
1264 error "Error reading at the end of the file $tfile"
1266 run_test 24w "Reading a file larger than 4Gb"
1269 [[ $MDSCOUNT -lt 2 ]] && skip_env "needs >= 2 MDTs"
1270 [ $PARALLEL == "yes" ] && skip "skip parallel run"
1271 [[ $MDS1_VERSION -lt $(version_code 2.7.56) ]] &&
1272 skip "Need MDS version at least 2.7.56"
1275 local remote_dir=$DIR/$tdir/remote_dir
1277 test_mkdir $DIR/$tdir
1278 $LFS mkdir -i $MDTIDX $remote_dir ||
1279 error "create remote directory failed"
1281 test_mkdir $DIR/$tdir/src_dir
1282 touch $DIR/$tdir/src_file
1283 test_mkdir $remote_dir/tgt_dir
1284 touch $remote_dir/tgt_file
1286 mrename $DIR/$tdir/src_dir $remote_dir/tgt_dir ||
1287 error "rename dir cross MDT failed!"
1289 mrename $DIR/$tdir/src_file $remote_dir/tgt_file ||
1290 error "rename file cross MDT failed!"
1292 touch $DIR/$tdir/ln_file
1293 ln $DIR/$tdir/ln_file $remote_dir/ln_name ||
1294 error "ln file cross MDT failed"
1296 rm -rf $DIR/$tdir || error "Can not delete directories"
1298 run_test 24x "cross MDT rename/link"
1301 [[ $MDSCOUNT -lt 2 ]] && skip_env "needs >= 2 MDTs"
1302 [ $PARALLEL == "yes" ] && skip "skip parallel run"
1304 local remote_dir=$DIR/$tdir/remote_dir
1307 test_mkdir $DIR/$tdir
1308 $LFS mkdir -i $mdtidx $remote_dir ||
1309 error "create remote directory failed"
1311 test_mkdir $remote_dir/src_dir
1312 touch $remote_dir/src_file
1313 test_mkdir $remote_dir/tgt_dir
1314 touch $remote_dir/tgt_file
1316 mrename $remote_dir/src_dir $remote_dir/tgt_dir ||
1317 error "rename subdir in the same remote dir failed!"
1319 mrename $remote_dir/src_file $remote_dir/tgt_file ||
1320 error "rename files in the same remote dir failed!"
1322 ln $remote_dir/tgt_file $remote_dir/tgt_file1 ||
1323 error "link files in the same remote dir failed!"
1325 rm -rf $DIR/$tdir || error "Can not delete directories"
1327 run_test 24y "rename/link on the same dir should succeed"
1330 [[ $MDSCOUNT -lt 2 ]] && skip_env "needs >= 2 MDTs"
1331 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
1332 skip "Need MDS version at least 2.12.51"
1336 for index in 0 1; do
1337 $LFS mkdir -i $index $DIR/$tdir.$index || error "mkdir failed"
1338 touch $DIR/$tdir.0/$tfile.$index || error "touch failed"
1341 mv $DIR/$tdir.0/$tfile.0 $DIR/$tdir.1 || error "mv $tfile.0 failed"
1343 index=$($LFS getstripe -m $DIR/$tdir.1/$tfile.0)
1344 [ $index -eq 0 ] || error "$tfile.0 is on MDT$index"
1346 local mdts=$(comma_list $(mdts_nodes))
1348 do_nodes $mdts $LCTL set_param mdt.*.enable_remote_rename=0
1349 stack_trap "do_nodes $mdts $LCTL \
1350 set_param mdt.*.enable_remote_rename=1" EXIT
1352 mv $DIR/$tdir.0/$tfile.1 $DIR/$tdir.1 || error "mv $tfile.1 failed"
1354 index=$($LFS getstripe -m $DIR/$tdir.1/$tfile.1)
1355 [ $index -eq 1 ] || error "$tfile.1 is on MDT$index"
1357 run_test 24z "cross-MDT rename is done as cp"
1359 test_24A() { # LU-3182
1363 test_mkdir $DIR/$tdir
1364 trap simple_cleanup_common EXIT
1365 createmany -m $DIR/$tdir/$tfile $NFILES
1366 local t=$(ls $DIR/$tdir | wc -l)
1367 local u=$(ls $DIR/$tdir | sort -u | wc -l)
1368 local v=$(ls -ai $DIR/$tdir | sort -u | wc -l)
1369 if [ $t -ne $NFILES ] || [ $u -ne $NFILES ] ||
1370 [ $v -ne $((NFILES + 2)) ] ; then
1371 error "Expected $NFILES files, got $t ($u unique $v .&..)"
1374 simple_cleanup_common || error "Can not delete directories"
1376 run_test 24A "readdir() returns correct number of entries."
1378 test_24B() { # LU-4805
1379 [ $MDSCOUNT -lt 2 ] && skip_env "needs >= 2 MDTs"
1383 test_mkdir $DIR/$tdir
1384 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir ||
1385 error "create striped dir failed"
1387 count=$(ls -ai $DIR/$tdir/striped_dir | wc -l)
1388 [ $count -eq 2 ] || error "Expected 2, got $count"
1390 touch $DIR/$tdir/striped_dir/a
1392 count=$(ls -ai $DIR/$tdir/striped_dir | wc -l)
1393 [ $count -eq 3 ] || error "Expected 3, got $count"
1395 touch $DIR/$tdir/striped_dir/.f
1397 count=$(ls -ai $DIR/$tdir/striped_dir | wc -l)
1398 [ $count -eq 4 ] || error "Expected 4, got $count"
1400 rm -rf $DIR/$tdir || error "Can not delete directories"
1402 run_test 24B "readdir for striped dir return correct number of entries"
1405 [ $MDSCOUNT -lt 2 ] && skip_env "needs >= 2 MDTs"
1411 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/d0/striped_dir ||
1412 error "create striped dir failed"
1414 cd $DIR/$tdir/d0/striped_dir
1416 local d0_ino=$(ls -i -l -a $DIR/$tdir | grep "d0" | awk '{print $1}')
1417 local d1_ino=$(ls -i -l -a $DIR/$tdir | grep "d1" | awk '{print $1}')
1418 local parent_ino=$(ls -i -l -a | grep "\.\." | awk '{print $1}')
1420 [ "$d0_ino" = "$parent_ino" ] ||
1421 error ".. wrong, expect $d0_ino, get $parent_ino"
1423 mv $DIR/$tdir/d0/striped_dir $DIR/$tdir/d1/ ||
1424 error "mv striped dir failed"
1426 parent_ino=$(ls -i -l -a | grep "\.\." | awk '{print $1}')
1428 [ "$d1_ino" = "$parent_ino" ] ||
1429 error ".. wrong after mv, expect $d1_ino, get $parent_ino"
1431 run_test 24C "check .. in striped dir"
1434 [[ $MDSCOUNT -lt 4 ]] && skip_env "needs >= 4 MDTs"
1435 [ $PARALLEL == "yes" ] && skip "skip parallel run"
1438 mkdir $DIR/$tdir/src_dir
1439 $LFS mkdir -i 1 $DIR/$tdir/src_dir/src_child ||
1440 error "create remote source failed"
1442 touch $DIR/$tdir/src_dir/src_child/a
1444 $LFS mkdir -i 2 $DIR/$tdir/tgt_dir ||
1445 error "create remote target dir failed"
1447 $LFS mkdir -i 3 $DIR/$tdir/tgt_dir/tgt_child ||
1448 error "create remote target child failed"
1450 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
1451 error "rename dir cross MDT failed!"
1455 $CHECKSTAT -t dir $DIR/$tdir/src_dir/src_child &&
1456 error "src_child still exists after rename"
1458 $CHECKSTAT -t file $DIR/$tdir/tgt_dir/tgt_child/a ||
1459 error "missing file(a) after rename"
1461 rm -rf $DIR/$tdir || error "Can not delete directories"
1463 run_test 24E "cross MDT rename/link"
1466 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1469 [ "$SLOW" = "no" ] && repeats=100
1473 echo "$repeats repeats"
1474 for ((i = 0; i < repeats; i++)); do
1475 $LFS mkdir -i0 -c2 $DIR/$tdir/test || error "mkdir fails"
1476 touch $DIR/$tdir/test/a || error "touch fails"
1477 mkdir $DIR/$tdir/test/b || error "mkdir fails"
1478 rm -rf $DIR/$tdir/test || error "rmdir fails"
1483 run_test 24F "hash order vs readdir (LU-11330)"
1486 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
1491 $LFS mkdir -i 0 $DIR/$tdir-0 || error "mkdir $tdir-0"
1492 $LFS mkdir -i 1 $DIR/$tdir-1 || error "mkdir $tdir-1"
1493 touch $DIR/$tdir-0/f1 || error "touch f1"
1494 ln -s $DIR/$tdir-0/f1 $DIR/$tdir-0/s1 || error "ln s1"
1495 ino1=$(stat -c%i $DIR/$tdir-0/s1)
1496 mv $DIR/$tdir-0/s1 $DIR/$tdir-1 || error "mv s1"
1497 ino2=$(stat -c%i $DIR/$tdir-1/s1)
1498 [ $ino1 -ne $ino2 ] || error "s1 should be migrated"
1500 run_test 24G "migrate symlink in rename"
1503 echo '== symlink sanity ============================================='
1507 touch $DIR/s25/foo ||
1508 error "File creation in symlinked directory failed"
1510 run_test 25a "create file in symlinked directory ==============="
1513 [ ! -d $DIR/d25 ] && test_25a
1514 $CHECKSTAT -t file $DIR/s25/foo || error "$DIR/s25/foo not file type"
1516 run_test 25b "lookup file in symlinked directory ==============="
1520 test_mkdir $DIR/d26/d26-2
1521 ln -s d26/d26-2 $DIR/s26
1522 touch $DIR/s26/foo || error "File creation failed"
1524 run_test 26a "multiple component symlink ======================="
1527 test_mkdir -p $DIR/$tdir/d26-2
1528 ln -s $tdir/d26-2/foo $DIR/s26-2
1529 touch $DIR/s26-2 || error "File creation failed"
1531 run_test 26b "multiple component symlink at end of lookup ======"
1534 test_mkdir $DIR/d26.2
1535 touch $DIR/d26.2/foo
1536 ln -s d26.2 $DIR/s26.2-1
1537 ln -s s26.2-1 $DIR/s26.2-2
1538 ln -s s26.2-2 $DIR/s26.2-3
1539 chmod 0666 $DIR/s26.2-3/foo
1541 run_test 26c "chain of symlinks"
1543 # recursive symlinks (bug 439)
1545 ln -s d26-3/foo $DIR/d26-3
1547 run_test 26d "create multiple component recursive symlink"
1550 [ ! -h $DIR/d26-3 ] && test_26d
1553 run_test 26e "unlink multiple component recursive symlink"
1555 # recursive symlinks (bug 7022)
1557 test_mkdir $DIR/$tdir
1558 test_mkdir $DIR/$tdir/$tfile
1559 cd $DIR/$tdir/$tfile || error "cd $DIR/$tdir/$tfile failed"
1560 test_mkdir -p lndir/bar1
1561 test_mkdir $DIR/$tdir/$tfile/$tfile
1562 cd $tfile || error "cd $tfile failed"
1563 ln -s .. dotdot || error "ln dotdot failed"
1564 ln -s dotdot/lndir lndir || error "ln lndir failed"
1565 cd $DIR/$tdir || error "cd $DIR/$tdir failed"
1566 output=`ls $tfile/$tfile/lndir/bar1`
1567 [ "$output" = bar1 ] && error "unexpected output"
1568 rm -r $tfile || error "rm $tfile failed"
1569 $CHECKSTAT -a $DIR/$tfile || error "$tfile not gone"
1571 run_test 26f "rm -r of a directory which has recursive symlink"
1574 test_mkdir $DIR/$tdir
1575 $LFS getstripe $DIR/$tdir
1576 $LFS setstripe -c 1 $DIR/$tdir/$tfile || error "setstripe failed"
1577 $CHECKSTAT -t file $DIR/$tdir/$tfile || error "checkstat failed"
1578 cp /etc/hosts $DIR/$tdir/$tfile || error "Can't copy to one stripe file"
1580 run_test 27a "one stripe file"
1583 [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
1585 test_mkdir $DIR/$tdir
1586 $LFS setstripe -c 2 $DIR/$tdir/$tfile || error "setstripe failed"
1587 $LFS getstripe -c $DIR/$tdir/$tfile
1588 [ $($LFS getstripe -c $DIR/$tdir/$tfile) -eq 2 ] ||
1589 error "two-stripe file doesn't have two stripes"
1591 dd if=/dev/zero of=$DIR/$tdir/$tfile bs=4k count=4 || error "dd failed"
1593 run_test 27b "create and write to two stripe file"
1595 # 27c family tests specific striping, setstripe -o
1597 [[ $OSTCOUNT -lt 2 ]] && skip_env "skipping 2-stripe test"
1598 test_mkdir -p $DIR/$tdir
1601 $LFS setstripe -o $osts $DIR/$tdir/$tfile || error "setstripe failed"
1602 $LFS getstripe -i $DIR/$tdir/$tfile
1603 [ $($LFS getstripe -i $DIR/$tdir/$tfile ) -eq $osts ] ||
1604 error "stripe not on specified OST"
1606 dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 || error "dd failed"
1608 run_test 27ca "one stripe on specified OST"
1611 [[ $OSTCOUNT -lt 2 ]] && skip_env "skipping 2-stripe test"
1612 test_mkdir -p $DIR/$tdir
1614 $LFS setstripe -o $osts $DIR/$tdir/$tfile || error "setstripe failed"
1615 local getstripe=$($LFS getstripe $DIR/$tdir/$tfile)
1618 # Strip getstripe output to a space separated list of OSTs
1619 local getstripe_osts=$(echo "$getstripe" | sed -e '1,/obdidx/d' |\
1620 awk '{print $1}' | tr '\n' ' ' | sed -e 's/[[:space:]]*$//')
1621 [ "$getstripe_osts" = "${osts//,/ }" ] ||
1622 error "stripes not on specified OSTs"
1624 dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 || error "dd failed"
1626 run_test 27cb "two stripes on specified OSTs"
1629 [[ $OSTCOUNT -lt 2 ]] && skip_env "skipping 2-stripe test"
1630 [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] ||
1631 skip "server does not support overstriping"
1633 test_mkdir -p $DIR/$tdir
1635 $LFS setstripe -o $osts $DIR/$tdir/$tfile || error "setstripe failed"
1636 local getstripe=$($LFS getstripe $DIR/$tdir/$tfile)
1639 # Strip getstripe output to a space separated list of OSTs
1640 local getstripe_osts=$(echo "$getstripe" | sed -e '1,/obdidx/d' |\
1641 awk '{print $1}' | tr '\n' ' ' | sed -e 's/[[:space:]]*$//')
1642 [ "$getstripe_osts" = "${osts//,/ }" ] ||
1643 error "stripes not on specified OSTs"
1645 dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 || error "dd failed"
1647 run_test 27cc "two stripes on the same OST"
1650 [[ $OSTCOUNT -lt 2 ]] && skip_env "skipping 2-stripe test"
1651 [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] ||
1652 skip "server does not support overstriping"
1653 test_mkdir -p $DIR/$tdir
1654 local osts="0,1,1,0"
1655 $LFS setstripe -o $osts $DIR/$tdir/$tfile || error "setstripe failed"
1656 local getstripe=$($LFS getstripe $DIR/$tdir/$tfile)
1659 # Strip getstripe output to a space separated list of OSTs
1660 local getstripe_osts=$(echo "$getstripe" | sed -e '1,/obdidx/d' |\
1661 awk '{print $1}' | tr '\n' ' ' | sed -e 's/[[:space:]]*$//')
1662 [ "$getstripe_osts" = "${osts//,/ }" ] ||
1663 error "stripes not on specified OSTs"
1665 dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 || error "dd failed"
1667 run_test 27cd "four stripes on two OSTs"
1670 [[ $OSTCOUNT -ge $(($LOV_MAX_STRIPE_COUNT / 2)) ]] &&
1671 skip_env "too many osts, skipping"
1672 [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] ||
1673 skip "server does not support overstriping"
1674 # We do one more stripe than we have OSTs
1675 [ $OSTCOUNT -lt 159 ] || large_xattr_enabled ||
1676 skip_env "ea_inode feature disabled"
1678 test_mkdir -p $DIR/$tdir
1680 for i in $(seq 0 $OSTCOUNT);
1683 if [ $i -ne $OSTCOUNT ]; then
1687 $LFS setstripe -o $osts $DIR/$tdir/$tfile || error "setstripe failed"
1688 local getstripe=$($LFS getstripe $DIR/$tdir/$tfile)
1691 # Strip getstripe output to a space separated list of OSTs
1692 local getstripe_osts=$(echo "$getstripe" | sed -e '1,/obdidx/d' |\
1693 awk '{print $1}' | tr '\n' ' ' | sed -e 's/[[:space:]]*$//')
1694 [ "$getstripe_osts" = "${osts//,/ }" ] ||
1695 error "stripes not on specified OSTs"
1697 dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 || error "dd failed"
1699 run_test 27ce "more stripes than OSTs with -o"
1702 local osp_proc="osp.$FSNAME-OST0000-osc-MDT000*.active"
1705 test_mkdir -p $DIR/$tdir || error "failed to mkdir $DIR/$tdir"
1706 do_facet $SINGLEMDS "$LCTL set_param -n $osp_proc=0"
1707 stack_trap "do_facet $SINGLEMDS $LCTL set_param -n $osp_proc=1" EXIT
1708 wait_update_facet $SINGLEMDS "$LCTL get_param -n $osp_proc | grep 1" ||
1709 error "failed to set $osp_proc=0"
1711 $LFS setstripe -o 0 $DIR/$tdir/$tfile &
1714 do_facet $SINGLEMDS "$LCTL set_param -n $osp_proc=1"
1715 wait_update_facet $SINGLEMDS "$LCTL get_param -n $osp_proc | grep 0" ||
1716 error "failed to set $osp_proc=1"
1719 error "should return error due to $osp_proc=0"
1721 run_test 27cf "'setstripe -o' on inactive OSTs should return error"
1724 test_mkdir $DIR/$tdir
1725 $LFS setstripe -c 0 -i -1 -S 0 $DIR/$tdir/$tfile ||
1726 error "setstripe failed"
1727 $CHECKSTAT -t file $DIR/$tdir/$tfile || error "checkstat failed"
1728 dd if=/dev/zero of=$DIR/$tdir/$tfile bs=4k count=4 || error "dd failed"
1730 run_test 27d "create file with default settings"
1733 # LU-5839 adds check for existed layout before setting it
1734 [[ $MDS1_VERSION -lt $(version_code 2.7.56) ]] &&
1735 skip "Need MDS version at least 2.7.56"
1737 test_mkdir $DIR/$tdir
1738 $LFS setstripe -c 2 $DIR/$tdir/$tfile || error "setstripe failed"
1739 $LFS setstripe -c 2 $DIR/$tdir/$tfile && error "setstripe worked twice"
1740 $CHECKSTAT -t file $DIR/$tdir/$tfile || error "checkstat failed"
1742 run_test 27e "setstripe existing file (should return error)"
1745 test_mkdir $DIR/$tdir
1746 $LFS setstripe -S 100 -i 0 -c 1 $DIR/$tdir/$tfile &&
1747 error "$LFS setstripe $DIR/$tdir/$tfile failed"
1748 $CHECKSTAT -t file $DIR/$tdir/$tfile &&
1749 error "$CHECKSTAT -t file $DIR/$tdir/$tfile should fail"
1750 dd if=/dev/zero of=$DIR/$tdir/$tfile bs=4k count=4 || error "dd failed"
1751 $LFS getstripe $DIR/$tdir/$tfile || error "$LFS getstripe failed"
1753 run_test 27f "setstripe with bad stripe size (should return error)"
1756 test_mkdir $DIR/$tdir
1757 $MCREATE $DIR/$tdir/$tfile || error "mcreate failed"
1758 $LFS getstripe $DIR/$tdir/$tfile 2>&1 | grep "no stripe info" ||
1759 error "$DIR/$tdir/$tfile has object"
1761 run_test 27g "$LFS getstripe with no objects"
1764 test_mkdir $DIR/$tdir
1765 touch $DIR/$tdir/$tfile || error "touch failed"
1766 ln -s bogus $DIR/$tdir/$tfile.2 || error "ln failed"
1767 $LFS getstripe -m $DIR/$tdir/$tfile $DIR/$tdir/$tfile.2
1769 (( rc == 2 )) || error "getstripe did not return ENOENT"
1771 run_test 27ga "$LFS getstripe with missing file (should return error)"
1774 test_mkdir $DIR/$tdir
1775 touch $DIR/$tdir/$tfile || error "touch failed"
1776 [[ $($LFS getstripe -c $DIR/$tdir/$tfile) -gt 0 ]] ||
1777 error "missing objects"
1779 run_test 27i "$LFS getstripe with some objects"
1782 test_mkdir $DIR/$tdir
1783 $LFS setstripe -i $OSTCOUNT $DIR/$tdir/$tfile &&
1784 error "setstripe failed" || true
1786 run_test 27j "setstripe with bad stripe offset (should return error)"
1788 test_27k() { # bug 2844
1789 test_mkdir $DIR/$tdir
1790 local file=$DIR/$tdir/$tfile
1791 local ll_max_blksize=$((4 * 1024 * 1024))
1792 $LFS setstripe -S 67108864 $file || error "setstripe failed"
1793 local blksize=$(stat $file | awk '/IO Block:/ { print $7 }')
1794 [ $blksize -le $ll_max_blksize ] || error "1:$blksize > $ll_max_blksize"
1795 dd if=/dev/zero of=$file bs=4k count=1
1796 blksize=$(stat $file | awk '/IO Block:/ { print $7 }')
1797 [ $blksize -le $ll_max_blksize ] || error "2:$blksize > $ll_max_blksize"
1799 run_test 27k "limit i_blksize for broken user apps"
1802 mcreate $DIR/$tfile || error "creating file"
1803 $RUNAS $LFS setstripe -c 1 $DIR/$tfile &&
1804 error "setstripe should have failed" || true
1806 run_test 27l "check setstripe permissions (should return error)"
1809 [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
1811 [ -n "$RCLIENTS" -o -n "$MOUNT_2" ] &&
1812 skip_env "multiple clients -- skipping"
1814 ORIGFREE=$($LCTL get_param -n lov.$FSNAME-clilov-*.kbytesavail |
1816 if [[ $ORIGFREE -gt $MAXFREE ]]; then
1817 skip "$ORIGFREE > $MAXFREE skipping out-of-space test on OST0"
1819 trap simple_cleanup_common EXIT
1820 test_mkdir $DIR/$tdir
1821 $LFS setstripe -i 0 -c 1 $DIR/$tdir/$tfile.1
1822 dd if=/dev/zero of=$DIR/$tdir/$tfile.1 bs=1024 count=$MAXFREE &&
1823 error "dd should fill OST0"
1825 while $LFS setstripe -i 0 -c 1 $DIR/$tdir/$tfile.$i; do
1827 [ $i -gt 256 ] && break
1830 touch $DIR/$tdir/$tfile.$i
1831 [ $($LFS getstripe $DIR/$tdir/$tfile.$i | grep -A 10 obdidx |
1832 awk '{print $1}'| grep -w "0") ] &&
1833 error "OST0 was full but new created file still use it"
1835 touch $DIR/$tdir/$tfile.$i
1836 [ $($LFS getstripe $DIR/$tdir/$tfile.$i | grep -A 10 obdidx |
1837 awk '{print $1}'| grep -w "0") ] &&
1838 error "OST0 was full but new created file still use it"
1839 simple_cleanup_common
1841 run_test 27m "create file while OST0 was full"
1843 # OSCs keep a NOSPC flag that will be reset after ~5s (qos_maxage)
1844 # if the OST isn't full anymore.
1846 local ostidx=${1:-""}
1851 local list=$(comma_list $(osts_nodes))
1852 [ "$ostidx" ] && list=$(facet_host ost$((ostidx + 1)))
1854 do_nodes $list lctl set_param fail_loc=0
1855 wait_delete_completed # initiate all OST_DESTROYs from MDS to OST
1856 delay=$(do_facet $SINGLEMDS lctl get_param -n lov.*.qos_maxage |
1857 awk '{print $1 * 2;exit;}')
1858 get_prealloc="$LCTL get_param -n osc.*MDT*.prealloc_status |
1860 wait_update_facet $SINGLEMDS "$get_prealloc" "" $delay
1864 [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
1865 [ $PARALLEL == "yes" ] && skip "skip parallel run"
1866 remote_mds_nodsh && skip "remote MDS with nodsh"
1867 remote_ost_nodsh && skip "remote OST with nodsh"
1870 rm -f $DIR/$tdir/$tfile
1871 exhaust_precreations 0 0x80000215
1872 $LFS setstripe -c -1 $DIR/$tdir || error "setstripe failed"
1873 touch $DIR/$tdir/$tfile || error "touch failed"
1874 $LFS getstripe $DIR/$tdir/$tfile
1877 run_test 27n "create file with some full OSTs"
1880 [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
1881 [ $PARALLEL == "yes" ] && skip "skip parallel run"
1882 remote_mds_nodsh && skip "remote MDS with nodsh"
1883 remote_ost_nodsh && skip "remote OST with nodsh"
1886 rm -f $DIR/$tdir/$tfile
1887 exhaust_all_precreations 0x215
1889 touch $DIR/$tdir/$tfile && error "able to create $DIR/$tdir/$tfile"
1894 run_test 27o "create file with all full OSTs (should error)"
1896 function create_and_checktime() {
1901 for ((i=0; i < $loops; i++)); do
1902 local start=$SECONDS
1903 multiop $fname-$i Oc
1904 ((SECONDS-start < TIMEOUT)) ||
1905 error "creation took " $((SECONDS-$start)) && return 1
1910 local mdts=$(comma_list $(mdts_nodes))
1912 [ $MDS1_VERSION -lt $(version_code 2.13.57) ] &&
1913 skip "Need MDS version at least 2.13.57"
1915 local f0=$DIR/${tfile}-0
1916 local f1=$DIR/${tfile}-1
1918 wait_delete_completed
1920 # refill precreated objects
1921 $LFS setstripe -i0 -c1 $f0
1923 saved=$(do_facet mds1 $LCTL get_param -n lov.*0000*.qos_threshold_rr)
1924 # force QoS allocation policy
1925 do_nodes $mdts $LCTL set_param lov.*.qos_threshold_rr=0%
1926 stack_trap "do_nodes $mdts $LCTL set_param \
1927 lov.*.qos_threshold_rr=$saved" EXIT
1930 # one OST is unavailable, but still have few objects preallocated
1932 stack_trap "start ost1 $(ostdevname 1) $OST_MOUNT_OPTS; \
1933 rm -rf $f1 $DIR/$tdir*" EXIT
1935 for ((i=0; i < 7; i++)); do
1936 mkdir $DIR/$tdir$i || error "can't create dir"
1937 $LFS setstripe -c$((OSTCOUNT-1)) $DIR/$tdir$i ||
1938 error "can't set striping"
1940 for ((i=0; i < 7; i++)); do
1941 create_and_checktime $DIR/$tdir$i/$tfile 100 &
1945 run_test 27oo "don't let few threads to reserve too many objects"
1948 [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
1949 [ $PARALLEL == "yes" ] && skip "skip parallel run"
1950 remote_mds_nodsh && skip "remote MDS with nodsh"
1951 remote_ost_nodsh && skip "remote OST with nodsh"
1954 rm -f $DIR/$tdir/$tfile
1955 test_mkdir $DIR/$tdir
1957 $MCREATE $DIR/$tdir/$tfile || error "mcreate failed"
1958 $TRUNCATE $DIR/$tdir/$tfile 80000000 || error "truncate failed"
1959 $CHECKSTAT -s 80000000 $DIR/$tdir/$tfile || error "checkstat failed"
1961 exhaust_precreations 0 0x80000215
1962 echo foo >> $DIR/$tdir/$tfile || error "append failed"
1963 $CHECKSTAT -s 80000004 $DIR/$tdir/$tfile || error "checkstat failed"
1964 $LFS getstripe $DIR/$tdir/$tfile
1968 run_test 27p "append to a truncated file with some full OSTs"
1971 [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
1972 [ $PARALLEL == "yes" ] && skip "skip parallel run"
1973 remote_mds_nodsh && skip "remote MDS with nodsh"
1974 remote_ost_nodsh && skip "remote OST with nodsh"
1977 rm -f $DIR/$tdir/$tfile
1979 mkdir_on_mdt0 $DIR/$tdir
1980 $MCREATE $DIR/$tdir/$tfile || error "mcreate $DIR/$tdir/$tfile failed"
1981 $TRUNCATE $DIR/$tdir/$tfile 80000000 ||
1982 error "truncate $DIR/$tdir/$tfile failed"
1983 $CHECKSTAT -s 80000000 $DIR/$tdir/$tfile || error "checkstat failed"
1985 exhaust_all_precreations 0x215
1987 echo foo >> $DIR/$tdir/$tfile && error "append succeeded"
1988 $CHECKSTAT -s 80000000 $DIR/$tdir/$tfile || error "checkstat 2 failed"
1992 run_test 27q "append to truncated file with all OSTs full (should error)"
1995 [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
1996 [ $PARALLEL == "yes" ] && skip "skip parallel run"
1997 remote_mds_nodsh && skip "remote MDS with nodsh"
1998 remote_ost_nodsh && skip "remote OST with nodsh"
2001 rm -f $DIR/$tdir/$tfile
2002 exhaust_precreations 0 0x80000215
2004 $LFS setstripe -i 0 -c 2 $DIR/$tdir/$tfile || error "setstripe failed"
2008 run_test 27r "stripe file with some full OSTs (shouldn't LBUG) ="
2010 test_27s() { # bug 10725
2011 test_mkdir $DIR/$tdir
2012 local stripe_size=$((4096 * 1024 * 1024)) # 2^32
2013 local stripe_count=0
2014 [ $OSTCOUNT -eq 1 ] || stripe_count=2
2015 $LFS setstripe -S $stripe_size -c $stripe_count $DIR/$tdir &&
2016 error "stripe width >= 2^32 succeeded" || true
2019 run_test 27s "lsm_xfersize overflow (should error) (bug 10725)"
2021 test_27t() { # bug 10864
2026 $WLFS getstripe $tfile
2029 run_test 27t "check that utils parse path correctly"
2031 test_27u() { # bug 4900
2032 [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
2033 remote_mds_nodsh && skip "remote MDS with nodsh"
2036 local list=$(comma_list $(mdts_nodes))
2038 #define OBD_FAIL_MDS_OSC_PRECREATE 0x139
2039 do_nodes $list $LCTL set_param fail_loc=0x139
2040 test_mkdir -p $DIR/$tdir
2041 trap simple_cleanup_common EXIT
2042 createmany -o $DIR/$tdir/t- 1000
2043 do_nodes $list $LCTL set_param fail_loc=0
2045 TLOG=$TMP/$tfile.getstripe
2046 $LFS getstripe $DIR/$tdir > $TLOG
2047 OBJS=$(awk -vobj=0 '($1 == 0) { obj += 1 } END { print obj; }' $TLOG)
2048 unlinkmany $DIR/$tdir/t- 1000
2050 [[ $OBJS -gt 0 ]] &&
2051 error "$OBJS objects created on OST-0. See $TLOG" ||
2054 run_test 27u "skip object creation on OSC w/o objects"
2056 test_27v() { # bug 4900
2057 [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
2058 [ $PARALLEL == "yes" ] && skip "skip parallel run"
2059 remote_mds_nodsh && skip "remote MDS with nodsh"
2060 remote_ost_nodsh && skip "remote OST with nodsh"
2062 exhaust_all_precreations 0x215
2065 $LFS setstripe -c 1 $DIR/$tdir # 1 stripe / file
2067 touch $DIR/$tdir/$tfile
2068 #define OBD_FAIL_TGT_DELAY_PRECREATE 0x705
2070 for (( i=1; i < OSTCOUNT; i++ )); do
2071 do_facet ost$i lctl set_param fail_loc=0x705
2073 local START=`date +%s`
2074 createmany -o $DIR/$tdir/$tfile 32
2076 local FINISH=`date +%s`
2077 local TIMEOUT=`lctl get_param -n timeout`
2078 local PROCESS=$((FINISH - START))
2079 [ $PROCESS -ge $((TIMEOUT / 2)) ] && \
2080 error "$FINISH - $START >= $TIMEOUT / 2"
2081 sleep $((TIMEOUT / 2 - PROCESS))
2084 run_test 27v "skip object creation on slow OST"
2086 test_27w() { # bug 10997
2087 test_mkdir $DIR/$tdir
2088 $LFS setstripe -S 65536 $DIR/$tdir/f0 || error "setstripe failed"
2089 [ $($LFS getstripe -S $DIR/$tdir/f0) -ne 65536 ] &&
2090 error "stripe size $size != 65536" || true
2091 [ $($LFS getstripe -d $DIR/$tdir | grep -c "stripe_count") -eq 0 ] &&
2092 error "$LFS getstripe -d $DIR/$tdir no 'stripe_count'" || true
2094 run_test 27w "check $LFS setstripe -S and getstrip -d options"
2097 [[ $OSTCOUNT -lt 2 ]] &&
2098 skip_env "skipping multiple stripe count/offset test"
2100 test_mkdir $DIR/$tdir
2101 for i in $(seq 1 $OSTCOUNT); do
2103 $LFS setstripe -c $i -i $offset $DIR/$tdir/f$i ||
2104 error "setstripe -c $i -i $offset failed"
2105 count=$($LFS getstripe -c $DIR/$tdir/f$i)
2106 index=$($LFS getstripe -i $DIR/$tdir/f$i)
2107 [ $count -ne $i ] && error "stripe count $count != $i" || true
2108 [ $index -ne $offset ] &&
2109 error "stripe offset $index != $offset" || true
2112 run_test 27wa "check $LFS setstripe -c -i options"
2115 remote_ost_nodsh && skip "remote OST with nodsh"
2116 [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
2117 [ $PARALLEL == "yes" ] && skip "skip parallel run"
2119 OFFSET=$(($OSTCOUNT - 1))
2121 local OST=$(ostname_from_index $OSTIDX)
2123 test_mkdir $DIR/$tdir
2124 $LFS setstripe -c 1 $DIR/$tdir # 1 stripe per file
2125 do_facet ost$((OSTIDX + 1)) lctl set_param -n obdfilter.$OST.degraded 1
2127 createmany -o $DIR/$tdir/$tfile $OSTCOUNT
2128 for i in $(seq 0 $OFFSET); do
2129 [ $($LFS getstripe $DIR/$tdir/$tfile$i | grep -A 10 obdidx |
2130 awk '{print $1}' | grep -w "$OSTIDX") ] &&
2131 error "OST0 was degraded but new created file still use it"
2133 do_facet ost$((OSTIDX + 1)) lctl set_param -n obdfilter.$OST.degraded 0
2135 run_test 27x "create files while OST0 is degraded"
2138 [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
2139 remote_mds_nodsh && skip "remote MDS with nodsh"
2140 remote_ost_nodsh && skip "remote OST with nodsh"
2141 [ $PARALLEL == "yes" ] && skip "skip parallel run"
2143 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $FSNAME-OST0000)
2144 local last_id=$(do_facet $SINGLEMDS lctl get_param -n \
2145 osp.$mdtosc.prealloc_last_id)
2146 local next_id=$(do_facet $SINGLEMDS lctl get_param -n \
2147 osp.$mdtosc.prealloc_next_id)
2148 local fcount=$((last_id - next_id))
2149 [[ $fcount -eq 0 ]] && skip "not enough space on OST0"
2150 [[ $fcount -gt $OSTCOUNT ]] && fcount=$OSTCOUNT
2152 local MDS_OSCS=$(do_facet $SINGLEMDS lctl dl |
2153 awk '/[oO][sS][cC].*md[ts]/ { print $4 }')
2154 local OST_DEACTIVE_IDX=-1
2159 for OSC in $MDS_OSCS; do
2160 OST=$(osc_to_ost $OSC)
2161 OSTIDX=$(index_from_ostuuid $OST)
2162 if [ $OST_DEACTIVE_IDX == -1 ]; then
2163 OST_DEACTIVE_IDX=$OSTIDX
2165 if [ $OSTIDX != $OST_DEACTIVE_IDX ]; then
2166 echo $OSC "is Deactivated:"
2167 do_facet $SINGLEMDS lctl --device %$OSC deactivate
2171 OSTIDX=$(index_from_ostuuid $OST)
2172 test_mkdir $DIR/$tdir
2173 $LFS setstripe -c 1 $DIR/$tdir # 1 stripe / file
2175 for OSC in $MDS_OSCS; do
2176 OST=$(osc_to_ost $OSC)
2177 OSTIDX=$(index_from_ostuuid $OST)
2178 if [ $OSTIDX == $OST_DEACTIVE_IDX ]; then
2179 echo $OST "is degraded:"
2180 do_facet ost$((OSTIDX+1)) lctl set_param -n \
2181 obdfilter.$OST.degraded=1
2186 createmany -o $DIR/$tdir/$tfile $fcount
2188 for OSC in $MDS_OSCS; do
2189 OST=$(osc_to_ost $OSC)
2190 OSTIDX=$(index_from_ostuuid $OST)
2191 if [ $OSTIDX == $OST_DEACTIVE_IDX ]; then
2192 echo $OST "is recovered from degraded:"
2193 do_facet ost$((OSTIDX+1)) lctl set_param -n \
2194 obdfilter.$OST.degraded=0
2196 do_facet $SINGLEMDS lctl --device %$OSC activate
2200 # all osp devices get activated, hence -1 stripe count restored
2201 local stripe_count=0
2203 # sleep 2*lod_qos_maxage seconds waiting for lod qos to notice osp
2204 # devices get activated.
2206 $LFS setstripe -c -1 $DIR/$tfile
2207 stripe_count=$($LFS getstripe -c $DIR/$tfile)
2209 [ $stripe_count -ne $OSTCOUNT ] &&
2210 error "Of $OSTCOUNT OSTs, only $stripe_count is available"
2213 run_test 27y "create files while OST0 is degraded and the rest inactive"
2219 lmm_count=$($LFS getstripe -c $1)
2220 lmm_seq=$($LFS getstripe -v $1 | awk '/lmm_seq/ { print $2 }')
2221 lmm_oid=$($LFS getstripe -v $1 | awk '/lmm_object_id/ { print $2 }')
2223 local old_ifs="$IFS"
2225 fid=($($LFS path2fid $1))
2228 log "FID seq ${fid[1]}, oid ${fid[2]} ver ${fid[3]}"
2229 log "LOV seq $lmm_seq, oid $lmm_oid, count: $lmm_count"
2231 # compare lmm_seq and lu_fid->f_seq
2232 [ $lmm_seq = ${fid[1]} ] || { error "SEQ mismatch"; return 1; }
2233 # compare lmm_object_id and lu_fid->oid
2234 [ $lmm_oid = ${fid[2]} ] || { error "OID mismatch"; return 2; }
2236 # check the trusted.fid attribute of the OST objects of the file
2237 local have_obdidx=false
2239 $LFS getstripe $1 | while read obdidx oid hex seq; do
2240 # skip lines up to and including "obdidx"
2241 [ -z "$obdidx" ] && break
2242 [ "$obdidx" = "obdidx" ] && have_obdidx=true && continue
2243 $have_obdidx || continue
2245 local ost=$((obdidx + 1))
2246 local dev=$(ostdevname $ost)
2249 log "want: stripe:$stripe_nr ost:$obdidx oid:$oid/$hex seq:$seq"
2251 seq=$(echo $seq | sed -e "s/^0x//g")
2252 if [ $seq == 0 ] || [ $(facet_fstype ost$ost) == zfs ]; then
2253 oid_hex=$(echo $oid)
2255 oid_hex=$(echo $hex | sed -e "s/^0x//g")
2257 local obj_file="O/$seq/d$((oid %32))/$oid_hex"
2261 # Don't unmount/remount the OSTs if we don't need to do that.
2262 # LU-2577 changes filter_fid to be smaller, so debugfs needs
2263 # update too, until that use mount/ll_decode_filter_fid/mount.
2264 # Re-enable when debugfs will understand new filter_fid.
2266 if [ $(facet_fstype ost$ost) == ldiskfs ]; then
2267 ff=$(do_facet ost$ost "$DEBUGFS -c -R 'stat $obj_file' \
2268 $dev 2>/dev/null" | grep "parent=")
2270 if [ -z "$ff" ]; then
2272 mount_fstype ost$ost
2273 ff=$(do_facet ost$ost $LL_DECODE_FILTER_FID \
2274 $(facet_mntpt ost$ost)/$obj_file)
2275 unmount_fstype ost$ost
2276 start ost$ost $dev $OST_MOUNT_OPTS
2280 [ -z "$ff" ] && error "$obj_file: no filter_fid info"
2282 echo "$ff" | sed -e 's#.*objid=#got: objid=#'
2284 # /mnt/O/0/d23/23: objid=23 seq=0 parent=[0x200000400:0x1e:0x1]
2285 # fid: objid=23 seq=0 parent=[0x200000400:0x1e:0x0] stripe=1
2287 # fid: parent=[0x200000400:0x1e:0x0] stripe=1 stripe_count=2 \
2288 # stripe_size=1048576 component_id=1 component_start=0 \
2289 # component_end=33554432
2290 local ff_parent=$(sed -e 's/.*parent=.//' <<<$ff)
2291 local ff_pseq=$(cut -d: -f1 <<<$ff_parent)
2292 local ff_poid=$(cut -d: -f2 <<<$ff_parent)
2294 if grep -q 'stripe=' <<<$ff; then
2295 ff_pstripe=$(sed -e 's/.*stripe=//' -e 's/ .*//' <<<$ff)
2297 # $LL_DECODE_FILTER_FID does not print "stripe="; look
2298 # into f_ver in this case. See comment on ff_parent.
2299 ff_pstripe=$(cut -d: -f3 <<<$ff_parent | sed -e 's/]//')
2302 # compare lmm_seq and filter_fid->ff_parent.f_seq
2303 [ $ff_pseq = $lmm_seq ] ||
2304 error "FF parent SEQ $ff_pseq != $lmm_seq"
2305 # compare lmm_object_id and filter_fid->ff_parent.f_oid
2306 [ $ff_poid = $lmm_oid ] ||
2307 error "FF parent OID $ff_poid != $lmm_oid"
2308 (($ff_pstripe == $stripe_nr)) ||
2309 error "FF stripe $ff_pstripe != $stripe_nr"
2311 stripe_nr=$((stripe_nr + 1))
2312 [ $CLIENT_VERSION -lt $(version_code 2.9.55) ] &&
2314 if grep -q 'stripe_count=' <<<$ff; then
2315 local ff_scnt=$(sed -e 's/.*stripe_count=//' \
2316 -e 's/ .*//' <<<$ff)
2317 [ $lmm_count = $ff_scnt ] ||
2318 error "FF stripe count $lmm_count != $ff_scnt"
2324 [ $PARALLEL == "yes" ] && skip "skip parallel run"
2325 remote_ost_nodsh && skip "remote OST with nodsh"
2327 test_mkdir $DIR/$tdir
2328 $LFS setstripe -c 1 -i 0 -S 64k $DIR/$tdir/$tfile-1 ||
2329 { error "setstripe -c -1 failed"; return 1; }
2330 # We need to send a write to every object to get parent FID info set.
2331 # This _should_ also work for setattr, but does not currently.
2332 # touch $DIR/$tdir/$tfile-1 ||
2333 dd if=/dev/zero of=$DIR/$tdir/$tfile-1 bs=1M count=1 ||
2334 { error "dd $tfile-1 failed"; return 2; }
2335 $LFS setstripe -c -1 -i $((OSTCOUNT - 1)) -S 1M $DIR/$tdir/$tfile-2 ||
2336 { error "setstripe -c -1 failed"; return 3; }
2337 dd if=/dev/zero of=$DIR/$tdir/$tfile-2 bs=1M count=$OSTCOUNT ||
2338 { error "dd $tfile-2 failed"; return 4; }
2340 # make sure write RPCs have been sent to OSTs
2343 check_seq_oid $DIR/$tdir/$tfile-1 || return 5
2344 check_seq_oid $DIR/$tdir/$tfile-2 || return 6
2346 run_test 27z "check SEQ/OID on the MDT and OST filesystems"
2348 test_27A() { # b=19102
2349 [ $PARALLEL == "yes" ] && skip "skip parallel run"
2351 save_layout_restore_at_exit $MOUNT
2352 $LFS setstripe -c 0 -i -1 -S 0 $MOUNT
2353 wait_update $HOSTNAME "$LFS getstripe -c $MOUNT | sed 's/ *//g'" "1" 20 ||
2354 error "stripe count $($LFS getstripe -c $MOUNT) != 1"
2355 local default_size=$($LFS getstripe -S $MOUNT)
2356 local default_offset=$($LFS getstripe -i $MOUNT)
2357 local dsize=$(do_facet $SINGLEMDS \
2358 "$LCTL get_param -n lod.$(facet_svc $SINGLEMDS)*.stripesize")
2359 [ $default_size -eq $dsize ] ||
2360 error "stripe size $default_size != $dsize"
2361 [ $default_offset -eq -1 ] ||
2362 error "stripe offset $default_offset != -1"
2364 run_test 27A "check filesystem-wide default LOV EA values"
2366 test_27B() { # LU-2523
2367 test_mkdir $DIR/$tdir
2368 rm -f $DIR/$tdir/f0 $DIR/$tdir/f1
2370 # open f1 with O_LOV_DELAY_CREATE
2372 # call setstripe ioctl on open file descriptor for f1
2374 multiop $DIR/$tdir/f1 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:nB1c \
2378 # open f1 with O_LOV_DELAY_CREATE
2380 # call setstripe ioctl on open file descriptor for f1
2382 multiop $DIR/$tdir/f1 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:uB1c
2384 # Allow multiop to fail in imitation of NFS's busted semantics.
2387 run_test 27B "call setstripe on open unlinked file/rename victim"
2389 # 27C family tests full striping and overstriping
2390 test_27Ca() { #LU-2871
2391 [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
2399 test_mkdir $DIR/$tdir
2401 for i in $(seq 0 $((OSTCOUNT - 1))); do
2402 # set stripe across all OSTs starting from OST$i
2403 $LFS setstripe -i $i -c -1 $tfile$i
2404 # get striping information
2405 ost_idx=($($LFS getstripe $tfile$i |
2406 tail -n $((OSTCOUNT + 1)) | awk '{print $1}'))
2410 [ ${#ost_idx[@]} -eq $OSTCOUNT ] ||
2411 error "${#ost_idx[@]} != $OSTCOUNT"
2413 for index in $(seq 0 $((OSTCOUNT - 1))); do
2415 for j in $(echo ${ost_idx[@]}); do
2416 if [ $index -eq $j ]; then
2422 error "Can not find $index in ${ost_idx[@]}"
2426 run_test 27Ca "check full striping across all OSTs"
2429 [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] ||
2430 skip "server does not support overstriping"
2431 [[ $OSTCOUNT -ge $(($LOV_MAX_STRIPE_COUNT / 2)) ]] &&
2432 skip_env "too many osts, skipping"
2434 test_mkdir -p $DIR/$tdir
2435 local setcount=$(($OSTCOUNT * 2))
2436 [ $setcount -lt 160 ] || large_xattr_enabled ||
2437 skip_env "ea_inode feature disabled"
2439 $LFS setstripe -C $setcount $DIR/$tdir/$tfile ||
2440 error "setstripe failed"
2442 local count=$($LFS getstripe -c $DIR/$tdir/$tfile)
2443 [ $count -eq $setcount ] ||
2444 error "stripe count $count, should be $setcount"
2446 $LFS getstripe $DIR/$tdir/$tfile 2>&1 | grep "overstriped" ||
2447 error "overstriped should be set in pattern"
2449 dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 conv=notrunc ||
2452 run_test 27Cb "more stripes than OSTs with -C"
2455 [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] ||
2456 skip "server does not support overstriping"
2457 [[ $OSTCOUNT -lt 2 ]] && skip_env "need > 1 OST"
2459 test_mkdir -p $DIR/$tdir
2460 local setcount=$(($OSTCOUNT - 1))
2462 [ $setcount -lt 160 ] || large_xattr_enabled ||
2463 skip_env "ea_inode feature disabled"
2465 $LFS setstripe -C $setcount $DIR/$tdir/$tfile ||
2466 error "setstripe failed"
2468 local count=$($LFS getstripe -c $DIR/$tdir/$tfile)
2469 [ $count -eq $setcount ] ||
2470 error "stripe count $count, should be $setcount"
2472 $LFS getstripe $DIR/$tdir/$tfile 2>&1 | grep "overstriped" &&
2473 error "overstriped should not be set in pattern"
2475 dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 conv=notrunc ||
2478 run_test 27Cc "fewer stripes than OSTs does not set overstriping"
2481 [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] ||
2482 skip "server does not support overstriping"
2483 [[ $OSTCOUNT -lt 2 ]] && skip_env "need > 1 OST"
2484 large_xattr_enabled || skip_env "ea_inode feature disabled"
2486 test_mkdir -p $DIR/$tdir
2487 local setcount=$LOV_MAX_STRIPE_COUNT
2489 $LFS setstripe -C $setcount $DIR/$tdir/$tfile ||
2490 error "setstripe failed"
2492 local count=$($LFS getstripe -c $DIR/$tdir/$tfile)
2493 [ $count -eq $setcount ] ||
2494 error "stripe count $count, should be $setcount"
2496 $LFS getstripe $DIR/$tdir/$tfile 2>&1 | grep "overstriped" ||
2497 error "overstriped should be set in pattern"
2499 dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 conv=notrunc ||
2502 rm -f $DIR/$tdir/$tfile || error "Delete $tfile failed"
2504 run_test 27Cd "test maximum stripe count"
2507 [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] ||
2508 skip "server does not support overstriping"
2509 test_mkdir -p $DIR/$tdir
2511 pool_add $TESTNAME || error "Pool creation failed"
2512 pool_add_targets $TESTNAME 0 || error "pool_add_targets failed"
2516 $LFS setstripe -C $setcount -p "$TESTNAME" $DIR/$tdir/$tfile ||
2517 error "setstripe failed"
2519 local count=$($LFS getstripe -c $DIR/$tdir/$tfile)
2520 [ $count -eq $setcount ] ||
2521 error "stripe count $count, should be $setcount"
2523 $LFS getstripe $DIR/$tdir/$tfile 2>&1 | grep "overstriped" ||
2524 error "overstriped should be set in pattern"
2526 dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 conv=notrunc ||
2529 rm -f $DIR/$tdir/$tfile || error "Delete $tfile failed"
2531 run_test 27Ce "test pool with overstriping"
2534 [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] ||
2535 skip "server does not support overstriping"
2536 [[ $OSTCOUNT -ge $(($LOV_MAX_STRIPE_COUNT / 2)) ]] &&
2537 skip_env "too many osts, skipping"
2539 test_mkdir -p $DIR/$tdir
2541 local setcount=$(($OSTCOUNT * 2))
2542 [ $setcount -lt 160 ] || large_xattr_enabled ||
2543 skip_env "ea_inode feature disabled"
2545 $LFS setstripe -C $setcount $DIR/$tdir/ ||
2546 error "setstripe failed"
2548 echo 1 > $DIR/$tdir/$tfile
2550 local count=$($LFS getstripe -c $DIR/$tdir/$tfile)
2551 [ $count -eq $setcount ] ||
2552 error "stripe count $count, should be $setcount"
2554 $LFS getstripe $DIR/$tdir/$tfile 2>&1 | grep "overstriped" ||
2555 error "overstriped should be set in pattern"
2557 dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 conv=notrunc ||
2560 rm -f $DIR/$tdir/$tfile || error "Delete $tfile failed"
2562 run_test 27Cf "test default inheritance with overstriping"
2565 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs"
2566 [ -n "$FILESET" ] && skip "SKIP due to FILESET set"
2567 remote_mds_nodsh && skip "remote MDS with nodsh"
2569 local POOL=${POOL:-testpool}
2571 local last_ost=$(($OSTCOUNT - 1))
2573 local ost_list=$(seq $first_ost $ost_step $last_ost)
2574 local ost_range="$first_ost $last_ost $ost_step"
2576 test_mkdir $DIR/$tdir
2577 pool_add $POOL || error "pool_add failed"
2578 pool_add_targets $POOL $ost_range || error "pool_add_targets failed"
2581 [ $MDS1_VERSION -lt $(version_code 2.8.55) ] &&
2583 [ $MDS1_VERSION -lt $(version_code 2.9.55) ] ||
2584 [ $CLIENT_VERSION -lt $(version_code 2.9.55) ] &&
2585 skip27D+=" -s 30,31"
2586 [[ ! $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ||
2587 $OSTCOUNT -ge $(($LOV_MAX_STRIPE_COUNT / 2)) ]] &&
2588 skip27D+=" -s 32,33"
2589 [[ $MDS_VERSION -lt $(version_code $SEL_VER) ]] &&
2591 llapi_layout_test -d$DIR/$tdir -p$POOL -o$OSTCOUNT $skip27D ||
2592 error "llapi_layout_test failed"
2594 destroy_test_pools || error "destroy test pools failed"
2596 run_test 27D "validate llapi_layout API"
2598 # Verify that default_easize is increased from its initial value after
2599 # accessing a widely striped file.
2601 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs"
2602 [ $CLIENT_VERSION -lt $(version_code 2.5.57) ] &&
2603 skip "client does not have LU-3338 fix"
2605 # 72 bytes is the minimum space required to store striping
2606 # information for a file striped across one OST:
2607 # (sizeof(struct lov_user_md_v3) +
2608 # sizeof(struct lov_user_ost_data_v1))
2610 $LCTL set_param -n llite.*.default_easize $min_easize ||
2611 error "lctl set_param failed"
2612 local easize=$($LCTL get_param -n llite.*.default_easize)
2614 [ $easize -eq $min_easize ] ||
2615 error "failed to set default_easize"
2617 $LFS setstripe -c $OSTCOUNT $DIR/$tfile ||
2618 error "setstripe failed"
2619 # In order to ensure stat() call actually talks to MDS we need to
2620 # do something drastic to this file to shake off all lock, e.g.
2621 # rename it (kills lookup lock forcing cache cleaning)
2622 mv $DIR/$tfile $DIR/${tfile}-1
2623 ls -l $DIR/${tfile}-1
2626 easize=$($LCTL get_param -n llite.*.default_easize)
2628 [ $easize -gt $min_easize ] ||
2629 error "default_easize not updated"
2631 run_test 27E "check that default extended attribute size properly increases"
2633 test_27F() { # LU-5346/LU-7975
2634 [ $PARALLEL == "yes" ] && skip "skip parallel run"
2635 [[ $OSTCOUNT -lt 2 ]] && skip "needs >= 2 OSTs"
2636 [[ $MDS1_VERSION -lt $(version_code 2.8.51) ]] &&
2637 skip "Need MDS version at least 2.8.51"
2638 remote_ost_nodsh && skip "remote OST with nodsh"
2640 test_mkdir $DIR/$tdir
2642 $LFS setstripe -c 2 $DIR/$tdir
2644 # stop all OSTs to reproduce situation for LU-7975 ticket
2645 for num in $(seq $OSTCOUNT); do
2649 # open/create f0 with O_LOV_DELAY_CREATE
2650 # truncate f0 to a non-0 size
2652 multiop $DIR/$tdir/f0 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:T1050000c
2654 $CHECKSTAT -s 1050000 $DIR/$tdir/f0 || error "checkstat failed"
2655 # open/write it again to force delayed layout creation
2656 cat /etc/hosts > $DIR/$tdir/f0 &
2660 for num in $(seq $OSTCOUNT); do
2661 start ost$num $(ostdevname $num) $OST_MOUNT_OPTS ||
2662 error "ost$num failed to start"
2665 wait $catpid || error "cat failed"
2667 cmp /etc/hosts $DIR/$tdir/f0 || error "cmp failed"
2668 [[ $($LFS getstripe -c $DIR/$tdir/f0) == 2 ]] ||
2669 error "wrong stripecount"
2672 run_test 27F "Client resend delayed layout creation with non-zero size"
2674 test_27G() { #LU-10629
2675 [ $MDS1_VERSION -lt $(version_code 2.11.51) ] &&
2676 skip "Need MDS version at least 2.11.51"
2677 [ -n "$FILESET" ] && skip "SKIP due to FILESET set"
2678 remote_mds_nodsh && skip "remote MDS with nodsh"
2679 local POOL=${POOL:-testpool}
2680 local ostrange="0 0 1"
2682 test_mkdir $DIR/$tdir
2683 touch $DIR/$tdir/$tfile.nopool
2684 pool_add $POOL || error "pool_add failed"
2685 pool_add_targets $POOL $ostrange || error "pool_add_targets failed"
2686 $LFS setstripe -p $POOL $DIR/$tdir
2688 local pool=$($LFS getstripe -p $DIR/$tdir)
2690 [ "$pool" = "$POOL" ] || error "Striping failed got '$pool' not '$POOL'"
2691 touch $DIR/$tdir/$tfile.default
2692 $LFS setstripe -E 1M --pool $POOL -c 1 -E eof -c 1 $DIR/$tdir/$tfile.pfl
2693 $LFS find $DIR/$tdir -type f --pool $POOL
2694 local found=$($LFS find $DIR/$tdir -type f --pool $POOL | wc -l)
2695 [[ "$found" == "2" ]] ||
2696 error "found $found != 2 files in '$DIR/$tdir' in '$POOL'"
2698 $LFS setstripe -d $DIR/$tdir
2700 pool=$($LFS getstripe -p -d $DIR/$tdir)
2702 [[ "$pool" != "$POOL" ]] || error "$DIR/$tdir is still '$pool'"
2704 run_test 27G "Clear OST pool from stripe"
2707 [[ $MDS1_VERSION -le $(version_code 2.11.54) ]] &&
2708 skip "Need MDS version newer than 2.11.54"
2709 [[ $OSTCOUNT -lt 3 ]] && skip_env "needs >= 3 OSTs"
2710 test_mkdir $DIR/$tdir
2711 $LFS setstripe -o 0 -o 2 $DIR/$tdir || error "setstripe failed"
2712 touch $DIR/$tdir/$tfile
2713 $LFS getstripe -c $DIR/$tdir/$tfile
2714 [ $($LFS getstripe -c $DIR/$tdir/$tfile) -eq 2 ] ||
2715 error "two-stripe file doesn't have two stripes"
2717 dd if=/dev/zero of=$DIR/$tdir/$tfile bs=4k count=4 || error "dd failed"
2718 $LFS getstripe -y $DIR/$tdir/$tfile
2719 (( $($LFS getstripe -y $DIR/$tdir/$tfile |
2720 egrep -c "l_ost_idx: [02]$") == "2" )) ||
2721 error "expected l_ost_idx: [02]$ not matched"
2723 # make sure ost list has been cleared
2724 local stripesize=$($LFS getstripe -S $DIR/$tdir)
2725 $LFS setstripe -S $((stripesize * 4)) -i 1 \
2726 -c $((OSTCOUNT - 1)) $DIR/$tdir || error "setstripe"
2728 $LVERIFY $DIR/$tdir $DIR/$tdir/f3 || error "lverify failed"
2730 run_test 27H "Set specific OSTs stripe"
2733 [ $PARALLEL == "yes" ] && skip "skip parallel run"
2734 [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
2735 [[ $MDS1_VERSION -gt $(version_code 2.12.52) ]] ||
2736 skip "Need MDS version newer than 2.12.52"
2737 local pool=$TESTNAME
2738 local ostrange="1 1 1"
2740 save_layout_restore_at_exit $MOUNT
2741 $LFS setstripe -c 2 -i 0 $MOUNT
2742 pool_add $pool || error "pool_add failed"
2743 pool_add_targets $pool $ostrange ||
2744 error "pool_add_targets failed"
2745 test_mkdir $DIR/$tdir
2746 $LFS setstripe -p $pool $DIR/$tdir
2747 $MULTIOP $DIR/$tdir/$tfile Oc || error "multiop failed"
2748 $LFS getstripe $DIR/$tdir/$tfile
2750 run_test 27I "check that root dir striping does not break parent dir one"
2753 [[ $MDS1_VERSION -le $(version_code 2.12.51) ]] &&
2754 skip "Need MDS version newer than 2.12.51"
2756 test_mkdir $DIR/$tdir
2757 local uuid1=$(cat /proc/sys/kernel/random/uuid)
2758 local uuid2=$(cat /proc/sys/kernel/random/uuid)
2760 # create foreign file (raw way)
2761 ! $LFS setstripe --flags 0xda08 $DIR/$tdir/$tfile ||
2762 error "creating $tfile w/ hex flags w/o --foreign should fail"
2764 ! $LFS setstripe --foreign --flags foo \
2765 --xattr ${uuid1}@${uuid2} $DIR/$tdir/$tfile ||
2766 error "creating $tfile with '--flags foo' should fail"
2768 ! $LFS setstripe --foreign --flags 0xffffffff \
2769 --xattr ${uuid1}@${uuid2} $DIR/$tdir/$tfile ||
2770 error "creating $tfile w/ 0xffffffff flags should fail"
2772 create_foreign_file -f $DIR/$tdir/$tfile -x "${uuid1}@${uuid2}" \
2773 -t 1 -F 0xda08 || error "create_foreign_file failed"
2775 # verify foreign file (raw way)
2776 parse_foreign_file -f $DIR/$tdir/$tfile |
2777 grep "lov_foreign_magic: 0x0BD70BD0" ||
2778 error "$DIR/$tdir/$tfile: invalid LOV EA foreign magic"
2779 parse_foreign_file -f $DIR/$tdir/$tfile | grep "lov_xattr_size: 89" ||
2780 error "$DIR/$tdir/$tfile: invalid LOV EA foreign size"
2781 parse_foreign_file -f $DIR/$tdir/$tfile |
2782 grep "lov_foreign_size: 73" ||
2783 error "$DIR/$tdir/$tfile: invalid LOV EA foreign size"
2784 parse_foreign_file -f $DIR/$tdir/$tfile |
2785 grep "lov_foreign_type: 1" ||
2786 error "$DIR/$tdir/$tfile: invalid LOV EA foreign type"
2787 parse_foreign_file -f $DIR/$tdir/$tfile |
2788 grep "lov_foreign_flags: 0x0000DA08" ||
2789 error "$DIR/$tdir/$tfile: invalid LOV EA foreign flags"
2790 local lov=$(parse_foreign_file -f $DIR/$tdir/$tfile |
2791 grep "lov_foreign_value: 0x" |
2792 sed -e 's/lov_foreign_value: 0x//')
2793 local lov2=$(echo -n "${uuid1}@${uuid2}" | od -A n -t x1 -w160)
2794 [[ $lov = ${lov2// /} ]] ||
2795 error "$DIR/$tdir/$tfile: invalid LOV EA foreign value"
2797 # create foreign file (lfs + API)
2798 $LFS setstripe --foreign=none --flags 0xda08 \
2799 -x "${uuid1}@${uuid2}" $DIR/$tdir/${tfile}2 ||
2800 error "$DIR/$tdir/${tfile}2: create failed"
2802 $LFS getstripe -v $DIR/$tdir/${tfile}2 |
2803 grep "lfm_magic:.*0x0BD70BD0" ||
2804 error "$DIR/$tdir/${tfile}2: invalid LOV EA foreign magic"
2805 # lfm_length is LOV EA size - sizeof(lfm_magic) - sizeof(lfm_length)
2806 $LFS getstripe -v $DIR/$tdir/${tfile}2 | grep "lfm_length:.*73" ||
2807 error "$DIR/$tdir/${tfile}2: invalid LOV EA foreign size"
2808 $LFS getstripe -v $DIR/$tdir/${tfile}2 | grep "lfm_type:.*none" ||
2809 error "$DIR/$tdir/${tfile}2: invalid LOV EA foreign type"
2810 $LFS getstripe -v $DIR/$tdir/${tfile}2 |
2811 grep "lfm_flags:.*0x0000DA08" ||
2812 error "$DIR/$tdir/${tfile}2: invalid LOV EA foreign flags"
2813 $LFS getstripe $DIR/$tdir/${tfile}2 |
2814 grep "lfm_value:.*${uuid1}@${uuid2}" ||
2815 error "$DIR/$tdir/${tfile}2: invalid LOV EA foreign value"
2817 # modify striping should fail
2818 $LFS setstripe -c 2 $DIR/$tdir/$tfile &&
2819 error "$DIR/$tdir/$tfile: setstripe should fail"
2820 $LFS setstripe -c 2 $DIR/$tdir/${tfile}2 &&
2821 error "$DIR/$tdir/${tfile}2: setstripe should fail"
2824 cat $DIR/$tdir/$tfile && error "$DIR/$tdir/$tfile: read should fail"
2825 cat $DIR/$tdir/${tfile}2 &&
2826 error "$DIR/$tdir/${tfile}2: read should fail"
2827 cat /etc/passwd > $DIR/$tdir/$tfile &&
2828 error "$DIR/$tdir/$tfile: write should fail"
2829 cat /etc/passwd > $DIR/$tdir/${tfile}2 &&
2830 error "$DIR/$tdir/${tfile}2: write should fail"
2833 chmod 222 $DIR/$tdir/$tfile ||
2834 error "$DIR/$tdir/$tfile: chmod failed"
2835 chmod 222 $DIR/$tdir/${tfile}2 ||
2836 error "$DIR/$tdir/${tfile}2: chmod failed"
2839 chown $RUNAS_ID:$RUNAS_GID $DIR/$tdir/$tfile ||
2840 error "$DIR/$tdir/$tfile: chown failed"
2841 chown $RUNAS_ID:$RUNAS_GID $DIR/$tdir/${tfile}2 ||
2842 error "$DIR/$tdir/${tfile}2: chown failed"
2844 # rename should work
2845 mv $DIR/$tdir/$tfile $DIR/$tdir/${tfile}.new ||
2846 error "$DIR/$tdir/$tfile: rename of foreign file has failed"
2847 mv $DIR/$tdir/${tfile}2 $DIR/$tdir/${tfile}2.new ||
2848 error "$DIR/$tdir/${tfile}2: rename of foreign file has failed"
2850 #remove foreign file
2851 rm $DIR/$tdir/${tfile}.new ||
2852 error "$DIR/$tdir/${tfile}.new: remove of foreign file has failed"
2853 rm $DIR/$tdir/${tfile}2.new ||
2854 error "$DIR/$tdir/${tfile}2.new: remove of foreign file has failed"
2856 run_test 27J "basic ops on file with foreign LOV"
2859 [[ $MDS1_VERSION -le $(version_code 2.12.49) ]] &&
2860 skip "Need MDS version newer than 2.12.49"
2862 test_mkdir $DIR/$tdir
2863 local uuid1=$(cat /proc/sys/kernel/random/uuid)
2864 local uuid2=$(cat /proc/sys/kernel/random/uuid)
2866 # create foreign dir (raw way)
2867 ! $LFS setdirstripe --flags 0xda08 $DIR/$tdir/$tdir ||
2868 error "creating $tdir w/ hex flags w/o --foreign should fail"
2870 ! $LFS setdirstripe --foreign --flags foo \
2871 --xattr ${uuid1}@${uuid2} $DIR/$tdir/$tdir ||
2872 error "creating $tdir with '--flags foo' should fail"
2874 ! $LFS setdirstripe --foreign --flags 0xffffffff \
2875 --xattr ${uuid1}@${uuid2} $DIR/$tdir/$tdir ||
2876 error "creating $tdir w/ 0xffffffff flags should fail"
2878 create_foreign_dir -d $DIR/$tdir/$tdir -x "${uuid1}@${uuid2}" -t 1 ||
2879 error "create_foreign_dir FAILED"
2881 # verify foreign dir (raw way)
2882 parse_foreign_dir -d $DIR/$tdir/$tdir |
2883 grep "lmv_foreign_magic:.*0xcd50cd0" ||
2884 error "$DIR/$tdir/$tfile: invalid LMV EA magic"
2885 parse_foreign_dir -d $DIR/$tdir/$tdir | grep "lmv_xattr_size:.*89$" ||
2886 error "$DIR/$tdir/$tdir: invalid LMV EA size"
2887 parse_foreign_dir -d $DIR/$tdir/$tdir | grep "lmv_foreign_type: 1$" ||
2888 error "$DIR/$tdir/$tdir: invalid LMV EA type"
2889 parse_foreign_dir -d $DIR/$tdir/$tdir |
2890 grep "lmv_foreign_flags: 55813$" ||
2891 error "$DIR/$tdir/$tdir: invalid LMV EA flags"
2892 local lmv=$(parse_foreign_dir -d $DIR/$tdir/$tdir |
2893 grep "lmv_foreign_value: 0x" |
2894 sed 's/lmv_foreign_value: 0x//')
2895 local lmv2=$(echo -n "${uuid1}@${uuid2}" | od -A n -t x1 -w160 |
2897 [[ $lmv == $lmv2 ]] || error "$DIR/$tdir/$tdir: invalid LMV EA value"
2899 # create foreign dir (lfs + API)
2900 $LFS mkdir --foreign=none --xattr="${uuid1}@${uuid2}" --flags=0xda05 \
2901 $DIR/$tdir/${tdir}2 ||
2902 error "$DIR/$tdir/${tdir}2: create failed"
2904 $LFS getdirstripe -v $DIR/$tdir/${tdir}2 |
2905 grep "lfm_magic:.*0x0CD50CD0" ||
2906 error "$DIR/$tdir/${tdir}2: invalid LMV EA magic"
2907 # lfm_length is LMV EA size - sizeof(lfm_magic) - sizeof(lfm_length)
2908 # - sizeof(lfm_type) - sizeof(lfm_flags)
2909 $LFS getdirstripe -v $DIR/$tdir/${tdir}2 | grep "lfm_length:.*73" ||
2910 error "$DIR/$tdir/${tdir}2: invalid LMV EA size"
2911 $LFS getdirstripe -v $DIR/$tdir/${tdir}2 | grep "lfm_type:.*none" ||
2912 error "$DIR/$tdir/${tdir}2: invalid LMV EA type"
2913 $LFS getdirstripe -v $DIR/$tdir/${tdir}2 |
2914 grep "lfm_flags:.*0x0000DA05" ||
2915 error "$DIR/$tdir/${tdir}2: invalid LMV EA flags"
2916 $LFS getdirstripe $DIR/$tdir/${tdir}2 |
2917 grep "lfm_value.*${uuid1}@${uuid2}" ||
2918 error "$DIR/$tdir/${tdir}2: invalid LMV EA value"
2920 # file create in dir should fail
2921 touch $DIR/$tdir/$tdir/$tfile && "$DIR/$tdir: file create should fail"
2922 touch $DIR/$tdir/${tdir}2/$tfile &&
2923 "$DIR/${tdir}2: file create should fail"
2926 chmod 777 $DIR/$tdir/$tdir ||
2927 error "$DIR/$tdir: chmod failed"
2928 chmod 777 $DIR/$tdir/${tdir}2 ||
2929 error "$DIR/${tdir}2: chmod failed"
2932 chown $RUNAS_ID:$RUNAS_GID $DIR/$tdir/$tdir ||
2933 error "$DIR/$tdir: chown failed"
2934 chown $RUNAS_ID:$RUNAS_GID $DIR/$tdir/${tdir}2 ||
2935 error "$DIR/${tdir}2: chown failed"
2937 # rename should work
2938 mv $DIR/$tdir/$tdir $DIR/$tdir/${tdir}.new ||
2939 error "$DIR/$tdir/$tdir: rename of foreign dir has failed"
2940 mv $DIR/$tdir/${tdir}2 $DIR/$tdir/${tdir}2.new ||
2941 error "$DIR/$tdir/${tdir}2: rename of foreign dir has failed"
2944 rmdir $DIR/$tdir/${tdir}.new ||
2945 error "$DIR/$tdir/${tdir}.new: remove of foreign dir has failed"
2946 rmdir $DIR/$tdir/${tdir}2.new ||
2947 error "$DIR/$tdir/${tdir}2.new: remove of foreign dir has failed"
2949 run_test 27K "basic ops on dir with foreign LMV"
2952 remote_mds_nodsh && skip "remote MDS with nodsh"
2954 local POOL=${POOL:-$TESTNAME}
2956 pool_add $POOL || error "pool_add failed"
2958 lfs pool_list $MOUNT | grep -Fx "${FSNAME}.${POOL}" ||
2959 error "pool_list does not contain ${FSNAME}.${POOL}:" \
2960 "$(lfs pool_list $MOUNT | grep -F "${POOL}")"
2962 run_test 27L "lfs pool_list gives correct pool name"
2965 [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.12.57) ]] &&
2966 skip "Need MDS version >= than 2.12.57"
2967 remote_mds_nodsh && skip "remote MDS with nodsh"
2968 [[ $OSTCOUNT -lt 2 ]] && skip_env "need > 1 OST"
2970 test_mkdir $DIR/$tdir
2972 # Set default striping on directory
2976 # if we run against a 2.12 server which lacks overstring support
2977 # then the connect_flag will not report overstriping, even if client
2979 if [[ $($LCTL get_param mdc.*.connect_flags) =~ overstriping ]]; then
2980 stripe_opt="-C $setcount"
2981 elif (( $OSTCOUNT >= $setcount )); then
2982 stripe_opt="-c $setcount"
2984 skip "server does not support overstriping"
2986 $LFS setstripe $stripe_opt $DIR/$tdir
2988 echo 1 > $DIR/$tdir/${tfile}.1
2989 local count=$($LFS getstripe -c $DIR/$tdir/${tfile}.1)
2990 [ $count -eq $setcount ] ||
2991 error "(1) stripe count $count, should be $setcount"
2993 # Capture existing append_stripe_count setting for restore
2994 local orig_count=$(do_facet mds1 $LCTL get_param -n mdd.$FSNAME-MDT0000.append_stripe_count)
2995 local mdts=$(comma_list $(mdts_nodes))
2996 stack_trap "do_nodes $mdts $LCTL set_param mdd.*.append_stripe_count=$orig_count" EXIT
2998 local appendcount=$orig_count
2999 echo 1 >> $DIR/$tdir/${tfile}.2_append
3000 count=$($LFS getstripe -c $DIR/$tdir/${tfile}.2_append)
3001 [ $count -eq $appendcount ] ||
3002 error "(2)stripe count $count, should be $appendcount for append"
3004 # Disable O_APPEND striping, verify it works
3005 do_nodes $mdts $LCTL set_param mdd.*.append_stripe_count=0
3007 # Should now get the default striping, which is 4
3009 echo 1 >> $DIR/$tdir/${tfile}.3_append
3010 count=$($LFS getstripe -c $DIR/$tdir/${tfile}.3_append)
3011 [ $count -eq $setcount ] ||
3012 error "(3) stripe count $count, should be $setcount"
3014 # Try changing the stripe count for append files
3015 do_nodes $mdts $LCTL set_param mdd.*.append_stripe_count=2
3017 # Append striping is now 2 (directory default is still 4)
3019 echo 1 >> $DIR/$tdir/${tfile}.4_append
3020 count=$($LFS getstripe -c $DIR/$tdir/${tfile}.4_append)
3021 [ $count -eq $appendcount ] ||
3022 error "(4) stripe count $count, should be $appendcount for append"
3024 # Test append stripe count of -1
3025 do_nodes $mdts $LCTL set_param mdd.*.append_stripe_count=-1
3026 appendcount=$OSTCOUNT
3027 echo 1 >> $DIR/$tdir/${tfile}.5
3028 count=$($LFS getstripe -c $DIR/$tdir/${tfile}.5)
3029 [ $count -eq $appendcount ] ||
3030 error "(5) stripe count $count, should be $appendcount for append"
3032 # Set append striping back to default of 1
3033 do_nodes $mdts $LCTL set_param mdd.*.append_stripe_count=1
3035 # Try a new default striping, PFL + DOM
3036 $LFS setstripe -L mdt -E 1M -E -1 -c 2 $DIR/$tdir
3038 # Create normal DOM file, DOM returns stripe count == 0
3040 touch $DIR/$tdir/${tfile}.6
3041 count=$($LFS getstripe -c $DIR/$tdir/${tfile}.6)
3042 [ $count -eq $setcount ] ||
3043 error "(6) stripe count $count, should be $setcount"
3047 echo 1 >> $DIR/$tdir/${tfile}.7_append
3048 count=$($LFS getstripe -c $DIR/$tdir/${tfile}.7_append)
3049 [ $count -eq $appendcount ] ||
3050 error "(7) stripe count $count, should be $appendcount for append"
3052 # Clean up DOM layout
3053 $LFS setstripe -d $DIR/$tdir
3055 save_layout_restore_at_exit $MOUNT
3056 # Now test that append striping works when layout is from root
3057 $LFS setstripe -c 2 $MOUNT
3058 # Make a special directory for this
3059 mkdir $DIR/${tdir}/${tdir}.2
3061 # Verify for normal file
3063 echo 1 > $DIR/${tdir}/${tdir}.2/${tfile}.8
3064 count=$($LFS getstripe -c $DIR/$tdir/${tdir}.2/${tfile}.8)
3065 [ $count -eq $setcount ] ||
3066 error "(8) stripe count $count, should be $setcount"
3069 echo 1 >> $DIR/${tdir}/${tdir}.2/${tfile}.9_append
3070 count=$($LFS getstripe -c $DIR/${tdir}/${tdir}.2/${tfile}.9_append)
3071 [ $count -eq $appendcount ] ||
3072 error "(9) stripe count $count, should be $appendcount for append"
3074 # Now test O_APPEND striping with pools
3075 do_nodes $mdts $LCTL set_param mdd.*.append_pool="$TESTNAME"
3076 stack_trap "do_nodes $mdts $LCTL set_param mdd.*.append_pool='none'" EXIT
3079 pool_add $TESTNAME || error "pool creation failed"
3080 pool_add_targets $TESTNAME 0 1 || error "Pool add targets failed"
3082 echo 1 >> $DIR/$tdir/${tfile}.10_append
3084 pool=$($LFS getstripe -p $DIR/$tdir/${tfile}.10_append)
3085 [ "$pool" = "$TESTNAME" ] || error "(10) incorrect pool: $pool"
3087 # Check that count is still correct
3089 echo 1 >> $DIR/$tdir/${tfile}.11_append
3090 count=$($LFS getstripe -c $DIR/$tdir/${tfile}.11_append)
3091 [ $count -eq $appendcount ] ||
3092 error "(11) stripe count $count, should be $appendcount for append"
3094 # Disable O_APPEND stripe count, verify pool works separately
3095 do_nodes $mdts $LCTL set_param mdd.*.append_stripe_count=0
3097 echo 1 >> $DIR/$tdir/${tfile}.12_append
3099 pool=$($LFS getstripe -p $DIR/$tdir/${tfile}.12_append)
3100 [ "$pool" = "$TESTNAME" ] || error "(12) incorrect pool: $pool"
3102 # Remove pool setting, verify it's not applied
3103 do_nodes $mdts $LCTL set_param mdd.*.append_pool='none'
3105 echo 1 >> $DIR/$tdir/${tfile}.13_append
3107 pool=$($LFS getstripe -p $DIR/$tdir/${tfile}.13_append)
3108 [ "$pool" = "" ] || error "(13) pool found: $pool"
3110 run_test 27M "test O_APPEND striping"
3113 combined_mgs_mds && skip "needs separate MGS/MDT"
3115 pool_add $TESTNAME || error "pool_add failed"
3116 do_facet mgs "$LCTL pool_list $FSNAME" |
3117 grep -Fx "${FSNAME}.${TESTNAME}" ||
3118 error "lctl pool_list on MGS failed"
3120 run_test 27N "lctl pool_list on separate MGS gives correct pool name"
3122 clean_foreign_symlink() {
3124 lctl set_param llite/$FSNAME-*/foreign_symlink_enable=0
3125 for i in $DIR/$tdir/* ; do
3126 $LFS unlink_foreign $i || true
3131 [[ $(lustre_version_code $SINGLEMDS) -le $(version_code 2.12.51) ]] &&
3132 skip "Need MDS version newer than 2.12.51"
3134 test_mkdir $DIR/$tdir
3135 local uuid1=$(cat /proc/sys/kernel/random/uuid)
3136 local uuid2=$(cat /proc/sys/kernel/random/uuid)
3138 trap clean_foreign_symlink EXIT
3140 # enable foreign_symlink behaviour
3141 $LCTL set_param llite/$FSNAME-*/foreign_symlink_enable=1
3143 # foreign symlink LOV format is a partial path by default
3145 # create foreign file (lfs + API)
3146 $LFS setstripe --foreign=symlink --flags 0xda05 \
3147 -x "${uuid1}/${uuid2}" --mode 0600 $DIR/$tdir/${tfile} ||
3148 error "$DIR/$tdir/${tfile}: create failed"
3150 $LFS getstripe -v $DIR/$tdir/${tfile} |
3151 grep "lfm_magic:.*0x0BD70BD0" ||
3152 error "$DIR/$tdir/${tfile}: invalid LOV EA foreign magic"
3153 $LFS getstripe -v $DIR/$tdir/${tfile} | grep "lfm_type:.*symlink" ||
3154 error "$DIR/$tdir/${tfile}: invalid LOV EA foreign type"
3155 $LFS getstripe -v $DIR/$tdir/${tfile} |
3156 grep "lfm_flags:.*0x0000DA05" ||
3157 error "$DIR/$tdir/${tfile}: invalid LOV EA foreign flags"
3158 $LFS getstripe $DIR/$tdir/${tfile} |
3159 grep "lfm_value:.*${uuid1}/${uuid2}" ||
3160 error "$DIR/$tdir/${tfile}: invalid LOV EA foreign value"
3162 # modify striping should fail
3163 $LFS setstripe -c 2 $DIR/$tdir/$tfile &&
3164 error "$DIR/$tdir/$tfile: setstripe should fail"
3166 # R/W should fail ("/{foreign_symlink_prefix}/${uuid1}/" missing)
3167 cat $DIR/$tdir/$tfile && error "$DIR/$tdir/$tfile: read should fail"
3168 cat /etc/passwd > $DIR/$tdir/$tfile &&
3169 error "$DIR/$tdir/$tfile: write should fail"
3171 # rename should succeed
3172 mv $DIR/$tdir/$tfile $DIR/$tdir/${tfile}.new ||
3173 error "$DIR/$tdir/$tfile: rename has failed"
3175 #remove foreign_symlink file should fail
3176 rm $DIR/$tdir/${tfile}.new &&
3177 error "$DIR/$tdir/${tfile}.new: remove of foreign_symlink file should fail"
3180 mkdir /tmp/${uuid1} ||
3181 error "/tmp/${uuid1}: mkdir has failed"
3182 echo FOOFOO > /tmp/${uuid1}/${uuid2} ||
3183 error "/tmp/${uuid1}/${uuid2}: echo has failed"
3184 $LCTL set_param llite/$FSNAME-*/foreign_symlink_prefix=/tmp/
3185 $CHECKSTAT -t link -l /tmp/${uuid1}/${uuid2} $DIR/$tdir/${tfile}.new ||
3186 error "$DIR/$tdir/${tfile}.new: not seen as a symlink"
3187 #read should succeed now
3188 cat $DIR/$tdir/${tfile}.new | grep FOOFOO ||
3189 error "$DIR/$tdir/${tfile}.new: symlink resolution has failed"
3190 #write should succeed now
3191 cat /etc/passwd > $DIR/$tdir/${tfile}.new ||
3192 error "$DIR/$tdir/${tfile}.new: write should succeed"
3193 diff /etc/passwd $DIR/$tdir/${tfile}.new ||
3194 error "$DIR/$tdir/${tfile}.new: diff has failed"
3195 diff /etc/passwd /tmp/${uuid1}/${uuid2} ||
3196 error "/tmp/${uuid1}/${uuid2}: diff has failed"
3198 #check that getstripe still works
3199 $LFS getstripe $DIR/$tdir/${tfile}.new ||
3200 error "$DIR/$tdir/${tfile}.new: getstripe should still work with foreign_symlink enabled"
3202 # chmod should still succeed
3203 chmod 644 $DIR/$tdir/${tfile}.new ||
3204 error "$DIR/$tdir/${tfile}.new: chmod has failed"
3206 # chown should still succeed
3207 chown $RUNAS_ID:$RUNAS_GID $DIR/$tdir/${tfile}.new ||
3208 error "$DIR/$tdir/${tfile}.new: chown has failed"
3210 # rename should still succeed
3211 mv $DIR/$tdir/${tfile}.new $DIR/$tdir/${tfile} ||
3212 error "$DIR/$tdir/${tfile}.new: rename has failed"
3214 #remove foreign_symlink file should still fail
3215 rm $DIR/$tdir/${tfile} &&
3216 error "$DIR/$tdir/${tfile}: remove of foreign_symlink file should fail"
3218 #use special ioctl() to unlink foreign_symlink file
3219 $LFS unlink_foreign $DIR/$tdir/${tfile} ||
3220 error "$DIR/$tdir/$tfile: unlink/ioctl failed"
3223 run_test 27O "basic ops on foreign file of symlink type"
3226 [[ $(lustre_version_code $SINGLEMDS) -le $(version_code 2.12.49) ]] &&
3227 skip "Need MDS version newer than 2.12.49"
3229 test_mkdir $DIR/$tdir
3230 local uuid1=$(cat /proc/sys/kernel/random/uuid)
3231 local uuid2=$(cat /proc/sys/kernel/random/uuid)
3233 trap clean_foreign_symlink EXIT
3235 # enable foreign_symlink behaviour
3236 $LCTL set_param llite/$FSNAME-*/foreign_symlink_enable=1
3238 # foreign symlink LMV format is a partial path by default
3240 # create foreign dir (lfs + API)
3241 $LFS mkdir --foreign=symlink --xattr="${uuid1}/${uuid2}" \
3242 --flags=0xda05 --mode 0750 $DIR/$tdir/${tdir} ||
3243 error "$DIR/$tdir/${tdir}: create failed"
3245 $LFS getdirstripe -v $DIR/$tdir/${tdir} |
3246 grep "lfm_magic:.*0x0CD50CD0" ||
3247 error "$DIR/$tdir/${tdir}: invalid LMV EA magic"
3248 $LFS getdirstripe -v $DIR/$tdir/${tdir} | grep "lfm_type:.*symlink" ||
3249 error "$DIR/$tdir/${tdir}: invalid LMV EA type"
3250 $LFS getdirstripe -v $DIR/$tdir/${tdir} |
3251 grep "lfm_flags:.*0x0000DA05" ||
3252 error "$DIR/$tdir/${tdir}: invalid LMV EA flags"
3253 $LFS getdirstripe $DIR/$tdir/${tdir} |
3254 grep "lfm_value.*${uuid1}/${uuid2}" ||
3255 error "$DIR/$tdir/${tdir}: invalid LMV EA value"
3257 # file create in dir should fail
3258 # ("/{foreign_symlink_prefix}/${uuid1}/${uuid2}/" missing)
3259 touch $DIR/$tdir/$tdir/$tfile && "$DIR/$tdir: file create should fail"
3261 # rename should succeed
3262 mv $DIR/$tdir/$tdir $DIR/$tdir/${tdir}.new ||
3263 error "$DIR/$tdir/$tdir: rename of foreign_symlink dir has failed"
3265 #remove foreign_symlink dir should fail
3266 rmdir $DIR/$tdir/${tdir}.new &&
3267 error "$DIR/$tdir/${tdir}.new: remove of foreign_symlink dir should fail"
3270 mkdir -p /tmp/${uuid1}/${uuid2} ||
3271 error "/tmp/${uuid1}/${uuid2}: mkdir has failed"
3272 echo FOOFOO > /tmp/${uuid1}/${uuid2}/foo ||
3273 error "/tmp/${uuid1}/${uuid2}/foo: echo has failed"
3274 $LCTL set_param llite/$FSNAME-*/foreign_symlink_prefix=/tmp/
3275 $CHECKSTAT -t link -l /tmp/${uuid1}/${uuid2} $DIR/$tdir/${tdir}.new ||
3276 error "$DIR/$tdir/${tdir}.new: not seen as a symlink"
3277 cat $DIR/$tdir/${tdir}.new/foo | grep FOOFOO ||
3278 error "$DIR/$tdir/${tdir}.new: symlink resolution has failed"
3280 #check that getstripe fails now that foreign_symlink enabled
3281 $LFS getdirstripe $DIR/$tdir/${tdir}.new ||
3282 error "$DIR/$tdir/${tdir}.new: getdirstripe should still work with foreign_symlink enabled"
3284 # file create in dir should work now
3285 cp /etc/passwd $DIR/$tdir/${tdir}.new/$tfile ||
3286 error "$DIR/$tdir/${tdir}.new/$tfile: file create should fail"
3287 diff /etc/passwd $DIR/$tdir/${tdir}.new/$tfile ||
3288 error "$DIR/$tdir/${tdir}.new/$tfile: diff has failed"
3289 diff /etc/passwd /tmp/${uuid1}/${uuid2}/$tfile ||
3290 error "/tmp/${uuid1}/${uuid2}/$tfile: diff has failed"
3292 # chmod should still succeed
3293 chmod 755 $DIR/$tdir/${tdir}.new ||
3294 error "$DIR/$tdir/${tdir}.new: chmod has failed"
3296 # chown should still succeed
3297 chown $RUNAS_ID:$RUNAS_GID $DIR/$tdir/${tdir}.new ||
3298 error "$DIR/$tdir/${tdir}.new: chown has failed"
3300 # rename should still succeed
3301 mv $DIR/$tdir/${tdir}.new $DIR/$tdir/${tdir} ||
3302 error "$DIR/$tdir/${tdir}.new: rename of foreign_symlink dir has failed"
3304 #remove foreign_symlink dir should still fail
3305 rmdir $DIR/$tdir/${tdir} &&
3306 error "$DIR/$tdir/${tdir}: remove of foreign_symlink dir should fail"
3308 #use special ioctl() to unlink foreign_symlink file
3309 $LFS unlink_foreign $DIR/$tdir/${tdir} ||
3310 error "$DIR/$tdir/$tdir: unlink/ioctl failed"
3312 #created file should still exist
3313 [[ -f /tmp/${uuid1}/${uuid2}/$tfile ]] ||
3314 error "/tmp/${uuid1}/${uuid2}/$tfile has been removed"
3315 diff /etc/passwd /tmp/${uuid1}/${uuid2}/$tfile ||
3316 error "/tmp/${uuid1}/${uuid2}/$tfile: diff has failed"
3318 run_test 27P "basic ops on foreign dir of foreign_symlink type"
3321 rm -f $TMP/$tfile $TMP/$tfile.loop $TMP/$tfile.none $TMP/$tfile.broken
3322 stack_trap "rm -f $TMP/$tfile*"
3324 test_mkdir $DIR/$tdir-1
3325 test_mkdir $DIR/$tdir-2
3327 echo 'It is what it is' > $DIR/$tdir-1/$tfile
3328 lov_getstripe_old $DIR/$tdir-1/$tfile || error "$DIR/$tdir-1/$tfile: rc = $?"
3330 ln -s $DIR/$tdir-1/$tfile $DIR/$tdir-2/$tfile
3331 lov_getstripe_old $DIR/$tdir-2/$tfile || error "$DIR/$tdir-2/$tfile: rc = $?"
3333 ln -s $DIR/$tdir-1/$tfile $TMP/$tfile
3334 lov_getstripe_old $TMP/$tfile || error "$TMP/$tfile: rc = $?"
3336 # Create some bad symlinks and ensure that we don't loop
3337 # forever or something. These should return ELOOP (40) and
3338 # ENOENT (2) but I don't want to test for that because there's
3339 # always some weirdo architecture that needs to ruin
3340 # everything by defining these error numbers differently.
3342 ln -s $TMP/$tfile.loop $TMP/$tfile.loop
3343 lov_getstripe_old $TMP/$tfile.loop && error "$TMP/$tfile.loop: rc = $?"
3345 ln -s $TMP/$tfile.none $TMP/$tfile.broken
3346 lov_getstripe_old $TMP/$tfile.broken && error "$TMP/$tfile.broken: rc = $?"
3350 run_test 27Q "llapi_file_get_stripe() works on symlinks"
3353 (( $MDS1_VERSION >= $(version_code 2.14.55) )) ||
3354 skip "need MDS 2.14.55 or later"
3355 (( $OSTCOUNT >= 2 )) || skip_env "needs at least 2 OSTs"
3357 local testdir="$DIR/$tdir"
3358 test_mkdir -p $testdir
3359 stack_trap "rm -rf $testdir"
3360 $LFS setstripe -c -1 $testdir || error "setstripe failed"
3362 local f1="$testdir/f1"
3363 touch $f1 || error "failed to touch $f1"
3364 local count=$($LFS getstripe -c $f1)
3365 (( $count == $OSTCOUNT )) || error "wrong stripe count"
3367 do_facet $SINGLEMDS $LCTL set_param lod.*.max_stripecount=-1
3368 (( $? == 34 )) || error "setting max_stripecount to -1 should fail and return ERANGE"
3370 local maxcount=$(($OSTCOUNT - 1))
3371 local mdts=$(comma_list $(mdts_nodes))
3372 do_nodes $mdts $LCTL set_param lod.*.max_stripecount=$maxcount
3373 stack_trap "do_nodes $mdts $LCTL set_param lod.*.max_stripecount=0"
3375 local f2="$testdir/f2"
3376 touch $f2 || error "failed to touch $f2"
3377 local count=$($LFS getstripe -c $f2)
3378 (( $count == $maxcount )) || error "wrong stripe count"
3380 run_test 27R "test max_stripecount limitation when stripe count is set to -1"
3382 # createtest also checks that device nodes are created and
3383 # then visible correctly (#2091)
3384 test_28() { # bug 2091
3386 $CREATETEST $DIR/d28/ct || error "createtest failed"
3388 run_test 28 "create/mknod/mkdir with bad file types ============"
3391 [ $PARALLEL == "yes" ] && skip "skip parallel run"
3393 sync; sleep 1; sync # flush out any dirty pages from previous tests
3400 declare -i LOCKCOUNTORIG=0
3401 for lock_count in $(lctl get_param -n ldlm.namespaces.*mdc*.lock_count); do
3402 let LOCKCOUNTORIG=$LOCKCOUNTORIG+$lock_count
3404 [ $LOCKCOUNTORIG -eq 0 ] && error "No mdc lock count" && return 1
3406 declare -i LOCKUNUSEDCOUNTORIG=0
3407 for unused_count in $(lctl get_param -n ldlm.namespaces.*mdc*.lock_unused_count); do
3408 let LOCKUNUSEDCOUNTORIG=$LOCKUNUSEDCOUNTORIG+$unused_count
3415 declare -i LOCKCOUNTCURRENT=0
3416 for lock_count in $(lctl get_param -n ldlm.namespaces.*mdc*.lock_count); do
3417 let LOCKCOUNTCURRENT=$LOCKCOUNTCURRENT+$lock_count
3420 declare -i LOCKUNUSEDCOUNTCURRENT=0
3421 for unused_count in $(lctl get_param -n ldlm.namespaces.*mdc*.lock_unused_count); do
3422 let LOCKUNUSEDCOUNTCURRENT=$LOCKUNUSEDCOUNTCURRENT+$unused_count
3425 if [[ $LOCKCOUNTCURRENT -gt $LOCKCOUNTORIG ]]; then
3426 $LCTL set_param -n ldlm.dump_namespaces ""
3427 error "CURRENT: $LOCKCOUNTCURRENT > $LOCKCOUNTORIG"
3428 $LCTL dk | sort -k4 -t: > $TMP/test_29.dk
3429 log "dumped log to $TMP/test_29.dk (bug 5793)"
3432 if [[ $LOCKUNUSEDCOUNTCURRENT -gt $LOCKUNUSEDCOUNTORIG ]]; then
3433 error "UNUSED: $LOCKUNUSEDCOUNTCURRENT > $LOCKUNUSEDCOUNTORIG"
3434 $LCTL dk | sort -k4 -t: > $TMP/test_29.dk
3435 log "dumped log to $TMP/test_29.dk (bug 5793)"
3439 run_test 29 "IT_GETATTR regression ============================"
3441 test_30a() { # was test_30
3442 cp $(which ls) $DIR || cp /bin/ls $DIR
3443 $DIR/ls / || error "Can't execute binary from lustre"
3446 run_test 30a "execute binary from Lustre (execve) =============="
3449 cp `which ls` $DIR || cp /bin/ls $DIR
3451 $RUNAS $DIR/ls / || error "Can't execute binary from lustre as non-root"
3454 run_test 30b "execute binary from Lustre as non-root ==========="
3456 test_30c() { # b=22376
3457 [ $PARALLEL == "yes" ] && skip "skip parallel run"
3459 cp $(which ls) $DIR || cp /bin/ls $DIR
3461 cancel_lru_locks mdc
3462 cancel_lru_locks osc
3463 $RUNAS $DIR/ls / || error "Can't execute binary from lustre"
3466 run_test 30c "execute binary from Lustre without read perms ===="
3469 cp $(which dd) $DIR || error "failed to copy dd to $DIR/dd"
3471 for i in {1..10}; do
3472 $DIR/dd bs=1M count=128 if=/dev/zero of=$DIR/$tfile &
3475 $LCTL set_param ldlm.namespaces.*MDT*.lru_size=clear
3476 wait $PID || error "executing dd from Lustre failed"
3482 run_test 30d "execute binary from Lustre while clear locks"
3485 $OPENUNLINK $DIR/f31 $DIR/f31 || error "openunlink failed"
3486 $CHECKSTAT -a $DIR/f31 || error "$DIR/f31 exists"
3488 run_test 31a "open-unlink file =================================="
3491 touch $DIR/f31 || error "touch $DIR/f31 failed"
3492 ln $DIR/f31 $DIR/f31b || error "ln failed"
3493 $MULTIOP $DIR/f31b Ouc || error "multiop failed"
3494 $CHECKSTAT -t file $DIR/f31 || error "$DIR/f31 not file type"
3496 run_test 31b "unlink file with multiple links while open ======="
3499 touch $DIR/f31 || error "touch $DIR/f31 failed"
3500 ln $DIR/f31 $DIR/f31c || error "ln failed"
3501 multiop_bg_pause $DIR/f31 O_uc ||
3502 error "multiop_bg_pause for $DIR/f31 failed"
3504 $MULTIOP $DIR/f31c Ouc
3505 kill -USR1 $MULTIPID
3508 run_test 31c "open-unlink file with multiple links ============="
3511 opendirunlink $DIR/d31d $DIR/d31d || error "opendirunlink failed"
3512 $CHECKSTAT -a $DIR/d31d || error "$DIR/d31d exists"
3514 run_test 31d "remove of open directory ========================="
3516 test_31e() { # bug 2904
3517 openfilleddirunlink $DIR/d31e || error "openfilleddirunlink failed"
3519 run_test 31e "remove of open non-empty directory ==============="
3521 test_31f() { # bug 4554
3522 [ $PARALLEL == "yes" ] && skip "skip parallel run"
3525 test_mkdir $DIR/d31f
3526 $LFS setstripe -S 1048576 -c 1 $DIR/d31f
3527 cp /etc/hosts $DIR/d31f
3529 $LFS getstripe $DIR/d31f/hosts
3530 multiop_bg_pause $DIR/d31f D_c || return 1
3533 rm -rv $DIR/d31f || error "first of $DIR/d31f"
3534 test_mkdir $DIR/d31f
3535 $LFS setstripe -S 1048576 -c 1 $DIR/d31f
3536 cp /etc/hosts $DIR/d31f
3538 $LFS getstripe $DIR/d31f/hosts
3539 multiop_bg_pause $DIR/d31f D_c || return 1
3542 kill -USR1 $MULTIPID || error "first opendir $MULTIPID not running"
3543 wait $MULTIPID || error "first opendir $MULTIPID failed"
3547 kill -USR1 $MULTIPID2 || error "second opendir $MULTIPID not running"
3548 wait $MULTIPID2 || error "second opendir $MULTIPID2 failed"
3551 run_test 31f "remove of open directory with open-unlink file ==="
3554 echo "-- cross directory link --"
3555 test_mkdir -c1 $DIR/${tdir}ga
3556 test_mkdir -c1 $DIR/${tdir}gb
3557 touch $DIR/${tdir}ga/f
3558 ln $DIR/${tdir}ga/f $DIR/${tdir}gb/g
3559 $CHECKSTAT -t file $DIR/${tdir}ga/f || error "source"
3560 [ `stat -c%h $DIR/${tdir}ga/f` == '2' ] || error "source nlink"
3561 $CHECKSTAT -t file $DIR/${tdir}gb/g || error "target"
3562 [ `stat -c%h $DIR/${tdir}gb/g` == '2' ] || error "target nlink"
3564 run_test 31g "cross directory link==============="
3567 echo "-- cross directory link --"
3568 test_mkdir -c1 $DIR/${tdir}
3569 test_mkdir -c1 $DIR/${tdir}/dir
3570 touch $DIR/${tdir}/f
3571 ln $DIR/${tdir}/f $DIR/${tdir}/dir/g
3572 $CHECKSTAT -t file $DIR/${tdir}/f || error "source"
3573 [ `stat -c%h $DIR/${tdir}/f` == '2' ] || error "source nlink"
3574 $CHECKSTAT -t file $DIR/${tdir}/dir/g || error "target"
3575 [ `stat -c%h $DIR/${tdir}/dir/g` == '2' ] || error "target nlink"
3577 run_test 31h "cross directory link under child==============="
3580 echo "-- cross directory link --"
3581 test_mkdir -c1 $DIR/$tdir
3582 test_mkdir -c1 $DIR/$tdir/dir
3583 touch $DIR/$tdir/dir/f
3584 ln $DIR/$tdir/dir/f $DIR/$tdir/g
3585 $CHECKSTAT -t file $DIR/$tdir/dir/f || error "source"
3586 [ `stat -c%h $DIR/$tdir/dir/f` == '2' ] || error "source nlink"
3587 $CHECKSTAT -t file $DIR/$tdir/g || error "target"
3588 [ `stat -c%h $DIR/$tdir/g` == '2' ] || error "target nlink"
3590 run_test 31i "cross directory link under parent==============="
3593 test_mkdir -c1 -p $DIR/$tdir
3594 test_mkdir -c1 -p $DIR/$tdir/dir1
3595 ln $DIR/$tdir/dir1 $DIR/$tdir/dir2 && error "ln for dir"
3596 link $DIR/$tdir/dir1 $DIR/$tdir/dir3 && error "link for dir"
3597 mlink $DIR/$tdir/dir1 $DIR/$tdir/dir4 && error "mlink for dir"
3598 mlink $DIR/$tdir/dir1 $DIR/$tdir/dir1 && error "mlink to the same dir"
3601 run_test 31j "link for directory==============="
3604 test_mkdir -c1 -p $DIR/$tdir
3606 touch $DIR/$tdir/exist
3607 mlink $DIR/$tdir/s $DIR/$tdir/t || error "mlink"
3608 mlink $DIR/$tdir/s $DIR/$tdir/exist && error "mlink to exist file"
3609 mlink $DIR/$tdir/s $DIR/$tdir/s && error "mlink to the same file"
3610 mlink $DIR/$tdir/s $DIR/$tdir && error "mlink to parent dir"
3611 mlink $DIR/$tdir $DIR/$tdir/s && error "mlink parent dir to target"
3612 mlink $DIR/$tdir/not-exist $DIR/$tdir/foo && error "mlink non-existing to new"
3613 mlink $DIR/$tdir/not-exist $DIR/$tdir/s && error "mlink non-existing to exist"
3616 run_test 31k "link to file: the same, non-existing, dir==============="
3622 touch $DIR/d31m2/exist
3623 mlink $DIR/d31m/s $DIR/d31m2/t || error "mlink"
3624 mlink $DIR/d31m/s $DIR/d31m2/exist && error "mlink to exist file"
3625 mlink $DIR/d31m/s $DIR/d31m2 && error "mlink to parent dir"
3626 mlink $DIR/d31m2 $DIR/d31m/s && error "mlink parent dir to target"
3627 mlink $DIR/d31m/not-exist $DIR/d31m2/foo && error "mlink non-existing to new"
3628 mlink $DIR/d31m/not-exist $DIR/d31m2/s && error "mlink non-existing to exist"
3631 run_test 31m "link to file: the same, non-existing, dir==============="
3634 touch $DIR/$tfile || error "cannot create '$DIR/$tfile'"
3635 nlink=$(stat --format=%h $DIR/$tfile)
3636 [ ${nlink:--1} -eq 1 ] || error "nlink is $nlink, expected 1"
3638 local cmd="exec $fd<$DIR/$tfile"
3641 trap "eval $cmd" EXIT
3642 nlink=$(stat --dereference --format=%h /proc/self/fd/$fd)
3643 [ ${nlink:--1} -eq 1 ] || error "nlink is $nlink, expected 1"
3644 rm $DIR/$tfile || error "cannot remove '$DIR/$tfile'"
3645 nlink=$(stat --dereference --format=%h /proc/self/fd/$fd)
3646 [ ${nlink:--1} -eq 0 ] || error "nlink is $nlink, expected 0"
3649 run_test 31n "check link count of unlinked file"
3652 local tempfile=$(mktemp $1_XXXXXX)
3653 mlink $tempfile $1 2> /dev/null &&
3654 echo "$BASHPID: link $tempfile to $1 succeeded"
3658 test_31o() { # LU-2901
3659 test_mkdir $DIR/$tdir
3660 for LOOP in $(seq 100); do
3661 rm -f $DIR/$tdir/$tfile*
3662 for THREAD in $(seq 8); do
3663 link_one $DIR/$tdir/$tfile.$LOOP &
3666 local LINKS=$(ls -1 $DIR/$tdir | grep -c $tfile.$LOOP)
3667 [[ $LINKS -gt 1 ]] && ls $DIR/$tdir &&
3668 error "$LINKS duplicate links to $tfile.$LOOP" &&
3672 run_test 31o "duplicate hard links with same filename"
3675 [ $MDSCOUNT -lt 2 ] && skip_env "needs >= 2 MDTs"
3677 test_mkdir $DIR/$tdir
3678 $LFS setdirstripe -i0 -c2 $DIR/$tdir/striped_dir
3679 $LFS setdirstripe -D -c2 -H all_char $DIR/$tdir/striped_dir
3681 opendirunlink $DIR/$tdir/striped_dir/test1 ||
3682 error "open unlink test1 failed"
3683 opendirunlink $DIR/$tdir/striped_dir/test2 ||
3684 error "open unlink test2 failed"
3686 $CHECKSTAT -a $DIR/$tdir/striped_dir/test1 ||
3687 error "test1 still exists"
3688 $CHECKSTAT -a $DIR/$tdir/striped_dir/test2 ||
3689 error "test2 still exists"
3691 run_test 31p "remove of open striped directory"
3694 [ $MDSCOUNT -lt 3 ] && skip_env "needs >= 3 MDTs"
3696 $LFS mkdir -i 3,1 $DIR/$tdir || error "mkdir failed"
3697 index=$($LFS getdirstripe -i $DIR/$tdir)
3698 [ $index -eq 3 ] || error "first stripe index $index != 3"
3699 index=$($LFS getdirstripe $DIR/$tdir | tail -1 | awk '{print $1}')
3700 [ $index -eq 1 ] || error "second stripe index $index != 1"
3702 # when "-c <stripe_count>" is set, the number of MDTs specified after
3703 # "-i" should equal to the stripe count
3704 $LFS mkdir -i 3,1 -c 3 $DIR/$tdir.2 && error "mkdir should fail" || true
3706 run_test 31q "create striped directory on specific MDTs"
3710 touch $DIR/$tfile.target
3711 touch $DIR/$tfile.source
3713 #OBD_FAIL_LLITE_OPEN_DELAY 0x1419
3714 $LCTL set_param fail_loc=0x1419 fail_val=3
3715 cat $DIR/$tfile.target &
3718 # Guarantee open is waiting before we get here
3720 mv $DIR/$tfile.source $DIR/$tfile.target
3724 if [[ $RC -ne 0 ]]; then
3725 error "open with cat failed, rc=$RC"
3728 run_test 31r "open-rename(replace) race"
3730 cleanup_test32_mount() {
3733 local loopdev=$(losetup -a | grep $EXT2_DEV | sed -ne 's/:.*$//p')
3734 $UMOUNT $DIR/$tdir/ext2-mountpoint || rc=$?
3735 losetup -d $loopdev || true
3741 [ $PARALLEL == "yes" ] && skip "skip parallel run"
3743 echo "== more mountpoints and symlinks ================="
3744 [ -e $DIR/$tdir ] && rm -fr $DIR/$tdir
3745 trap cleanup_test32_mount EXIT
3746 test_mkdir -p $DIR/$tdir/ext2-mountpoint
3747 mount -t ext2 -o loop $EXT2_DEV $DIR/$tdir/ext2-mountpoint ||
3748 error "mount failed for $EXT2_DEV $DIR/$tdir/ext2-mountpoint"
3749 $CHECKSTAT -t dir $DIR/$tdir/ext2-mountpoint/.. ||
3750 error "$DIR/$tdir/ext2-mountpoint/.. not dir type"
3751 cleanup_test32_mount
3753 run_test 32a "stat d32a/ext2-mountpoint/.. ====================="
3756 [ $PARALLEL == "yes" ] && skip "skip parallel run"
3758 [ -e $DIR/$tdir ] && rm -fr $DIR/$tdir
3759 trap cleanup_test32_mount EXIT
3760 test_mkdir -p $DIR/$tdir/ext2-mountpoint
3761 mount -t ext2 -o loop $EXT2_DEV $DIR/$tdir/ext2-mountpoint ||
3762 error "mount failed for $EXT2_DEV $DIR/$tdir/ext2-mountpoint"
3763 ls -al $DIR/$tdir/ext2-mountpoint/.. ||
3764 error "Can't list $DIR/$tdir/ext2-mountpoint/.."
3765 cleanup_test32_mount
3767 run_test 32b "open d32b/ext2-mountpoint/.. ====================="
3770 [ $PARALLEL == "yes" ] && skip "skip parallel run"
3772 [ -e $DIR/$tdir ] && rm -fr $DIR/$tdir
3773 trap cleanup_test32_mount EXIT
3774 test_mkdir -p $DIR/$tdir/ext2-mountpoint
3775 mount -t ext2 -o loop $EXT2_DEV $DIR/$tdir/ext2-mountpoint ||
3776 error "mount failed for $EXT2_DEV $DIR/$tdir/ext2-mountpoint"
3777 test_mkdir -p $DIR/$tdir/d2/test_dir
3778 $CHECKSTAT -t dir $DIR/$tdir/ext2-mountpoint/../d2/test_dir ||
3779 error "$DIR/$tdir/ext2-mountpoint/../d2/test_dir not dir type"
3780 cleanup_test32_mount
3782 run_test 32c "stat d32c/ext2-mountpoint/../d2/test_dir ========="
3785 [ $PARALLEL == "yes" ] && skip "skip parallel run"
3787 [ -e $DIR/$tdir ] && rm -fr $DIR/$tdir
3788 trap cleanup_test32_mount EXIT
3789 test_mkdir -p $DIR/$tdir/ext2-mountpoint
3790 mount -t ext2 -o loop $EXT2_DEV $DIR/$tdir/ext2-mountpoint ||
3791 error "mount failed for $EXT2_DEV $DIR/$tdir/ext2-mountpoint"
3792 test_mkdir -p $DIR/$tdir/d2/test_dir
3793 ls -al $DIR/$tdir/ext2-mountpoint/../d2/test_dir ||
3794 error "Can't list $DIR/$tdir/ext2-mountpoint/../d2/test_dir"
3795 cleanup_test32_mount
3797 run_test 32d "open d32d/ext2-mountpoint/../d2/test_dir"
3801 test_mkdir -p $DIR/$tdir/tmp
3802 local tmp_dir=$DIR/$tdir/tmp
3803 ln -s $DIR/$tdir $tmp_dir/symlink11
3804 ln -s $tmp_dir/symlink11 $tmp_dir/../symlink01
3805 $CHECKSTAT -t link $DIR/$tdir/tmp/symlink11 || error "symlink11 bad"
3806 $CHECKSTAT -t link $DIR/$tdir/symlink01 || error "symlink01 bad"
3808 run_test 32e "stat d32e/symlink->tmp/symlink->lustre-subdir"
3812 test_mkdir -p $DIR/$tdir/tmp
3813 local tmp_dir=$DIR/$tdir/tmp
3814 ln -s $DIR/$tdir $tmp_dir/symlink11
3815 ln -s $tmp_dir/symlink11 $tmp_dir/../symlink01
3816 ls $DIR/$tdir/tmp/symlink11 || error "symlink11 bad"
3817 ls $DIR/$tdir/symlink01 || error "symlink01 bad"
3819 run_test 32f "open d32f/symlink->tmp/symlink->lustre-subdir"
3822 local tmp_dir=$DIR/$tdir/tmp
3823 test_mkdir -p $tmp_dir
3824 test_mkdir $DIR/${tdir}2
3825 ln -s $DIR/${tdir}2 $tmp_dir/symlink12
3826 ln -s $tmp_dir/symlink12 $tmp_dir/../symlink02
3827 $CHECKSTAT -t link $tmp_dir/symlink12 || error "symlink12 not a link"
3828 $CHECKSTAT -t link $DIR/$tdir/symlink02 || error "symlink02 not a link"
3829 $CHECKSTAT -t dir -f $tmp_dir/symlink12 || error "symlink12 not a dir"
3830 $CHECKSTAT -t dir -f $DIR/$tdir/symlink02 || error "symlink12 not a dir"
3832 run_test 32g "stat d32g/symlink->tmp/symlink->lustre-subdir/${tdir}2"
3835 rm -fr $DIR/$tdir $DIR/${tdir}2
3836 tmp_dir=$DIR/$tdir/tmp
3837 test_mkdir -p $tmp_dir
3838 test_mkdir $DIR/${tdir}2
3839 ln -s $DIR/${tdir}2 $tmp_dir/symlink12
3840 ln -s $tmp_dir/symlink12 $tmp_dir/../symlink02
3841 ls $tmp_dir/symlink12 || error "listing symlink12"
3842 ls $DIR/$tdir/symlink02 || error "listing symlink02"
3844 run_test 32h "open d32h/symlink->tmp/symlink->lustre-subdir/${tdir}2"
3847 [ $PARALLEL == "yes" ] && skip "skip parallel run"
3849 [ -e $DIR/$tdir ] && rm -fr $DIR/$tdir
3850 trap cleanup_test32_mount EXIT
3851 test_mkdir -p $DIR/$tdir/ext2-mountpoint
3852 mount -t ext2 -o loop $EXT2_DEV $DIR/$tdir/ext2-mountpoint ||
3853 error "mount failed for $EXT2_DEV $DIR/$tdir/ext2-mountpoint"
3854 touch $DIR/$tdir/test_file
3855 $CHECKSTAT -t file $DIR/$tdir/ext2-mountpoint/../test_file ||
3856 error "$DIR/$tdir/ext2-mountpoint/../test_file not file type"
3857 cleanup_test32_mount
3859 run_test 32i "stat d32i/ext2-mountpoint/../test_file ==========="
3862 [ $PARALLEL == "yes" ] && skip "skip parallel run"
3864 [ -e $DIR/$tdir ] && rm -fr $DIR/$tdir
3865 trap cleanup_test32_mount EXIT
3866 test_mkdir -p $DIR/$tdir/ext2-mountpoint
3867 mount -t ext2 -o loop $EXT2_DEV $DIR/$tdir/ext2-mountpoint ||
3868 error "mount failed for $EXT2_DEV $DIR/$tdir/ext2-mountpoint"
3869 touch $DIR/$tdir/test_file
3870 cat $DIR/$tdir/ext2-mountpoint/../test_file ||
3871 error "Can't open $DIR/$tdir/ext2-mountpoint/../test_file"
3872 cleanup_test32_mount
3874 run_test 32j "open d32j/ext2-mountpoint/../test_file ==========="
3877 [ $PARALLEL == "yes" ] && skip "skip parallel run"
3880 trap cleanup_test32_mount EXIT
3881 test_mkdir -p $DIR/$tdir/ext2-mountpoint
3882 mount -t ext2 -o loop $EXT2_DEV $DIR/$tdir/ext2-mountpoint ||
3883 error "mount failed for $EXT2_DEV $DIR/$tdir/ext2-mountpoint"
3884 test_mkdir -p $DIR/$tdir/d2
3885 touch $DIR/$tdir/d2/test_file || error "touch failed"
3886 $CHECKSTAT -t file $DIR/$tdir/ext2-mountpoint/../d2/test_file ||
3887 error "$DIR/$tdir/ext2-mountpoint/../d2/test_file not file type"
3888 cleanup_test32_mount
3890 run_test 32k "stat d32k/ext2-mountpoint/../d2/test_file ========"
3893 [ $PARALLEL == "yes" ] && skip "skip parallel run"
3896 trap cleanup_test32_mount EXIT
3897 test_mkdir -p $DIR/$tdir/ext2-mountpoint
3898 mount -t ext2 -o loop $EXT2_DEV $DIR/$tdir/ext2-mountpoint ||
3899 error "mount failed for $EXT2_DEV $DIR/$tdir/ext2-mountpoint"