Commit 7c0f82da authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] direct-IO: fix i_size handling on ENOSPC

When an appending O_DIRECT write hits ENOSPC we're returning a short write
which is _too_ short.  The file ends up with an undersized i_size and fsck
complains.

So update the return value with the partial result before bailing out.
parent 5f44f4a9
......@@ -892,15 +892,14 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
ret = do_direct_IO(dio);
if (ret) {
dio_cleanup(dio);
break;
}
dio->result += iov[seg].iov_len -
((dio->final_block_in_request - dio->block_in_file) <<
blkbits);
if (ret) {
dio_cleanup(dio);
break;
}
} /* end iovec loop */
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment