Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Nov 2005 10:19:40 +0100
From:      "Poul-Henning Kamp" <phk@phk.freebsd.dk>
To:        Nate Lawson <nate@root.org>
Cc:        John Polstra <jdp@FreeBSD.org>, cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/cam/scsi scsi_cd.c scsi_da.c src/sys/geom geom_disk.c geom_disk.h geom_subr.c 
Message-ID:  <6759.1132305580@critter.freebsd.dk>
In-Reply-To: Your message of "Thu, 17 Nov 2005 21:46:29 PST." <437D6AB5.7020306@root.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <437D6AB5.7020306@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@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6759.1132305580>