Skip to contentSkip to conversation

ocfs2: fix remounting needed after setfacl command

PATCH Applied Gang He 2 participants 2 messages Jul 17, 2020 – Jul 20, 2020 OCFS2

lore
Share & tools
lore

Gang He

author
#0 lore raw

PATCH 1/1 ocfs2: fix remounting needed after setfacl command

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.
e.g.
setfacl -m u:ivan:rw /ocfs2/ivan
getfacl /ocfs2/ivan
getfacl: Removing leading '/' from absolute path names
file: ocfs2/ivan
owner: root
group: root
user::rw-
group::r--
mask::r--
other::r--

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

---
 fs/ocfs2/acl.c | 2 ++
 1 file changed, 2 insertions(+)
fs/ocfs2/acl.c +2 -0
index bb981ec76456..7b07f5df3a29 100644
@@ -256,6 +256,8 @@ static int ocfs2_set_acl(handle_t *handle,
 		ret = ocfs2_xattr_set(inode, name_index, "", value, size, 0);
 
 	kfree(value);
+	if (!ret)
+		set_cached_acl(inode, type, acl);
 
 	return ret;
 }
Signature · 1 line
2.12.3
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Gang He

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.
e.g.
setfacl -m u:ivan:rw /ocfs2/ivan
getfacl /ocfs2/ivan
getfacl: Removing leading '/' from absolute path names
file: ocfs2/ivan
owner: root
group: root
user::rw-
group::r--
mask::r--
other::r--

Quoted 4 lines

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

Quoted 18 lines
---
 fs/ocfs2/acl.c | 2 ++
 1 file changed, 2 insertions(+)
fs/ocfs2/acl.c +2 -0
index bb981ec76456..7b07f5df3a29 100644
@@ -256,6 +256,8 @@ static int ocfs2_set_acl(handle_t *handle,
 		ret = ocfs2_xattr_set(inode, name_index, "", value, size, 0);
 
 	kfree(value);
+	if (!ret)
+		set_cached_acl(inode, type, acl);
 
 	return ret;
 }