diff options
Diffstat (limited to 'sys/dev/softraid.c')
-rw-r--r-- | sys/dev/softraid.c | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index f86d0fcc94b..df9d63562a9 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.213 2010/09/07 17:14:06 deraadt Exp $ */ +/* $OpenBSD: softraid.c,v 1.214 2010/09/23 18:49:39 oga Exp $ */ /* * Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -322,7 +322,7 @@ sr_meta_probe(struct sr_discipline *sd, dev_t *dt, int no_chunk) * XXX leaving dev open for now; move this to attach * and figure out the open/close dance for unwind. */ - error = VOP_OPEN(vn, FREAD | FWRITE, NOCRED, 0); + error = VOP_OPEN(vn, FREAD | FWRITE, NOCRED, curproc); if (error) { DNPRINTF(SR_D_META,"%s: sr_meta_probe can't " "open %s\n", DEVNAME(sc), devname); @@ -900,7 +900,7 @@ sr_meta_native_bootprobe(struct sr_softc *sc, dev_t devno, } /* open device */ - error = VOP_OPEN(vn, FREAD, NOCRED, 0); + error = VOP_OPEN(vn, FREAD, NOCRED, curproc); if (error) { DNPRINTF(SR_D_META, "%s: sr_meta_native_bootprobe open " "failed\n", DEVNAME(sc)); @@ -909,17 +909,18 @@ sr_meta_native_bootprobe(struct sr_softc *sc, dev_t devno, } /* get disklabel */ - error = VOP_IOCTL(vn, DIOCGDINFO, (caddr_t)&label, FREAD, NOCRED, 0); + error = VOP_IOCTL(vn, DIOCGDINFO, (caddr_t)&label, FREAD, NOCRED, + curproc); if (error) { DNPRINTF(SR_D_META, "%s: sr_meta_native_bootprobe ioctl " "failed\n", DEVNAME(sc)); - VOP_CLOSE(vn, FREAD, NOCRED, 0); + VOP_CLOSE(vn, FREAD, NOCRED, curproc); vput(vn); goto done; } /* we are done, close device */ - error = VOP_CLOSE(vn, FREAD, NOCRED, 0); + error = VOP_CLOSE(vn, FREAD, NOCRED, curproc); if (error) { DNPRINTF(SR_D_META, "%s: sr_meta_native_bootprobe close " "failed\n", DEVNAME(sc)); @@ -957,7 +958,7 @@ sr_meta_native_bootprobe(struct sr_softc *sc, dev_t devno, "vnode for partition\n", DEVNAME(sc)); goto done; } - error = VOP_OPEN(vn, FREAD, NOCRED, 0); + error = VOP_OPEN(vn, FREAD, NOCRED, curproc); if (error) { DNPRINTF(SR_D_META, "%s: sr_meta_native_bootprobe " "open failed, partition %d\n", @@ -969,14 +970,14 @@ sr_meta_native_bootprobe(struct sr_softc *sc, dev_t devno, if (sr_meta_native_read(fake_sd, rawdev, md, NULL)) { printf("%s: native bootprobe could not read native " "metadata\n", DEVNAME(sc)); - VOP_CLOSE(vn, FREAD, NOCRED, 0); + VOP_CLOSE(vn, FREAD, NOCRED, curproc); vput(vn); continue; } /* are we a softraid partition? */ if (md->ssdi.ssd_magic != SR_MAGIC) { - VOP_CLOSE(vn, FREAD, NOCRED, 0); + VOP_CLOSE(vn, FREAD, NOCRED, curproc); vput(vn); continue; } @@ -999,7 +1000,7 @@ sr_meta_native_bootprobe(struct sr_softc *sc, dev_t devno, } /* we are done, close partition */ - VOP_CLOSE(vn, FREAD, NOCRED, 0); + VOP_CLOSE(vn, FREAD, NOCRED, curproc); vput(vn); } @@ -1368,7 +1369,7 @@ sr_meta_native_probe(struct sr_softc *sc, struct sr_chunk *ch_entry) /* get disklabel */ error = VOP_IOCTL(ch_entry->src_vn, DIOCGDINFO, (caddr_t)&label, FREAD, - NOCRED, 0); + NOCRED, curproc); if (error) { DNPRINTF(SR_D_META, "%s: %s can't obtain disklabel\n", DEVNAME(sc), devname); @@ -2374,7 +2375,7 @@ sr_hotspare(struct sr_softc *sc, dev_t dev) printf("%s:, sr_hotspare: can't allocate vnode\n", DEVNAME(sc)); goto done; } - if (VOP_OPEN(vn, FREAD | FWRITE, NOCRED, 0)) { + if (VOP_OPEN(vn, FREAD | FWRITE, NOCRED, curproc)) { DNPRINTF(SR_D_META,"%s: sr_hotspare cannot open %s\n", DEVNAME(sc), devname); vput(vn); @@ -2384,10 +2385,11 @@ sr_hotspare(struct sr_softc *sc, dev_t dev) /* Get partition details. */ part = DISKPART(dev); - if (VOP_IOCTL(vn, DIOCGDINFO, (caddr_t)&label, FREAD, NOCRED, 0)) { + if (VOP_IOCTL(vn, DIOCGDINFO, (caddr_t)&label, FREAD, + NOCRED, curproc)) { DNPRINTF(SR_D_META, "%s: sr_hotspare ioctl failed\n", DEVNAME(sc)); - VOP_CLOSE(vn, FREAD | FWRITE, NOCRED, 0); + VOP_CLOSE(vn, FREAD | FWRITE, NOCRED, curproc); vput(vn); goto fail; } @@ -2498,7 +2500,7 @@ done: if (sm) free(sm, M_DEVBUF); if (open) { - VOP_CLOSE(vn, FREAD | FWRITE, NOCRED, 0); + VOP_CLOSE(vn, FREAD | FWRITE, NOCRED, curproc); vput(vn); } @@ -2671,7 +2673,7 @@ sr_rebuild_init(struct sr_discipline *sd, dev_t dev, int hotspare) goto done; } - if (VOP_OPEN(vn, FREAD | FWRITE, NOCRED, 0)) { + if (VOP_OPEN(vn, FREAD | FWRITE, NOCRED, curproc)) { DNPRINTF(SR_D_META,"%s: sr_ioctl_setstate can't " "open %s\n", DEVNAME(sc), devname); vput(vn); @@ -2681,7 +2683,8 @@ sr_rebuild_init(struct sr_discipline *sd, dev_t dev, int hotspare) /* get partition */ part = DISKPART(dev); - if (VOP_IOCTL(vn, DIOCGDINFO, (caddr_t)&label, FREAD, NOCRED, 0)) { + if (VOP_IOCTL(vn, DIOCGDINFO, (caddr_t)&label, FREAD, + NOCRED, curproc)) { DNPRINTF(SR_D_META, "%s: sr_ioctl_setstate ioctl failed\n", DEVNAME(sc)); goto done; @@ -2745,7 +2748,7 @@ sr_rebuild_init(struct sr_discipline *sd, dev_t dev, int hotspare) rv = 0; done: if (open) { - VOP_CLOSE(vn, FREAD | FWRITE, NOCRED, 0); + VOP_CLOSE(vn, FREAD | FWRITE, NOCRED, curproc); vput(vn); } @@ -3318,8 +3321,10 @@ sr_chunks_unwind(struct sr_softc *sc, struct sr_chunk_head *cl) * the problem introduced by vnode aliasing... specfs * has no locking, whereas ufs/ffs does! */ - vn_lock(ch_entry->src_vn, LK_EXCLUSIVE | LK_RETRY, 0); - VOP_CLOSE(ch_entry->src_vn, FREAD | FWRITE, NOCRED, 0); + vn_lock(ch_entry->src_vn, LK_EXCLUSIVE | + LK_RETRY, curproc); + VOP_CLOSE(ch_entry->src_vn, FREAD | FWRITE, NOCRED, + curproc); vput(ch_entry->src_vn); } free(ch_entry, M_DEVBUF); |