Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ata Don't set LDF_ENABLED unless the device is reall...



details:   https://anonhg.NetBSD.org/src/rev/5fcf9aa31dd5
branches:  trunk
changeset: 542455:5fcf9aa31dd5
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Jan 29 16:50:37 2003 +0000

description:
Don't set LDF_ENABLED unless the device is really okay.  Noted by
Andrew Doran.

diffstat:

 sys/dev/ata/ld_ataraid.c |  20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diffs (58 lines):

diff -r 23e576072d2d -r 5fcf9aa31dd5 sys/dev/ata/ld_ataraid.c
--- a/sys/dev/ata/ld_ataraid.c  Wed Jan 29 14:12:35 2003 +0000
+++ b/sys/dev/ata/ld_ataraid.c  Wed Jan 29 16:50:37 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld_ataraid.c,v 1.2 2003/01/27 20:18:11 thorpej Exp $   */
+/*     $NetBSD: ld_ataraid.c,v 1.3 2003/01/29 16:50:37 thorpej Exp $   */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -130,7 +130,6 @@
 
        sc->sc_aai = aai;       /* this data persists */
 
-       ld->sc_flags = LDF_ENABLED;
        ld->sc_maxxfer = MAXPHYS * aai->aai_width;      /* XXX */
        ld->sc_secperunit = aai->aai_capacity;
        ld->sc_secsize = 512;                           /* XXX */
@@ -192,7 +191,7 @@
                dev = MAKEDISKDEV(bmajor, adi->adi_dev->dv_unit, RAW_PART);
                error = bdevvp(dev, &vp);
                if (error)
-                       goto bad;
+                       break;
                error = VOP_OPEN(vp, FREAD|FWRITE, NOCRED, 0);
                if (error) {
                        vput(vp);
@@ -201,21 +200,26 @@
                         * XXX component as FAILED, and write-back new
                         * XXX config blocks.
                         */
-                       goto bad;
+                       break;
                }
 
                VOP_UNLOCK(vp, 0);
                sc->sc_vnodes[i] = vp;
        }
+       if (i == aai->aai_ndisks) {
+               ld->sc_flags = LDF_ENABLED;
+               goto finish;
+       }
 
-       ldattach(ld);
-       return;
- bad:
        for (i = 0; i < aai->aai_ndisks; i++) {
                vp = sc->sc_vnodes[i];
                sc->sc_vnodes[i] = NULL;
-               (void) vn_close(vp, FREAD|FWRITE, NOCRED, curproc);
+               if (vp != NULL)
+                       (void) vn_close(vp, FREAD|FWRITE, NOCRED, curproc);
        }
+
+ finish:
+       ldattach(ld);
 }
 
 static struct cbuf *



Home | Main Index | Thread Index | Old Index