Module Name:    src
Committed By:   mlelstv
Date:           Sat Feb 22 09:36:29 UTC 2025

Modified Files:
        src/sys/uvm: uvm_swap.c

Log Message:
Keep b_resid consistent on I/O errors.


To generate a diff of this commit:
cvs rdiff -u -r1.208 -r1.209 src/sys/uvm/uvm_swap.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/uvm/uvm_swap.c
diff -u src/sys/uvm/uvm_swap.c:1.208 src/sys/uvm/uvm_swap.c:1.209
--- src/sys/uvm/uvm_swap.c:1.208	Sun Apr  9 09:00:56 2023
+++ src/sys/uvm/uvm_swap.c	Sat Feb 22 09:36:29 2025
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_swap.c,v 1.208 2023/04/09 09:00:56 riastradh Exp $	*/
+/*	$NetBSD: uvm_swap.c,v 1.209 2025/02/22 09:36:29 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.208 2023/04/09 09:00:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.209 2025/02/22 09:36:29 mlelstv Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_compat_netbsd.h"
@@ -1494,7 +1494,10 @@ out: /* Arrive here at splbio */
 	if (vnx->vx_pending == 0) {
 		error = vnx->vx_error;
 		pool_put(&vndxfer_pool, vnx);
-		bp->b_error = error;
+		if (error) {
+			bp->b_resid = bp->b_bcount;
+			bp->b_error = error;
+		}
 		biodone(bp);
 	}
 	splx(s);
@@ -1601,6 +1604,7 @@ sw_reg_iodone(struct work *wk, void *dum
 		error = vnx->vx_error;
 		if ((vnx->vx_flags & VX_BUSY) == 0 && vnx->vx_pending == 0) {
 			pbp->b_error = error;
+			pbp->b_resid = pbp->b_bcount;
 			biodone(pbp);
 			pool_put(&vndxfer_pool, vnx);
 		}

Reply via email to