mrename $remote_src $remote_tgt &&
error "rename remote dirs should not work!"
+ # If target dir does not exists, it should succeed
+ rm -rf $remote_tgt
+ mrename $remote_src $remote_tgt ||
+ error "rename remote dirs(tgt dir does not exists) failed!"
+
rm -rf $DIR/$tdir || error "Can not delete directories"
}
run_test 24z "rename one remote dir to another remote dir should fail"
run_test 27t "check that utils parse path correctly"
test_27u() { # bug 4900
- [ "$OSTCOUNT" -lt "2" ] && skip_env "too few OSTs" && return
- remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ [ "$OSTCOUNT" -lt "2" ] && skip_env "too few OSTs" && return
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ local index
+ local list=$(comma_list $(mdts_nodes))
#define OBD_FAIL_MDS_OSC_PRECREATE 0x139
- do_facet $SINGLEMDS lctl set_param fail_loc=0x139
- test_mkdir -p $DIR/$tdir
+ do_nodes $list $LCTL set_param fail_loc=0x139
+ test_mkdir -p $DIR/$tdir
rm -rf $DIR/$tdir/*
- createmany -o $DIR/$tdir/t- 1000
- do_facet $SINGLEMDS lctl set_param fail_loc=0
+ createmany -o $DIR/$tdir/t- 1000
+ do_nodes $list $LCTL set_param fail_loc=0
- TLOG=$DIR/$tfile.getstripe
- $GETSTRIPE $DIR/$tdir > $TLOG
- OBJS=`awk -vobj=0 '($1 == 0) { obj += 1 } END { print obj;}' $TLOG`
- unlinkmany $DIR/$tdir/t- 1000
- [ $OBJS -gt 0 ] && \
- error "$OBJS objects created on OST-0. See $TLOG" || pass
+ TLOG=$DIR/$tfile.getstripe
+ $GETSTRIPE $DIR/$tdir > $TLOG
+ OBJS=`awk -vobj=0 '($1 == 0) { obj += 1 } END { print obj;}' $TLOG`
+ unlinkmany $DIR/$tdir/t- 1000
+ [ $OBJS -gt 0 ] && \
+ error "$OBJS objects created on OST-0. See $TLOG" || pass
}
run_test 27u "skip object creation on OSC w/o objects =========="
ostnum=$(index_from_ostuuid ${ostname}_UUID)
node=$(facet_active_host ost$((ostnum+1)))
param="obdfilter.$ostname.last_id"
- ost_last=$(do_node $node lctl get_param -n $param | head -n 1)
+ ost_last=$(do_node $node lctl get_param -n $param | head -n 1 |
+ awk -F':' '{print $2}')
echo "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last"
if [ $ost_last != $mds_last ]; then
error "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last"
[ $NUMS -eq $EXPECTED ] ||
error "\"$CMD\" wrong: found $NUMS, expected $EXPECTED"
- EXPECTED=$(((NUMDIRS + 1) * NUMFILES + ONESTRIPE))
- CMD="$LFIND -stripe-index 0,1 -type f $TDIR"
- NUMS=$($CMD | wc -l)
- [ $NUMS -eq $EXPECTED ] ||
- error "\"$CMD\" wrong: found $NUMS, expected $EXPECTED"
+ if [ $OSTCOUNT -gt 1 ]; then
+ EXPECTED=$(((NUMDIRS + 1) * NUMFILES + ONESTRIPE))
+ CMD="$LFIND -stripe-index 0,1 -type f $TDIR"
+ NUMS=$($CMD | wc -l)
+ [ $NUMS -eq $EXPECTED ] ||
+ error "\"$CMD\" wrong: found $NUMS, expected $EXPECTED"
+ fi
}
run_test 56u "check lfs find -stripe-index works"
local default_size=`$GETSTRIPE -S $test_kdir`
local default_count=`$GETSTRIPE -c $test_kdir`
local default_offset=`$GETSTRIPE -i $test_kdir`
- $SETSTRIPE -S 65536 -i 1 -c $OSTCOUNT $test_kdir ||
+ $SETSTRIPE -S 65536 -i 0 -c $OSTCOUNT $test_kdir ||
error 'dir setstripe failed'
setfattr -n trusted.lov $test_kdir
local stripe_size=`$GETSTRIPE -S $test_kdir`
test_133d() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
- remote_ost_nodsh && skip "remote OST with nodsh" && return
- remote_mds_nodsh && skip "remote MDS with nodsh" && return
- do_facet $SINGLEMDS $LCTL list_param mdt.*.rename_stats ||
- { skip "MDS doesn't support rename stats"; return; }
+ remote_ost_nodsh && skip "remote OST with nodsh" && return
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ do_facet $SINGLEMDS $LCTL list_param mdt.*.rename_stats ||
+ { skip "MDS doesn't support rename stats"; return; }
- local testdir1=$DIR/${tdir}/stats_testdir1
- local testdir2=$DIR/${tdir}/stats_testdir2
+ local testdir1=$DIR/${tdir}/stats_testdir1
+ local testdir2=$DIR/${tdir}/stats_testdir2
- do_facet $SINGLEMDS $LCTL set_param mdt.*.rename_stats=clear
+ do_facet $SINGLEMDS $LCTL set_param mdt.*.rename_stats=clear
- test_mkdir -p ${testdir1} || error "mkdir failed"
- test_mkdir -p ${testdir2} || error "mkdir failed"
+ mkdir -p ${testdir1} || error "mkdir failed"
+ mkdir -p ${testdir2} || error "mkdir failed"
- createmany -o $testdir1/test 512 || error "createmany failed"
+ createmany -o $testdir1/test 512 || error "createmany failed"
# check samedir rename size
mv ${testdir1}/test0 ${testdir1}/test_0
echo "source rename dir size: ${testdir1_size}"
echo "target rename dir size: ${testdir2_size}"
- local cmd="do_facet $SINGLEMDS $LCTL get_param mdt.*.rename_stats"
- eval $cmd || error "$cmd failed"
- local samedir=$($cmd | grep 'same_dir')
- local same_sample=$(get_rename_size $testdir1_size)
- [ -z "$samedir" ] && error "samedir_rename_size count error"
- [ "$same_sample" -eq 1 ] || error "samedir_rename_size error $same_sample"
- echo "Check same dir rename stats success"
+ local cmd="do_facet $SINGLEMDS $LCTL get_param mdt.*.rename_stats"
+ eval $cmd || error "$cmd failed"
+ local samedir=$($cmd | grep 'same_dir')
+ local same_sample=$(get_rename_size $testdir1_size)
+ [ -z "$samedir" ] && error "samedir_rename_size count error"
+ [ "$same_sample" -eq 1 ] || error "samedir_rename_size error $same_sample"
+ echo "Check same dir rename stats success"
- do_facet $SINGLEMDS $LCTL set_param mdt.*.rename_stats=clear
+ do_facet $SINGLEMDS $LCTL set_param mdt.*.rename_stats=clear
- # check crossdir rename size
- mv ${testdir1}/test_0 ${testdir2}/test_0
+ # check crossdir rename size
+ mv ${testdir1}/test_0 ${testdir2}/test_0
testdir1_size=$(ls -l $DIR/${tdir} |
awk '/stats_testdir1/ {print $5}')
echo "source rename dir size: ${testdir1_size}"
echo "target rename dir size: ${testdir2_size}"
- eval $cmd || error "$cmd failed"
- local crossdir=$($cmd | grep 'crossdir')
- local src_sample=$(get_rename_size $testdir1_size crossdir_src)
- local tgt_sample=$(get_rename_size $testdir2_size crossdir_tgt)
- [ -z "$crossdir" ] && error "crossdir_rename_size count error"
- [ "$src_sample" -eq 1 ] || error "crossdir_rename_size error $src_sample"
- [ "$tgt_sample" -eq 1 ] || error "crossdir_rename_size error $tgt_sample"
- echo "Check cross dir rename stats success"
- rm -rf $DIR/${tdir}
+ eval $cmd || error "$cmd failed"
+ local crossdir=$($cmd | grep 'crossdir')
+ local src_sample=$(get_rename_size $testdir1_size crossdir_src)
+ local tgt_sample=$(get_rename_size $testdir2_size crossdir_tgt)
+ [ -z "$crossdir" ] && error "crossdir_rename_size count error"
+ [ "$src_sample" -eq 1 ] || error "crossdir_rename_size error $src_sample"
+ [ "$tgt_sample" -eq 1 ] || error "crossdir_rename_size error $tgt_sample"
+ echo "Check cross dir rename stats success"
+ rm -rf $DIR/${tdir}
}
run_test 133d "Verifying rename_stats ========================================"
error "touch $MOUNT/.lustre/fid/$tfile should fail."
echo "setxattr to $MOUNT/.lustre/fid"
- setfattr -n trusted.name1 -v value1 $MOUNT/.lustre/fid &&
- error "setxattr should fail."
+ setfattr -n trusted.name1 -v value1 $MOUNT/.lustre/fid
echo "listxattr for $MOUNT/.lustre/fid"
- getfattr -d -m "^trusted" $MOUNT/.lustre/fid &&
- error "listxattr should fail."
+ getfattr -d -m "^trusted" $MOUNT/.lustre/fid
echo "delxattr from $MOUNT/.lustre/fid"
- setfattr -x trusted.name1 $MOUNT/.lustre/fid &&
- error "delxattr should fail."
+ setfattr -x trusted.name1 $MOUNT/.lustre/fid
echo "touch invalid fid: $MOUNT/.lustre/fid/[0x200000400:0x2:0x3]"
touch $MOUNT/.lustre/fid/[0x200000400:0x2:0x3] &&
mrename $MOUNT/.lustre $MOUNT/.lustre/fid/$fid/.lustre &&
error "rename .lustre to itself should fail."
+ local old_obf_mode=$(stat --format="%a" $DIR/.lustre/fid)
+ local new_obf_mode=777
+
+ echo "change mode of $DIR/.lustre/fid to $new_obf_mode"
+ chmod $new_obf_mode $DIR/.lustre/fid ||
+ error "chmod $new_obf_mode $DIR/.lustre/fid failed"
+
+ local obf_mode=$(stat --format=%a $DIR/.lustre/fid)
+ [ $obf_mode -eq $new_obf_mode ] ||
+ error "stat $DIR/.lustre/fid returned wrong mode $obf_mode"
+
+ echo "restore mode of $DIR/.lustre/fid to $old_obf_mode"
+ chmod $old_obf_mode $DIR/.lustre/fid ||
+ error "chmod $old_obf_mode $DIR/.lustre/fid failed"
+
$OPENFILE -f O_LOV_DELAY_CREATE:O_CREAT $test_dir/$tfile-2
fid=$($LFS path2fid $test_dir/$tfile-2)
echo "cp /etc/passwd $MOUNT/.lustre/fid/$fid"
error "dot lustre permission check $fid failed"
rm -rf $MOUNT/.lustre && error ".lustre is not allowed to be unlinked"
- chmod 777 $MOUNT/.lustre && error ".lustre is not allowed to be chmod"
touch $MOUNT/.lustre/file &&
error "creation is not allowed under .lustre"
MDSSURVEY=${MDSSURVEY:-$(which mds-survey 2>/dev/null || true)}
test_225a () {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
- if [ -z ${MDSSURVEY} ]; then
- skip_env "mds-survey not found" && return
- fi
+ if [ -z ${MDSSURVEY} ]; then
+ skip_env "mds-survey not found" && return
+ fi
+
+ [ $MDSCOUNT -ge 2 ] &&
+ skip "skipping now for more than one MDT" && return
+
[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ] ||
{ skip "Need MDS version at least 2.2.51"; return; }
test_225b () {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
- if [ -z ${MDSSURVEY} ]; then
- skip_env "mds-survey not found" && return
- fi
- [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ] ||
- { skip "Need MDS version at least 2.2.51"; return; }
- if [ $($LCTL dl | grep -c osc) -eq 0 ]; then
- skip_env "Need to mount OST to test" && return
- fi
+ if [ -z ${MDSSURVEY} ]; then
+ skip_env "mds-survey not found" && return
+ fi
+ [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ] ||
+ { skip "Need MDS version at least 2.2.51"; return; }
+
+ if [ $($LCTL dl | grep -c osc) -eq 0 ]; then
+ skip_env "Need to mount OST to test" && return
+ fi
+ [ $MDSCOUNT -ge 2 ] &&
+ skip "skipping now for more than one MDT" && return
local mds=$(facet_host $SINGLEMDS)
local target=$(do_nodes $mds 'lctl dl' | \
awk "{if (\$2 == \"UP\" && \$3 == \"mdt\") {print \$4}}")