Skip to content

Commit

Permalink
consistent treatment of EFAULT on O_DIRECT read/write
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Al Viro committed Oct 4, 2016
1 parent 08895a8 commit 4038acd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/direct-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4038acd

Please sign in to comment.