perror("read");
exit(save_errno);
}
- if (rc < len)
- fprintf(stderr, "short read: %u/%u\n",
- rc, len);
+ if (rc < len) {
+ fprintf(stderr, "short read: %u/%u\n",
+ rc, len);
+ if (rc == 0)
+ exit(ENODATA);
+ }
len -= rc;
if (verbose >= 2)
printf("%.*s\n", rc, buf_align);
{ skip "Need free space ${size}M, have $space" && return; }
echo Creating ${size}M test file $file
- dd if=/dev/zero of=$file bs=1M count=$size
+ dd if=/dev/zero of=$file bs=1M count=$size || error "dd failed"
echo Cancel LRU locks on lustre client to flush the client cache
cancel_lru_locks osc
while [ $i -le 10 ]; do
lctl mark "start test"
- local before=$($LFS df | awk '{if ($1 ~/^filesystem/) \
- {print $5; exit} }')
- dd if=/dev/zero of=$DIR1/$tdir/file000 bs=1M count=$SIZE
- sync # sync data from client's cache
- sync_all_data # sync data from server's cache (delayed
- # allocation)
+ local before=$($LFS df | awk '{ if ($1 ~/^filesystem/) \
+ { print $5; exit} }')
+ dd if=/dev/zero of=$DIR1/$tdir/$tfile bs=1M count=$SIZE ||
+ error "dd $DIR1/$tdir/$tfile ${SIZE}MB failed"
+ sync # sync data from client cache
+ sync_all_data # sync data from server cache (delayed allocation)
sleep 1
- local after_dd=$($LFS df | awk '{if ($1 ~/^filesystem/) \
- {print $5; exit} }')
- multiop_bg_pause $DIR2/$tdir/file000 O_r${SIZE_B}c || return 3
+ local after_dd=$($LFS df | awk '{ if ($1 ~/^filesystem/) \
+ { print $5; exit} }')
+ multiop_bg_pause $DIR2/$tdir/$tfile O_r${SIZE_B}c || return 3
read_pid=$!
- rm -f $DIR1/$tdir/file000
+ rm -f $DIR1/$tdir/$tfile
kill -USR1 $read_pid
wait $read_pid
wait_delete_completed
- local after=$($LFS df | awk '{if ($1 ~/^filesystem/) \
- {print $5; exit} }')
+ local after=$($LFS df | awk '{ if ($1 ~/^filesystem/) \
+ { print $5; exit} }')
echo "*** cycle($i) *** before($before) after_dd($after_dd)" \
"after($after)"
# this free space! not used