Skip to contentSkip to conversation

f2fs: Don't clear SGID when inheriting ACLs

PATCH In review Jaegeuk Kim 3 participants 4 messages Jul 11, 2017 – Jul 13, 2017

Subsystems (3)
lore
Share & tools
lore

Jaegeuk Kim

author maintainer
#0 lore raw

PATCH 1/1 f2fs: Don't clear SGID when inheriting ACLs

This patch copies commit b7f8a09f80:
"btrfs: Don't clear SGID when inheriting ACLs" written by Jan.

Fixes 073931017b49d9458aa351605b43a7e34598caef
---
 fs/f2fs/acl.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
fs/f2fs/acl.c +8 -5
index a140c5e3dc54..da77352c5ad3 100644
@@ -211,12 +211,8 @@ static int __f2fs_set_acl(struct inode *inode, int type,
 	switch (type) {
 	case ACL_TYPE_ACCESS:
 		name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS;
-		if (acl) {
-			error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
-			if (error)
-				return error;
+		if (acl)
 			set_acl_inode(inode, inode->i_mode);
-		}
 		break;
 
 	case ACL_TYPE_DEFAULT:
@@ -249,6 +245,13 @@ static int __f2fs_set_acl(struct inode *inode, int type,
 
 int f2fs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
 {
+	int ret;
+
+	if (type == ACL_TYPE_ACCESS && acl) {
+		ret = posix_acl_update_mode(inode, &inode->i_mode, &acl);
+		if (ret)
+			return ret;
+	}
 	return __f2fs_set_acl(inode, type, acl, NULL);
 }
 
Signature · 1 line
2.13.0.rc1.294.g07d810a77f-goog
author maintainer
#1 lore raw

This patch copies commit b7f8a09f80:
"btrfs: Don't clear SGID when inheriting ACLs" written by Jan.

Fixes 073931017b49d9458aa351605b43a7e34598caef

---

Change log from v1:
- fix for simple change

 fs/f2fs/acl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/acl.c +1 -1
index a140c5e3dc54..b4b8438c42ef 100644
@@ -211,7 +211,7 @@ static int __f2fs_set_acl(struct inode *inode, int type,
 	switch (type) {
 	case ACL_TYPE_ACCESS:
 		name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS;
-		if (acl) {
+		if (acl && !ipage) {
 			error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
 			if (error)
 				return error;
Signature · 1 line
2.13.0.rc1.294.g07d810a77f-goog
maintainer Reviewed-by
#2 lore raw
Quoted 7 lines · Jaegeuk Kim

This patch copies commit b7f8a09f80:
"btrfs: Don't clear SGID when inheriting ACLs" written by Jan.

Fixes 073931017b49d9458aa351605b43a7e34598caef

Thanks,

Quoted 22 lines

---

Change log from v1:
- fix for simple change

 fs/f2fs/acl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/acl.c +1 -1
index a140c5e3dc54..b4b8438c42ef 100644
@@ -211,7 +211,7 @@ static int __f2fs_set_acl(struct inode *inode, int type,
 	switch (type) {
 	case ACL_TYPE_ACCESS:
 		name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS;
-		if (acl) {
+		if (acl && !ipage) {
 			error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
 			if (error)
 				return error;
reviewer Reviewed-by
#3 lore raw
In reply to Jaegeuk Kim
Quoted 7 lines · Jaegeuk Kim

This patch copies commit b7f8a09f80:
"btrfs: Don't clear SGID when inheriting ACLs" written by Jan.

Fixes 073931017b49d9458aa351605b43a7e34598caef

Ah, somehow I've missed f2fs when going through filesystems that needed fixing up. Thanks for catching that. The patch looks good to me. It would just look a bit cleaner to me to move posix_acl_update_mode() call out of __f2fs_set_acl() into f2fs_set_acl() similarly as we do in other filesystems. But whatever, you are the maintainer ;) Feel free to add:

Honza

Quoted 25 lines

---

Change log from v1:
- fix for simple change

 fs/f2fs/acl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/acl.c +1 -1
index a140c5e3dc54..b4b8438c42ef 100644
@@ -211,7 +211,7 @@ static int __f2fs_set_acl(struct inode *inode, int type,
 	switch (type) {
 	case ACL_TYPE_ACCESS:
 		name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS;
-		if (acl) {
+		if (acl && !ipage) {
 			error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
 			if (error)
 				return error;
Signature · 1 line
2.13.0.rc1.294.g07d810a77f-goog
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR