On Sun, Sep 24, 2017 at 01:32:03AM -0700, Matthew Wilcox wrote: > On Sat, Sep 23, 2017 at 06:10:14PM -0500, Goldwyn Rodrigues wrote: > > In case direct I/O encounters an error midway, it returns the error. > > Instead it should be returning the number of bytes transferred so far. > > > > Test case (with ENOSPC): > > 1. Create an almost full filesystem > > 2. Create a file, say /mnt/lastfile, until the filesystem is full. > > 3. Direct write() with count > sizeof /mnt/lastfile. > > > > Result: write() returns -ENOSPC. However, file content has data written > > in step 3. > > Can you add an xfstest to be sure we don't regress this in the future? And please test and if needed fix (I think it will need fixing) the code in fs/iomap.c and fs/block_dev.c as well. I remember intentionally copying the old behavior over there, assuming we had a good reasom for it.