Module Name:    src
Committed By:   hannken
Date:           Fri Jun 24 16:50:00 UTC 2022

Modified Files:
        src/sys/nfs: nfs_bio.c

Log Message:
Remove an incorrect assertion.

Just issue a readahead near the end of the vnode and enqueue an async read.
Now let nfs_setattr() truncate the vnode, set its new size and
nfs_vinvalbuf() waits for the pages from the readahead to become unbusy.

The async read gets processed and returns with uio_resid > 0 because there
is a hole and no write after the hole has been pushed yet.  As the vnode
size already got truncated to the new size the KASSERT() incorrectly fires.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/nfs/nfs_bio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/nfs/nfs_bio.c
diff -u src/sys/nfs/nfs_bio.c:1.200 src/sys/nfs/nfs_bio.c:1.201
--- src/sys/nfs/nfs_bio.c:1.200	Wed Oct 20 03:08:18 2021
+++ src/sys/nfs/nfs_bio.c	Fri Jun 24 16:50:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_bio.c,v 1.200 2021/10/20 03:08:18 thorpej Exp $	*/
+/*	$NetBSD: nfs_bio.c,v 1.201 2022/06/24 16:50:00 hannken Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.200 2021/10/20 03:08:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.201 2022/06/24 16:50:00 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_nfs.h"
@@ -878,8 +878,6 @@ nfs_doio_read(struct buf *bp, struct uio
 			 * Just zero fill the rest of the valid area.
 			 */
 
-			KASSERT(vp->v_size >=
-			    uiop->uio_offset + uiop->uio_resid);
 			diff = bp->b_bcount - uiop->uio_resid;
 			len = uiop->uio_resid;
 			memset((char *)bp->b_data + diff, 0, len);

Reply via email to