+test_127() {
+ [[ "$ost1_FSTYPE" == ldiskfs ]] || skip "ldiskfs only test"
+
+ cleanup
+ setup
+ zconf_umount_clients $RCLIENTS $MOUNT
+
+ wait_osp_active ost ${FSNAME}-OST0000 0 1
+ local osc_tgt="$FSNAME-OST0000-osc-$($LFS getname -i $DIR)"
+ local avail1=($($LCTL get_param -n osc.${osc_tgt}.kbytesavail))
+
+ $LFS setstripe -i 0 $DIR/$tfile || error "failed creating $DIR/$tfile"
+ dd if=/dev/zero of=$DIR/$tfile bs=1M oflag=direct || true
+
+ local avail2=($($LCTL get_param -n osc.${osc_tgt}.kbytesavail))
+
+ if ((avail2 * 100 / avail1 > 1)); then
+ lfs df $DIR
+ ls -l $DIR/$tfile
+ error "more than 1% space left: before=$avail1 after=$avail2"
+ fi
+
+ local mbs=$(($(stat -c %s $DIR/$tfile) / (1024 * 1024)))
+
+ dd if=/dev/zero of=$DIR/$tfile bs=1M count=$mbs conv=notrunc \
+ oflag=direct || error "overwrite failed"
+}
+run_test 127 "direct io overwrite on full ost"
+
+test_128()
+{
+ combined_mgs_mds && skip "need separate mgs device"
+ [ "$ost2_FSTYPE" == zfs ] && import_zpool ost2
+
+ format_ost 2
+ # Try to apply nolocallogs to the virgin OST. Should fail.
+ do_facet ost2 "$TUNEFS --nolocallogs $(ostdevname 2)" &&
+ error "nolocallogs should not be allowed on the virgin target"
+
+ setupall
+ stopall
+
+ [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
+ # Start OST without MGS (local configs)
+ do_facet ost1 "$TUNEFS --dryrun $(ostdevname 1)"
+ start_ost || error "unable to start OST1"
+ stop_ost || error "Unable to stop OST1"
+
+ [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
+ # Do not allow reading local configs, should fail
+ do_facet ost1 "$TUNEFS --nolocallogs $(ostdevname 1)" ||
+ error "Can not set nolocallogs"
+ start_ost && error "OST1 started, but should fail"
+
+ # Connect to MGS successfully, reset nolocallogs flag
+ [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
+ start_mgs || error "unable to start MGS"
+ start_ost || error "unable to start OST1"
+
+ do_facet ost1 "$TUNEFS --dryrun $(ostdevname 1)" | grep "nolocallogs" &&
+ error "nolocallogs expected to be reset"
+
+ stop_ost || error "Unable to stop OST1"
+}
+run_test 128 "Force using remote logs with --nolocallogs"
+
+test_129()
+{
+ stopall
+ start_mds || error "MDS start failed"
+ format_ost 1
+ start ost1 $(ostdevname 1) $OST_MOUNT_OPTS &&
+ error "start ost1 should fail" || true
+ start ost1 $(ostdevname 1) $OST_MOUNT_OPTS &&
+ error "second start ost1 should fail" || true
+ do_facet ost1 "$TUNEFS --writeconf $(ostdevname 1)"
+ start ost1 $(ostdevname 1) $OST_MOUNT_OPTS ||
+ error "start ost1 failed"
+ stop ost1
+ stop_mds
+}
+run_test 129 "attempt to connect an OST with the same index should fail"
+
+test_130()
+{
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
+ setupall
+ stop_mdt 2 || error "mdt2 stop failed"
+ do_facet mds2 "$TUNEFS --writeconf $(mdsdevname 2)"
+ start_mdt 2 || error "mdt2 start failed"
+ do_facet mds2 "$LCTL dl" | grep MDT0001-osp-MDT0001 &&
+ error "Illegal OSP device created" || true
+}
+run_test 130 "re-register an MDT after writeconf"
+
+test_131() {
+ [ "$mds1_FSTYPE" == "ldiskfs" ] || skip "ldiskfs only test"
+ do_facet mds1 $DEBUGFS -R features $(mdsdevname 1) |
+ grep -q project || skip "skip project quota not supported"
+
+ local projid
+
+ setupall
+ test_mkdir -c $MDSCOUNT -p $DIR/$tdir
+ $LFS project -p 1000 $DIR/$tdir || error "set dir project id failed"
+ createmany -o $DIR/$tdir/f 512
+ for ((i = 0; i < 512; ++i)); do
+ $LFS project -p $i $DIR/$tdir/f${i} ||
+ error "set f${i} project id failed"
+ done
+
+ test_mkdir -c $MDSCOUNT -p $DIR/$tdir.inherit
+ $LFS project -p 1001 -s $DIR/$tdir.inherit
+ createmany -o $DIR/$tdir.inherit/f 128
+ (( $($LFS project $DIR/$tdir.inherit/f* |
+ awk '$1 == 1001 { print }' | wc -l) == 128 )) ||
+ error "files did not inherit projid 1001"
+
+ stopall
+
+ for i in $(seq $MDSCOUNT); do
+ mds_backup_restore mds$i ||
+ error "Backup/restore on mds$i failed"
+ done
+
+ setupall
+
+ projid=($($LFS project -d $DIR/$tdir))
+ [ ${projid[0]} == "1000" ] ||
+ error "projid expected 1000 not ${projid[0]}"
+ for ((i = 0; i < 512; ++i)); do
+ projid=($($LFS project $DIR/$tdir/f${i}))
+ [ ${projid[0]} == "$i" ] ||
+ error "projid expected $i not ${projid[0]}"
+ done
+
+ (( $($LFS project $DIR/$tdir.inherit/f* |
+ awk '$1 == 1001 { print }' | wc -l) == 128 )) ||
+ error "restore did not copy projid 1001"
+}
+run_test 131 "MDT backup restore with project ID"
+
+test_132() {
+ local err_cnt
+ local err_cnt2
+
+ reformat
+ combined_mgs_mds || start_mgs || error "unable to start MGS"
+ start_mdt 1 || error "unable to start mdt1"
+
+ err_cnt=$(do_facet mds1 dmesg | grep -c "cannot take the layout locks")
+ stop_mdt 1 || error "stop mdt1 failed"
+
+ [ "$mds1_FSTYPE" == zfs ] && import_zpool mds1
+ do_facet mds1 $TUNEFS --param mdt.hsm_control=enabled $(mdsdevname 1) ||
+ error "tunefs failed"
+ start_mdt 1 || error "cannot start mdt1"
+
+ err_cnt2=$(do_facet mds1 dmesg | grep -c "cannot take the layout locks")
+ [ $err_cnt -eq $err_cnt2 ] || error "Can not take the layout lock"
+ stop_mdt 1 || error "stop mdt1 failed"
+}
+run_test 132 "hsm_actions processed after failover"
+