Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/miscfs/specfs when determining I/O block size for VBLK d...



details:   https://anonhg.NetBSD.org/src/rev/32ce4c446551
branches:  trunk
changeset: 1009140:32ce4c446551
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Mon Apr 13 20:02:27 2020 +0000

description:
when determining I/O block size for VBLK device, only use pi_bsize
returned by DIOCGPARTINFO if it's bigger than DEV_BSIZE and less
than MAXBSIZE (MAXPHYS)

fixes panic "buf mem pool index 8" in buf_mempoolidx() when the
disklabel contains bsize 128KB and something reads the block device -
buffer cache can't allocate bufs bigger than MAXPHYS

diffstat:

 sys/miscfs/specfs/spec_vnops.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 281854394cec -r 32ce4c446551 sys/miscfs/specfs/spec_vnops.c
--- a/sys/miscfs/specfs/spec_vnops.c    Mon Apr 13 19:23:17 2020 +0000
+++ b/sys/miscfs/specfs/spec_vnops.c    Mon Apr 13 20:02:27 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: spec_vnops.c,v 1.176 2019/09/22 22:59:39 christos Exp $        */
+/*     $NetBSD: spec_vnops.c,v 1.177 2020/04/13 20:02:27 jdolecek Exp $        */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.176 2019/09/22 22:59:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.177 2020/04/13 20:02:27 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -717,7 +717,7 @@
                        return (EINVAL);
 
                if (bdev_ioctl(vp->v_rdev, DIOCGPARTINFO, &pi, FREAD, l) == 0)
-                       bsize = pi.pi_bsize;
+                       bsize = imin(imax(pi.pi_bsize, DEV_BSIZE), MAXBSIZE);
                else
                        bsize = BLKDEV_IOSIZE;
 
@@ -786,7 +786,7 @@
                        return (EINVAL);
 
                if (bdev_ioctl(vp->v_rdev, DIOCGPARTINFO, &pi, FREAD, l) == 0)
-                       bsize = pi.pi_bsize;
+                       bsize = imin(imax(pi.pi_bsize, DEV_BSIZE), MAXBSIZE);
                else
                        bsize = BLKDEV_IOSIZE;
 



Home | Main Index | Thread Index | Old Index