Re: [PATCH v7 3/7] fs/posix_acl: Document that get_acl respects ACL_DONT_CACHE
From: Linus Torvalds
Date: Mon Feb 26 2018 - 20:14:10 EST
On Mon, Feb 26, 2018 at 3:52 PM, Eric W. Biederman
<ebiederm@xxxxxxxxxxxx> wrote:
>
> Additionaly update the comment above the call to get_acl itself and
> remove the wrong information that an implementation of get_acl can
> prevent caching by calling forget_cached_acl.
This part is just confusing.
First off, that comment is correct: a filesystem _can_ prevent the
returning of cached data by just calling forget_cached_acl().
Note that there are two different cases: saying that you _never_ want
to cache things (ACL_DONT_CACHE) and saying that there _currently_ is
no cached data (ACL_NOT_CACHED).
forget_cached_acl() just removes the current cache.
You're just replacing one case of "no cached" information with the other.
Just explain the two cases, don't try to muddy the waters even more..
PLUS you are just confusing things entirely. That whole new comment of yours:
+ * ACL_DONT_CACHE is treated as another task updating the acl and
+ * remains set.
is just garbage.
The code is very clear - it will only replace a ACL_NOT_CACHED entry.
The code is clear:
if (cmpxchg(p, ACL_NOT_CACHED, sentinel) != ACL_NOT_CACHED)
/* fall through */ ;
this is basically just an atomic "if *p == ACL_NOT_CACHED then replace
it with 'sentinel'".
Your comment does not add any clarity at all, and only confuses
things. It has nothing to do with "treated as another task updating
the acl".
The fact is, ACL_DONT_CACHE is treated as if the cache is simply
already filled - it's just filled with "no cache".
So the only thing special is ACL_NOT_CACHED, which is the only thing
we will try to _replace_.
So NAK on this patch entirely. It's just adding confusion, not adding
clarifications.
Linus