Module Name:    src
Committed By:   dholland
Date:           Sun Jun 16 20:46:24 UTC 2013

Modified Files:
        src/sys/miscfs/specfs: spec_vnops.c

Log Message:
Hang a warning banner on some nasty code I just found.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/miscfs/specfs/spec_vnops.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/miscfs/specfs/spec_vnops.c
diff -u src/sys/miscfs/specfs/spec_vnops.c:1.137 src/sys/miscfs/specfs/spec_vnops.c:1.138
--- src/sys/miscfs/specfs/spec_vnops.c:1.137	Wed Feb 13 14:03:48 2013
+++ src/sys/miscfs/specfs/spec_vnops.c	Sun Jun 16 20:46:24 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: spec_vnops.c,v 1.137 2013/02/13 14:03:48 hannken Exp $	*/
+/*	$NetBSD: spec_vnops.c,v 1.138 2013/06/16 20:46:24 dholland 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.137 2013/02/13 14:03:48 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.138 2013/06/16 20:46:24 dholland Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -683,12 +683,28 @@ spec_read(void *v)
 		if (uio->uio_offset < 0)
 			return (EINVAL);
 		bsize = BLKDEV_IOSIZE;
+
+		/*
+		 * dholland 20130616: XXX this logic should not be
+		 * here. It is here because the old buffer cache
+		 * demands that all accesses to the same blocks need
+		 * to be the same size; but it only works for FFS and
+		 * nowadays I think it'll fail silently if the size
+		 * info in the disklabel is wrong. (Or missing.) The
+		 * buffer cache needs to be smarter; or failing that
+		 * we need a reliable way here to get the right block
+		 * size; or a reliable way to guarantee that (a) the
+		 * fs is not mounted when we get here and (b) any
+		 * buffers generated here will get purged when the fs
+		 * does get mounted.
+		 */
 		if (bdev_ioctl(vp->v_rdev, DIOCGPART, &dpart, FREAD, l) == 0) {
 			if (dpart.part->p_fstype == FS_BSDFFS &&
 			    dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
 				bsize = dpart.part->p_frag *
 				    dpart.part->p_fsize;
 		}
+
 		bscale = bsize >> DEV_BSHIFT;
 		do {
 			bn = (uio->uio_offset >> DEV_BSHIFT) &~ (bscale - 1);

Reply via email to