From owner-svn-src-head@FreeBSD.ORG Mon Jul 2 09:53:09 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3061E1065670; Mon, 2 Jul 2012 09:53:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5D0D8FC08; Mon, 2 Jul 2012 09:53:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q629r8JG061962; Mon, 2 Jul 2012 09:53:08 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q629r8kf061960; Mon, 2 Jul 2012 09:53:08 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207020953.q629r8kf061960@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 2 Jul 2012 09:53:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237987 - head/sys/fs/nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 09:53:09 -0000 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);