error out if ENOSPC during file layout
authorKushal Kumaran <kushal@locationd.net>
Fri, 20 Nov 2020 05:00:05 +0000 (21:00 -0800)
committerJens Axboe <axboe@kernel.dk>
Sun, 22 Nov 2020 16:54:44 +0000 (09:54 -0700)
commit9107a641e67f27003fa6cbe7b55b1ec6a0239197
tree1df285bb6a4bf2f79feaa3d073713fb0c014ed10
parent2ee239fb084355e115cf8c2bf8051e8807c4222a
error out if ENOSPC during file layout

Hi,

When I run fio with --create_only=1 and it runs out of space, it still
exits with status 0.  I could not figure out if this was intentional
(except for the fill_device case, where this is obviously the expected
behavior).

$ cat ~/fio
[global]
ioengine=posixaio
rw=readwrite
size=2g
directory=${HOME}/mounts/testdisk
thread=1

[trivial-readwrite-1g]
$ df -h .
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop6      976M  2.6M  907M   1% /home/kushal/mounts/testdisk
$ fio ~/fio --create_only=1
trivial-readwrite-1g: (g=0): rw=rw, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=pos
ixaio, iodepth=1
fio-3.12
Starting 1 thread
trivial-readwrite-1g: Laying out IO file (1 file / 2048MiB)
fio: ENOSPC on laying out file, stopping

Run status group 0 (all jobs):

Disk stats (read/write):
  loop6: ios=0/0, merge=0/0, ticks=0/0, in_queue=0, util=0.00%
$ echo $?
0

A trivial patch for this gives me the behavior I expect.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
filesetup.c