cvs commit: src/sys/cam/scsi scsi_cd.c scsi_da.c src/sys/geom geom_disk.c geom_disk.h geom_subr.c

Poul-Henning Kamp phk at phk.freebsd.dk
Fri Nov 18 09:52:44 GMT 2005


In message <437D6AB5.7020306 at root.org>, Nate Lawson writes:

>> +void
>> +disk_gone(struct disk *dp)
>> +{
>> +	struct g_geom *gp;
>> +	struct g_provider *pp;
>> +
>> +	gp = dp->d_geom;
>> +	if (gp != NULL)
>> +		LIST_FOREACH(pp, &gp->provider, provider)
>> +			g_orphan_provider(pp, ENXIO);
>> +}
>> +
>
>Does there need to be locking for this list traversal?  Couldn't 
>disk_gone() race in parallel with a taste event if someone plugs/unplugs 
>quickly, especially for a slow device (i.e. floppy)?

Disk gone is called by the driver which owns struct disk, so nobody
else has any business messing with that particular list.

Obviously the driver needs to not stomp on itself, but Giant does
that for CAM.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the cvs-src mailing list