Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/dkwedge dk(4): Skip larval wedges in various lookup ...



details:   https://anonhg.NetBSD.org/src/rev/fc3f55edd701
branches:  trunk
changeset: 375931:fc3f55edd701
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon May 22 14:59:07 2023 +0000

description:
dk(4): Skip larval wedges in various lookup routines.

These have not yet finished a concurent dkwedge_attach, so there's
nothing we can safely do with them.  Just pretend they don't exist --
as if we had arrived at the lookup a moment earlier.

diffstat:

 sys/dev/dkwedge/dk.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (63 lines):

diff -r b5c08454153a -r fc3f55edd701 sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c      Mon May 22 14:58:59 2023 +0000
+++ b/sys/dev/dkwedge/dk.c      Mon May 22 14:59:07 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dk.c,v 1.162 2023/05/22 14:58:59 riastradh Exp $       */
+/*     $NetBSD: dk.c,v 1.163 2023/05/22 14:59:07 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.162 2023/05/22 14:58:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.163 2023/05/22 14:59:07 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -849,7 +849,7 @@ dkwedge_list(struct disk *pdk, struct dk
                if (uio.uio_resid < sizeof(dkw))
                        break;
 
-               if (sc->sc_state != DKW_STATE_RUNNING)
+               if (sc->sc_dev == NULL)
                        continue;
 
                strlcpy(dkw.dkw_devname, device_xname(sc->sc_dev),
@@ -882,7 +882,7 @@ dkwedge_find_by_wname(const char *wname)
 
        rw_enter(&dkwedges_lock, RW_READER);
        for (i = 0; i < ndkwedges; i++) {
-               if ((sc = dkwedges[i]) == NULL)
+               if ((sc = dkwedges[i]) == NULL || sc->sc_dev == NULL)
                        continue;
                if (strcmp(sc->sc_wname, wname) == 0) {
                        if (dv != NULL) {
@@ -906,7 +906,7 @@ dkwedge_find_by_parent(const char *name,
        rw_enter(&dkwedges_lock, RW_READER);
        for (; *i < (size_t)ndkwedges; (*i)++) {
                struct dkwedge_softc *sc;
-               if ((sc = dkwedges[*i]) == NULL)
+               if ((sc = dkwedges[*i]) == NULL || sc->sc_dev == NULL)
                        continue;
                if (strcmp(sc->sc_parent->dk_name, name) != 0)
                        continue;
@@ -925,7 +925,7 @@ dkwedge_print_wnames(void)
 
        rw_enter(&dkwedges_lock, RW_READER);
        for (i = 0; i < ndkwedges; i++) {
-               if ((sc = dkwedges[i]) == NULL)
+               if ((sc = dkwedges[i]) == NULL || sc->sc_dev == NULL)
                        continue;
                printf(" wedge:%s", sc->sc_wname);
        }
@@ -1844,7 +1844,7 @@ dkwedge_find_partition(device_t parent, 
 
        rw_enter(&dkwedges_lock, RW_READER);
        for (i = 0; i < ndkwedges; i++) {
-               if ((sc = dkwedges[i]) == NULL)
+               if ((sc = dkwedges[i]) == NULL || sc->sc_dev == NULL)
                        continue;
                if (strcmp(sc->sc_parent->dk_name, device_xname(parent)) == 0 &&
                    sc->sc_offset == startblk &&



Home | Main Index | Thread Index | Old Index