Subject: softdep panic (PR/16670)
To: None <tech-kern@netbsd.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 10/14/2002 05:51:20
--NextPart-20021014055006-0041600
Content-Type: Text/Plain; charset=us-ascii

hi.

is attached patch ok?
it updates the vnode's v_size even if uiomove returns an error.
otherwise, ffs_sync(genfs_gop_write) doesn't flush dependencies for
the last block of the file.
for more details of the problem, please see PR/16670.
thanks.

YAMAMOTO Takashi

--NextPart-20021014055006-0041600
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="softdep.diff"

Index: ufs_readwrite.c
===================================================================
RCS file: /cvs/NetBSD/syssrc/sys/ufs/ufs/ufs_readwrite.c,v
retrieving revision 1.42
diff -u -p -r1.42 ufs_readwrite.c
--- ufs_readwrite.c	2002/03/25 02:23:56	1.42
+++ ufs_readwrite.c	2002/10/13 20:38:22
@@ -309,6 +309,8 @@ WRITE(void *v)
 
 	ubc_alloc_flags = UBC_WRITE;
 	while (uio->uio_resid > 0) {
+		off_t newsize;
+
 		oldoff = uio->uio_offset;
 		blkoffset = blkoff(fs, uio->uio_offset);
 		bytelen = MIN(fs->fs_bsize - blkoffset, uio->uio_resid);
@@ -348,17 +350,19 @@ WRITE(void *v)
 		    ubc_alloc_flags);
 		error = uiomove(win, bytelen, uio);
 		ubc_release(win, 0);
-		if (error) {
-			break;
-		}
 
 		/*
 		 * update UVM's notion of the size now that we've
 		 * copied the data into the vnode's pages.
 		 */
 
-		if (vp->v_size < uio->uio_offset) {
-			uvm_vnp_setsize(vp, uio->uio_offset);
+		newsize = oldoff + bytelen;
+		if (vp->v_size < newsize) {
+			uvm_vnp_setsize(vp, newsize);
+		}
+
+		if (error) {
+			break;
 		}
 
 		/*

--NextPart-20021014055006-0041600--