Source-Changes-HG archive

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

[src/trunk]: src/external/cddl/osnet/dist/uts/common/fs/zfs upport wedges as ...



details:   https://anonhg.NetBSD.org/src/rev/f791ff07adfd
branches:  trunk
changeset: 999248:f791ff07adfd
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sun May 26 10:22:59 2019 +0000

description:
upport wedges as vdevs, use DIOCGWEDGEINFO before DIOCGPARTINFO.

PR kern/54219 zpool create pool dk5 causes kernel panic

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c |  18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (43 lines):

diff -r 2f473e0af374 -r f791ff07adfd external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c    Sun May 26 10:22:07 2019 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c    Sun May 26 10:22:59 2019 +0000
@@ -34,6 +34,7 @@
 #include <sys/zio.h>
 #include <sys/sunldi.h>
 #include <sys/fm/fs/zfs.h>
+#include <sys/disk.h>
 #include <sys/disklabel.h>
 #include <sys/dkio.h>
 #include <sys/workqueue.h>
@@ -146,6 +147,8 @@
        spa_t *spa = vd->vdev_spa;
        vdev_disk_t *dvd;
        vnode_t *vp;
+       struct dkwedge_info dkw;
+       struct disk *pdk;
        int error, cmd;
        struct partinfo pinfo;
 
@@ -235,9 +238,20 @@
 skip_open:
        /*
         * Determine the actual size of the device.
-        * XXXNETBSD wedges.
+        * Try wedge info first as it supports larger disks.
         */
-       error = VOP_IOCTL(vp, DIOCGPARTINFO, &pinfo, FREAD|FWRITE, kcred);
+       error = VOP_IOCTL(vp, DIOCGWEDGEINFO, &dkw, FREAD, NOCRED);
+       if (error == 0) {
+               pdk = disk_find(dkw.dkw_parent);
+               if (pdk) {
+                       pinfo.pi_secsize = (1 << pdk->dk_byteshift);
+                       pinfo.pi_size = dkw.dkw_size;
+                       pinfo.pi_offset = dkw.dkw_offset;
+               } else  
+                       error = ENODEV;
+       }
+       if (error)
+               error = VOP_IOCTL(vp, DIOCGPARTINFO, &pinfo, FREAD, kcred);
        if (error != 0) {
                vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED;
                return (SET_ERROR(error));



Home | Main Index | Thread Index | Old Index