Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ocfs2: drop acl cache for directories too

ocfs2_data_convert_worker() is currently dropping any cached acl info
for FILE before down-converting meta lock. It should also drop for
DIRECTORY. Otherwise the second acl lookup returns the cached one (from
VFS layer) which could be already stale.

The problem we are seeing is that the acl changes on one node doesn't
get refreshed on other nodes in the following case:

Node 1 Node 2
-------------- ----------------
getfacl dir1

getfacl dir1 <-- this is OK

setfacl -m u:user1:rwX dir1
getfacl dir1 <-- see the change for user1

getfacl dir1 <-- can't see change for user1

Link: https://lkml.kernel.org/r/20210903012631.6099-1-wen.gang.wang@oracle.com
Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Wengang Wang and committed by
Linus Torvalds
9c0f0a03 de6ee659

+2 -1
+2 -1
fs/ocfs2/dlmglue.c
··· 3951 3951 oi = OCFS2_I(inode); 3952 3952 oi->ip_dir_lock_gen++; 3953 3953 mlog(0, "generation: %u\n", oi->ip_dir_lock_gen); 3954 - goto out; 3954 + goto out_forget; 3955 3955 } 3956 3956 3957 3957 if (!S_ISREG(inode->i_mode)) ··· 3982 3982 filemap_fdatawait(mapping); 3983 3983 } 3984 3984 3985 + out_forget: 3985 3986 forget_all_cached_acls(inode); 3986 3987 3987 3988 out: