Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Jul 2012 09:53:08 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r237987 - head/sys/fs/nfsclient
Message-ID:  <201207020953.q629r8kf061960@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Jul  2 09:53:08 2012
New Revision: 237987
URL: http://svn.freebsd.org/changeset/base/237987

Log:
  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

Modified:
  head/sys/fs/nfsclient/nfs_clbio.c

Modified: head/sys/fs/nfsclient/nfs_clbio.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clbio.c	Mon Jul  2 09:47:38 2012	(r237986)
+++ head/sys/fs/nfsclient/nfs_clbio.c	Mon Jul  2 09:53:08 2012	(r237987)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207020953.q629r8kf061960>