tech-kern archive

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

Re: In-kernel units for block numbers, etc ...



    Date:        Sun, 29 Nov 2015 01:22:08 +0700
    From:        Robert Elz <kre%munnari.OZ.AU@localhost>
    Message-ID:  <19896.1448734928%andromeda.noi.kre.to@localhost>

  | Stuff related to PR 41704 generating a panic in my setup ...
  | Anyone have any suggestions?

Actually, the (or a) fix for this is astoundingly easy, and I'm
perplexed why it hasn't been fixed in the 6 years that the PR has
been open, or the 13 years since the core was first written ...

A patch that fixes it (for me, tested with the previous kernel,
splat panic (div by 0 if it matters) without this fix, and with
this applied, all works fine - tested configuring cgd2 as the
only configured CGD from a device with 4K sectors).

I am also going append the patch to the PR, but that's just for completeness,
getting working patches from gnats mail is insanely difficult,
getting it from this message should be easy.

The patch applies after Michael van Elst's fixes from yesterday (or earlier
today, depending upon your timezone)

kre

--- cgd.c	2015-11-29 02:34:23.000000000 +0700
+++ cgd.c.fixed	2015-11-29 02:32:11.000000000 +0700
@@ -107,7 +107,7 @@
 static int	cgd_diskstart(device_t, struct buf *);
 static void	cgdiodone(struct buf *);
 
-static int	cgd_ioctl_set(struct cgd_softc *, void *, struct lwp *);
+static int	cgd_ioctl_set(dev_t, struct cgd_softc *, void *, struct lwp *);
 static int	cgd_ioctl_clr(struct cgd_softc *, struct lwp *);
 static int	cgd_ioctl_get(dev_t, void *, struct lwp *);
 static int	cgdinit(struct cgd_softc *, const char *, struct vnode *,
@@ -553,7 +553,7 @@
 	case CGDIOCSET:
 		if (DK_ATTACHED(dksc))
 			return EBUSY;
-		return cgd_ioctl_set(cs, data, l);
+		return cgd_ioctl_set(dev, cs, data, l);
 	case CGDIOCCLR:
 		if (DK_BUSY(&cs->sc_dksc, pmask))
 			return EBUSY;
@@ -612,7 +612,7 @@
 
 /* ARGSUSED */
 static int
-cgd_ioctl_set(struct cgd_softc *cs, void *data, struct lwp *l)
+cgd_ioctl_set(dev_t dev, struct cgd_softc *cs, void *data, struct lwp *l)
 {
 	struct	 cgd_ioctl *ci = data;
 	struct	 vnode *vp;
@@ -712,7 +712,7 @@
 	disk_set_info(dksc->sc_dev, &dksc->sc_dkdev, NULL);
 
 	/* Try and read the disklabel. */
-	dk_getdisklabel(dksc, 0 /* XXX ? (cause of PR 41704) */);
+	dk_getdisklabel(dksc, dev);
 
 	/* Discover wedges on this disk. */
 	dkwedge_discover(&dksc->sc_dkdev);




Home | Main Index | Thread Index | Old Index