fuse: fix revalidation of attributes for permission check
authorMiklos Szeredi <mszeredi@redhat.com>
Mon, 3 Dec 2018 09:14:43 +0000 (10:14 +0100)
committerMiklos Szeredi <mszeredi@redhat.com>
Mon, 3 Dec 2018 09:14:43 +0000 (10:14 +0100)
fuse_invalidate_attr() now sets fi->inval_mask instead of fi->i_time, hence
we need to check the inval mask in fuse_permission() as well.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Fixes: 2f1e81965fd0 ("fuse: allow fine grained attr cache invaldation")
fs/fuse/dir.c

index 56931dfdcc46a1a5fe8c0d186f202482e327bc67..dc4e83d8ace7bdb4ac7947081c4570cea0ba46a3 100644 (file)
@@ -1119,8 +1119,10 @@ static int fuse_permission(struct inode *inode, int mask)
        if (fc->default_permissions ||
            ((mask & MAY_EXEC) && S_ISREG(inode->i_mode))) {
                struct fuse_inode *fi = get_fuse_inode(inode);
+               u32 perm_mask = STATX_MODE | STATX_UID | STATX_GID;
 
-               if (time_before64(fi->i_time, get_jiffies_64())) {
+               if (perm_mask & READ_ONCE(fi->inval_mask) ||
+                   time_before64(fi->i_time, get_jiffies_64())) {
                        refreshed = true;
 
                        err = fuse_perm_getattr(inode, mask);