+test_413g() {
+ (( MDSCOUNT >= 2 )) || skip "We need at least 2 MDTs for this test"
+
+ mkdir -p $DIR/$tdir/l2/l3/l4 || error "mkdir $tdir/l1/l2/l3 failed"
+ getfattr -d -m trusted.dmv --absolute-names $DIR > $TMP/dmv.ea ||
+ error "dump $DIR default LMV failed"
+ stack_trap "setfattr --restore=$TMP/dmv.ea"
+
+ $LFS setdirstripe -D -i -1 -c 1 -X 3 --max-inherit-rr 3 $DIR ||
+ error "set $DIR default LMV failed"
+
+ FILESET="$FILESET/$tdir/l2/l3/l4" mount_client $MOUNT2 ||
+ error "mount $MOUNT2 failed"
+ stack_trap "umount_client $MOUNT2"
+
+ local saved_DIR=$DIR
+
+ export DIR=$MOUNT2
+
+ stack_trap "export DIR=$saved_DIR"
+
+ # first check filesystem-wide default LMV inheritance
+ test_fs_dmv_inherit || error "incorrect fs default LMV inheritance"
+
+ # then check subdirs are spread to all MDTs
+ createmany -d $DIR/s $((MDSCOUNT * 100)) || error "createmany failed"
+
+ local count=$($LFS getstripe -m $DIR/s* | sort -u | wc -l)
+
+ (( $count == $MDSCOUNT )) || error "dirs are spread to $count MDTs"
+}
+run_test 413g "enforce ROOT default LMV on subdir mount"
+
+test_413h() {
+ (( MDSCOUNT >= 2 )) ||
+ skip "We need at least 2 MDTs for this test"
+
+ (( MDS1_VERSION >= $(version_code 2.15.50.6) )) ||
+ skip "Need server version at least 2.15.50.6"
+
+ local lmv_qos_maxage=$($LCTL get_param -n lmv.*.qos_maxage)
+
+ stack_trap "$LCTL set_param \
+ lmv.*.qos_maxage=$lmv_qos_maxage > /dev/null"
+ $LCTL set_param lmv.*.qos_maxage=1
+
+ local depth=5
+ local rr_depth=4
+ local dir=$DIR/$tdir/l1/l2/l3/l4/l5
+ local count=$((MDSCOUNT * 20))
+
+ generate_uneven_mdts 50
+
+ mkdir -p $dir || error "mkdir $dir failed"
+ stack_trap "rm -rf $dir"
+ $LFS setdirstripe -D -c 1 -i -1 --max-inherit=$depth \
+ --max-inherit-rr=$rr_depth $dir
+
+ for ((d=0; d < depth + 2; d++)); do
+ log "dir=$dir:"
+ for ((sub=0; sub < count; sub++)); do
+ mkdir $dir/d$sub
+ done
+ $LFS getdirstripe -i $dir/d* | sort | uniq -c | sort -nr
+ local num=($($LFS getdirstripe -i $dir/d* | sort | uniq -c))
+ # subdirs within $rr_depth should be created round-robin
+ if (( d < rr_depth )); then
+ (( ${num[0]} != count )) ||
+ error "all objects created on MDT ${num[1]}"
+ fi
+
+ dir=$dir/d0
+ done
+}
+run_test 413h "don't stick to parent for round-robin dirs"
+