diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2012-07-02 09:53:08 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2012-07-02 09:53:08 +0000 |
commit | 9d232eec30a058c1c21b4bf254a5b471605dac48 (patch) | |
tree | dbd1c8f38453a30da2102b65b21496be9c1efaaa /sys/fs | |
parent | 46c13bb43f7c9d873b1accb1f48ba56a63f1fe10 (diff) | |
download | src-9d232eec30a058c1c21b4bf254a5b471605dac48.tar.gz src-9d232eec30a058c1c21b4bf254a5b471605dac48.zip |
Do not override an error from uiomove() with (non-)error result from
bwrite(). VFS needs to know about EFAULT from uiomove() and does not
care much that partially filled block writeback after EFAULT was
successfull. Early return without error causes short write to be
reported to usermode.
Reported and tested by: andreast
MFC after: 3 weeks
Notes
Notes:
svn path=/head/; revision=237987
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/nfsclient/nfs_clbio.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index 71286e36aea0..f7af6fb94c29 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -897,7 +897,7 @@ ncl_write(struct vop_write_args *ap) struct nfsmount *nmp = VFSTONFS(vp->v_mount); daddr_t lbn; int bcount; - int bp_cached, n, on, error = 0; + int bp_cached, n, on, error = 0, error1; size_t orig_resid, local_resid; off_t orig_size, tmp_off; @@ -1259,9 +1259,12 @@ again: if ((ioflag & IO_SYNC)) { if (ioflag & IO_INVAL) bp->b_flags |= B_NOCACHE; - error = bwrite(bp); - if (error) + error1 = bwrite(bp); + if (error1 != 0) { + if (error == 0) + error = error1; break; + } } else if ((n + on) == biosize) { bp->b_flags |= B_ASYNC; (void) ncl_writebp(bp, 0, NULL); |