1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00

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
This commit is contained in:
Konstantin Belousov 2012-07-02 09:53:08 +00:00
parent 46c13bb43f
commit 9d232eec30
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=237987

View File

@ -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 @@ ncl_write(struct vop_write_args *ap)
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);