Re: [PATCH 2/2] selftests/fuse: add ACL_DONT_CACHE regression test

Amir Goldstein <[email protected]> Thu, 16 Jul 2026 12:12:58 +0200
Newsgroups dev.linux.lists.fuse-devel,org.kernel.vger.linux-fsdevel
Message-ID <CAOQ4uxhO-eJ=QU_okX0y8TgjZcn1-UnB-myNawmXLk2ACjOieg@mail.gmail.com>
On Tue, Jul 14, 2026 at 12:09=E2=80=AFAM Amir Goldstein <[email protected]=
> wrote:
>
> Add a test that reproduces the stale ACL bug fixed by:
>   "fs: preserve ACL_DONT_CACHE state in forget_cached_acl()"
>
> A FUSE mount that does not negotiate FUSE_POSIX_ACL initialises inodes
> with i_acl =3D ACL_DONT_CACHE.  Before the fix, calling
> forget_all_cached_acls() (e.g. from fuse_update_get_attr() on a
> statx(AT_STATX_FORCE_SYNC)) would silently replace ACL_DONT_CACHE with
> ACL_NOT_CACHED, enabling the kernel ACL cache.  A subsequent getxattr
> would populate the cache, and because fuse_set_acl() skips
> forget_all_cached_acls() for !fc->posix_acl, later ACL changes were
> not visible to callers =E2=80=94 getxattr returned stale data.
>
> The test mounts a minimal libfuse3 lowlevel filesystem (no
> FUSE_POSIX_ACL negotiated) and:
>   1. Issues two getxattrs =E2=80=94 both must reach the daemon, proving
>      ACL_DONT_CACHE suppresses caching before any trigger.
>   2. Calls statx(AT_STATX_FORCE_SYNC) to trigger forget_all_cached_acls()=
.
>   3. Issues another getxattr (populates the cache on a buggy kernel).
>   4. Switches the daemon to a different-sized ACL (ACL_B).
>   5. Issues a final getxattr =E2=80=94 expects ACL_B (44 bytes) and daemo=
n
>      call count 4; a buggy kernel returns stale ACL_A (28 bytes).
>
> fuse_acl_cache_test is only built when libfuse3 is detected via
> pkg-config.
>
> Signed-off-by: Amir Goldstein <[email protected]>
> ---

> +static int do_force_statx(const char *path)
> +{
> +       struct statx stx;
> +
> +       return syscall(SYS_statx, AT_FDCWD, path,
> +                      AT_STATX_FORCE_SYNC, STATX_BASIC_STATS, &stx);
> +}
> +

Christian,

If no other comments require me sending v2, please change this to plain
statx() on commit.

Thanks Luis for pointing this out.
Amir.