[SRU Bionic/Focal 1/2] ocfs2: fix remounting needed after setfacl command

Thadeu Lima de Souza Cascardo cascardo at canonical.com
Thu Oct 14 13:51:58 UTC 2021

From: Gang He <ghe at suse.com>


When use setfacl command to change a file's acl, the user cannot get the
latest acl information from the file via getfacl command, until remounting
the file system.

setfacl -m u:ivan:rw /ocfs2/ivan
getfacl /ocfs2/ivan
getfacl: Removing leading '/' from absolute path names
file: ocfs2/ivan
owner: root
group: root

The latest acl record("u:ivan:rw") cannot be returned via getfacl
command until remounting.

Signed-off-by: Gang He <ghe at suse.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Reviewed-by: Joseph Qi <joseph.qi at linux.alibaba.com>
Cc: Mark Fasheh <mark at fasheh.com>
Cc: Joel Becker <jlbec at evilplan.org>
Cc: Junxiao Bi <junxiao.bi at oracle.com>
Cc: Changwei Ge <gechangwei at live.cn>
Cc: Jun Piao <piaojun at huawei.com>
Link: http://lkml.kernel.org/r/20200717023751.9922-1-ghe@suse.com
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
(cherry picked from commit 504ec37dfdfbf9c65166c51f7b12126d2a9b18dc)
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo at canonical.com>
 fs/ocfs2/acl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
index bb981ec76456..7b07f5df3a29 100644
--- a/fs/ocfs2/acl.c
+++ b/fs/ocfs2/acl.c
@@ -256,6 +256,8 @@ static int ocfs2_set_acl(handle_t *handle,
 		ret = ocfs2_xattr_set(inode, name_index, "", value, size, 0);
+	if (!ret)
+		set_cached_acl(inode, type, acl);
 	return ret;

More information about the kernel-team mailing list