(( $beforeused + $extra >= $afterused )) && break
n_attempts=$((n_attempts + 1))
[ $n_attempts -gt 3 ] &&
- error "after $afterused > before $beforeused"
+ error "after $afterused > before $beforeused + $extra"
wait_zfs_commit $SINGLEMDS 5
sync_all_data
rm -f $DIR/$tdir/$tfile
wait_mds_ost_sync || error "initial MDS-OST sync timed out"
wait_delete_completed || error "initial wait delete timed out"
- BLOCKS1=$(df -P $MOUNT | tail -n 1 | awk '{ print $3 }')
+ local blocks1=$(df -P $MOUNT | tail -n 1 | awk '{ print $3 }')
+ local write_size=$(fs_log_size)
+
$SETSTRIPE -i 0 -c 1 $DIR/$tdir/$tfile
- dd if=/dev/zero bs=1M count=10 of=$DIR/$tdir/$tfile
+ [ $write_size -lt 1024 ] && write_size=1024
+ dd if=/dev/zero bs=${write_size}k count=10 of=$DIR/$tdir/$tfile
sync
stop ost1
facet_failover $SINGLEMDS
client_up || error "client_up failed"
wait_mds_ost_sync || error "MDS-OST sync timed out"
wait_delete_completed || error "wait delete timed out"
- BLOCKS2=$(df -P $MOUNT | tail -n 1 | awk '{ print $3 }')
- [ $((BLOCKS2 - BLOCKS1)) -le 4 ] ||
- error $((BLOCKS2 - BLOCKS1)) blocks leaked
+ local blocks2=$(df -P $MOUNT | tail -n 1 | awk '{ print $3 }')
+
+ [ $((blocks2 - blocks1)) -le $(fs_log_size) ] ||
+ error $((blocks2 - blocks1)) blocks leaked
}
run_test 89 "no disk space leak on late ost connection"
case $(facet_fstype $facet) in
ldiskfs) size=50;; # largest seen is 44, leave some headroom
- zfs) size=$(lctl get_param osc.$FSNAME-OST*.import |
- awk '/grant_block_size:/ { print $2 * 2; exit; }');;
+ # grant_block_size is in bytes, allow at least 2x max blocksize
+ zfs) size=$(lctl get_param osc.$FSNAME*.import |
+ awk '/grant_block_size:/ {print $2/512; exit;}')
+ ;;
esac
echo -n $size