geom access method and g_topology_lock

Poul-Henning Kamp phk at phk.freebsd.dk
Thu Oct 25 07:28:40 UTC 2012


--------
In message <5088E0E0.2080307 at FreeBSD.org>, Andriy Gapon writes:

>The problem is that the following innocent-looking code may become not quite so
>innocent:
>
>g_topology_assert();
>g_access(cp, -1, 0, -1);
>/* a lot might have happened between these two lines */
>g_detach(cp);
>g_destroy_consumer(cp);


It really depends what "a lot" actually is.

It is perfectly legal and acceptable for a consumer to be attached to a provider
without holding an access count.

But lacking an access count, there are obviously things you cannot do to that
provider.


-- 
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 freebsd-geom mailing list