Source-Changes-HG archive

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

[src/netbsd-9]: src/external/cddl/osnet/dist/lib/libzfs/common Pull up follow...



details:   https://anonhg.NetBSD.org/src/rev/1b9b3efa4408
branches:  netbsd-9
changeset: 369724:1b9b3efa4408
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Aug 29 15:39:39 2022 +0000

description:
Pull up following revision(s) (requested by riastradh in ticket #1503):

        external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c: revision 1.7
        external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c: revision 1.6

When collecting zpool devices, skip disks with wedges so that a
concurrent test of a wedge on that disk doesn't fail.

libzfs: Zero DIOCLWEDGES input before ioctl.

Otherwise we ask the kernel to write over whatever random pointer was
in the stack garbage here, when all we wanted was to learn whether
dkwl_nwedges is zero or nonzero.

XXX pullup-9

diffstat:

 external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c |  9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diffs (21 lines):

diff -r 5725c7cc005d -r 1b9b3efa4408 external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c
--- a/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c        Sun Aug 28 13:30:53 2022 +0000
+++ b/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c        Mon Aug 29 15:39:39 2022 +0000
@@ -1095,8 +1095,17 @@
        }
 #endif /* __FreeBSD__ */
 #ifdef __NetBSD__
+       struct dkwedge_list dkwl;
        off_t size;
 
+       /* skip devices with wedges */
+       memset(&dkwl, 0, sizeof(dkwl));
+       if (native_ioctl(fd, DIOCLWEDGES, &dkwl) == 0 &&
+           dkwl.dkwl_nwedges > 0) {
+               (void) close(fd);
+               return;
+       }
+
        if (native_ioctl(fd, DIOCGMEDIASIZE, &size) < 0 ||
            size < SPA_MINDEVSIZE) {
                (void) close(fd);



Home | Main Index | Thread Index | Old Index