Re: [GIT PULL] overlayfs update for 5.15

From: Linus Torvalds
Date: Thu Sep 02 2021 - 12:35:57 EST


On Thu, Sep 2, 2021 at 6:51 AM Miklos Szeredi <miklos@xxxxxxxxxx> wrote:
>
> The reason this touches so many files is that the ->get_acl() method now
> gets a "bool rcu" argument. The ->get_acl() API was updated based on
> comments from Al and Linus:
>
> https://lore.kernel.org/linux-fsdevel/CAJfpeguQxpd6Wgc0Jd3ks77zcsAv_bn0q17L3VNnnmPKu11t8A@xxxxxxxxxxxxxx/

That link might have been good in the individual commit message too,
but I did it in the merge commit instead.

I did notice that we now have a stale comment about ->get_acl() in fs/namei.c:

acl = get_cached_acl_rcu(inode, ACL_TYPE_ACCESS);
if (!acl)
return -EAGAIN;
/* no ->get_acl() calls in RCU mode... */
if (is_uncached_acl(acl))
return -ECHILD;

but we actually did the RCU-mode ->get_acl() call already in
get_cached_acl_rcu().

Of course, get_cached_acl_rcu() only does it for ACL_DONT_CACHE, not
for ACL_NOT_CACHED, so RCU mode is still a bit special.

At some point we probably should make get_cached_acl_rcu() do the
right thing for a successful lookup with ACL_NOT_CACHED set too, and
actually install the newly looked-up ACL. But I haven't thought much
about locking (but I think it would be ok, we use "cmpxchg" to update
the cached entry).

This is just a "maybe fixme for the future" note about that comment
and about get_cached_acl_rcu() behavior. I've pulled this, and I think
we're ok, it's just a small oddity.

Linus