NFS: Don't use SetPageError in the NFS writeback code
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Sat, 15 Dec 2012 22:12:14 +0000 (17:12 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Sat, 15 Dec 2012 22:12:14 +0000 (17:12 -0500)
commitada8e20d044c0fa5610e504ce6fb4578ebd3edd9
tree262c1f77aa99dcd23e1d4e08f9468b712a837591
parent1efc28780bf84f04dcce4f3f7242e4e6a59bffd4
NFS: Don't use SetPageError in the NFS writeback code

The writeback code is already capable of passing errors back to user space
by means of the open_context->error. In the case of ENOSPC, Neil Brown
is reporting seeing 2 errors being returned.

Neil writes:

"e.g. if /mnt2/ if an nfs mounted filesystem that has no space then

strace dd if=/dev/zero conv=fsync >> /mnt2/afile count=1

reported Input/output error and the relevant parts of the strace output are:

write(1, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
fsync(1)                                = -1 EIO (Input/output error)
close(1)                                = -1 ENOSPC (No space left on device)"

Neil then shows that the duplication of error messages appears to be due to
the use of the PageError() mechanism, which causes filemap_fdatawait_range
to return the extra EIO. The regression was introduced by
commit 7b281ee026552f10862b617a2a51acf49c829554 (NFS: fsync() must exit
with an error if page writeback failed).

Fix this by removing the call to SetPageError(), and just relying on
open_context->error reporting the ENOSPC back to fsync().

Reported-by: Neil Brown <neilb@suse.de>
Tested-by: Neil Brown <neilb@suse.de>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@vger.kernel.org [3.6+]
fs/nfs/write.c