summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authorjdp <jdp@FreeBSD.org>2005-11-18 02:43:49 +0000
committerjdp <jdp@FreeBSD.org>2005-11-18 02:43:49 +0000
commit536960dbba6409b86ac8cba48c8eebec0ee4d3bc (patch)
treefd8fdcdbe252a0fea49dd01324b56a12740040f9 /sys/cam
parent1f2553e461911eee3bd762d61effbef7d0b8cc45 (diff)
downloadFreeBSD-src-536960dbba6409b86ac8cba48c8eebec0ee4d3bc.zip
FreeBSD-src-536960dbba6409b86ac8cba48c8eebec0ee4d3bc.tar.gz
Fix a bug that caused some /dev entries to continue to exist after
the underlying drive had been hot-unplugged from the system. Here is a specific example. Filesystem code had opened /dev/da1s1e. Subsequently, the drive was hot-unplugged. This (correctly) caused all of the associated /dev/da1* entries to be deleted. When the filesystem later realized that the drive was gone it closed the device, reducing the write-access counts to 0 on the geom providers for da1s1e, da1s1, and da1. This caused geom to re-taste the providers, resulting in the devices being created again. When the drive was hot-plugged back in, it resulted in duplicate /dev entries for da1s1e, da1s1, and da1. This fix adds a new disk_gone() function which is called by CAM when a drive goes away. It orphans all of the providers associated with the drive, setting an error condition of ENXIO in each one. In addition, we prevent a re-taste on last close for writing if an error condition has been set in the provider. Sponsored by: Isilon Systems Reviewed by: phk MFC after: 1 week
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/scsi/scsi_cd.c1
-rw-r--r--sys/cam/scsi/scsi_da.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c
index d0b2bb2..04f9bb4 100644
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -407,6 +407,7 @@ cdoninvalidate(struct cam_periph *periph)
&& (softc->pinfo.index != CAM_UNQUEUED_INDEX))
camq_remove(&softc->changer->devq, softc->pinfo.index);
+ disk_gone(softc->disk);
xpt_print_path(periph->path);
printf("lost device\n");
}
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 30b320c..273fadc 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -801,6 +801,7 @@ daoninvalidate(struct cam_periph *periph)
SLIST_REMOVE(&softc_list, softc, da_softc, links);
+ disk_gone(softc->disk);
xpt_print_path(periph->path);
printf("lost device\n");
}
OpenPOWER on IntegriCloud