Re: [PATCH] fix race in mark_mounts_for_expiry()

From: Miklos Szeredi
Date: Wed May 18 2005 - 14:22:11 EST


> First of all the reason this race exists implies Al Viro may have had
> assertion in his mind that "All tasks that have access to a namespace
> has a refcount on that namespace". If that was what he was thinking,
> than the I would stick with that assertion being true. The overall idea
> I am thinking off is:
>
> 1) have the automounter hold a refcount on any new namespace created
> the mounts in which the automounter has interest in.
> 2) have a refcount on the namespace when a new task gains access to
> a namespace through the file descriptor or any other
> similar mechanisms and remove the reference
> once the fd gets closed. (bit tricky to implement)
>
> Do you agree with the overall idea?

I don't really understand it.

A reference count usually means, the number of references (pointers)
to an object. You can sometimes get away with schemes that deviate
from this in various ways, but it's usually asking for trouble.

The usage in mark_mounts_for_expiry() deviated from it so much, that
the result was a subtle race.

Doing some tricky thing like what you propose will just likely
introduce more subtle problems.

Miklos
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/