Whamcloud - gitweb
LU-12687 osc: consume grants for direct I/O
[fs/lustre-release.git] / lustre / tests / conf-sanity.sh
index ffba742..5821ef5 100644 (file)
@@ -71,7 +71,7 @@ gen_config() {
        # and stop to generate the startup logs.
        start_mds
        start_ost
-        wait_osc_import_state mds ost FULL
+       wait_osc_import_state mds ost FULL
        stop_ost
        stop_mds
 }
@@ -95,7 +95,7 @@ writeconf_or_reformat() {
 }
 
 reformat() {
-        formatall
+       formatall
 }
 
 start_mgs () {
@@ -140,6 +140,9 @@ start_mds() {
        for num in $(seq $MDSCOUNT); do
                start_mdt $num $@ || return 94
        done
+       for num in $(seq $MDSCOUNT); do
+               wait_clients_import_state ${CLIENTS:-$HOSTNAME} mds${num} FULL
+       done
 }
 
 start_mgsmds() {
@@ -157,14 +160,15 @@ stop_mds() {
 }
 
 stop_mgs() {
-       echo "stop mgs service on `facet_active_host mgs`"
-       # These tests all use non-failover stop
-       stop mgs -f  || return 97
+       echo "stop mgs service on `facet_active_host mgs`"
+       # These tests all use non-failover stop
+       stop mgs -f  || return 97
 }
 
 start_ost() {
        echo "start ost1 service on `facet_active_host ost1`"
        start ost1 $(ostdevname 1) $OST_MOUNT_OPTS $@ || return 95
+       wait_clients_import_state ${CLIENTS:-$HOSTNAME} ost1 FULL
 }
 
 stop_ost() {
@@ -176,6 +180,7 @@ stop_ost() {
 start_ost2() {
        echo "start ost2 service on `facet_active_host ost2`"
        start ost2 $(ostdevname 2) $OST_MOUNT_OPTS $@ || return 92
+       wait_clients_import_state ${CLIENTS:-$HOSTNAME} ost2 FULL
 }
 
 stop_ost2() {
@@ -254,8 +259,8 @@ check_mount() {
        do_facet client "cp /etc/passwd $DIR/a" || return 71
        do_facet client "rm $DIR/a" || return 72
        # make sure lustre is actually mounted (touch will block,
-        # but grep won't, so do it after)
-        do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
+       # but grep won't, so do it after)
+       do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
        echo "setup single mount lustre success"
 }
 
@@ -9053,6 +9058,35 @@ test_126() {
 }
 run_test 126 "mount in parallel shouldn't cause a crash"
 
+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"
+
 if ! combined_mgs_mds ; then
        stop mgs
 fi