on 25/10/2012 10:28 Poul-Henning Kamp said the following:
> --------
> In message <[email protected]>, Andriy Gapon writes:

Unfortunately the questions got stripped :-)

>> 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.

To be less cryptic: there is a piece of code that tries to re-use the consumer
in certain situations.  Basically, in addition to the above snippet there is a
different snippet in a different function (oversimplified version):

g_topology_assert();
LIST_FOREACH(cp, &gp->consumer, consumer) {
        if (cp->provider == pp)
                break;
}
if (cp != NULL)
        g_access(cp, 1, 0, 1)

Both pieces look sane and non-racy (because of g_topology_assert) until we allow
g_access (some geom access method, rather) to drop the topology lock.

Hence my original questions.

I would also accept that such a re-use of a consumer is a bad idea on its own.

-- 
Andriy Gapon
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-geom
To unsubscribe, send any mail to "[email protected]"

Reply via email to