diff --git a/sys/dev/ata/ata_raid_subr.c b/sys/dev/ata/ata_raid_subr.c index cb6789331a5..d406d3d0e5d 100644 --- a/sys/dev/ata/ata_raid_subr.c +++ b/sys/dev/ata/ata_raid_subr.c @@ -77,19 +77,11 @@ ata_raid_disk_vnode_find(struct ataraid_disk_info *adi) bmajor = devsw_name2blk(device_xname(adi->adi_dev), NULL, 0); dev = MAKEDISKDEV(bmajor, device_unit(adi->adi_dev), RAW_PART); - error = bdevvp(dev, &vp); + error = vn_bdev_open(dev, &vp, curlwp); if (error) { kmem_free(adv, sizeof(struct ataraid_disk_vnode)); return NULL; } - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - error = VOP_OPEN(vp, FREAD|FWRITE, NOCRED); - if (error) { - vput(vp); - kmem_free(adv, sizeof(struct ataraid_disk_vnode)); - return NULL; - } - VOP_UNLOCK(vp); adv->adv_adi = adi; adv->adv_vnode = vp; diff --git a/sys/dev/ata/ld_ataraid.c b/sys/dev/ata/ld_ataraid.c index 977b5888a5f..84b5872b839 100644 --- a/sys/dev/ata/ld_ataraid.c +++ b/sys/dev/ata/ld_ataraid.c @@ -226,7 +226,10 @@ ld_ataraid_attach(device_t parent, device_t self, void *aux) */ for (i = 0; i < aai->aai_ndisks; i++) { adi = &aai->aai_disks[i]; - vp = ata_raid_disk_vnode_find(adi); + if (adi->adi_status & ADI_S_ONLINE) + vp = ata_raid_disk_vnode_find(adi); + else + vp = NULL; if (vp == NULL) { /* * XXX This is bogus. We should just mark the