Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4038acdb authored by Al Viro's avatar Al Viro
Browse files

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: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 08895a8b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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)