diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-10-03 20:38:55 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-10-03 20:38:55 -0400 |
commit | 4038acdb187e226e72df393ae3dd150df857e8a3 (patch) | |
tree | 8c911f14f9c22808b0f52827e562d2ff3d6dedf9 /fs/direct-io.c | |
parent | 08895a8b6b06ed2323cd97a36ee40a116b3db8ed (diff) | |
download | linux-4038acdb187e226e72df393ae3dd150df857e8a3.tar.gz linux-4038acdb187e226e72df393ae3dd150df857e8a3.tar.bz2 linux-4038acdb187e226e72df393ae3dd150df857e8a3.zip |
consistent treatment of EFAULT on O_DIRECT read/write
Make local filesystems treat a fault as shortened IO,
returning -EFAULT only if nothing had been transferred.
That's how everything else (NFS, FUSE, ceph, Lustre)
behaves.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/direct-io.c')
-rw-r--r-- | fs/direct-io.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c index 7c3ce73cb617..fb9aa16a7727 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -246,6 +246,9 @@ static ssize_t dio_complete(struct dio *dio, ssize_t ret, bool is_async) if ((dio->op == REQ_OP_READ) && ((offset + transferred) > dio->i_size)) transferred = dio->i_size - offset; + /* ignore EFAULT if some IO has been done */ + if (unlikely(ret == -EFAULT) && transferred) + ret = 0; } if (ret == 0) |