[PATCH v3 3/7] xfs: Only do posix acl setup/release operation under CONFIG_XFS_POSIX_ACL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Usually, filesystem will use a function named as fs_init_acl function that belong
to acl.c and this function is externed in acl.h by using CONFIG_FS_POSIX_ACL.

If filesystem disable this switch, we should not call xfs_set_acl also not call
posix_acl_create/posix_acl_release because it is useless(We have do umask
strip in vfs).

Signed-off-by: Yang Xu <xuyang2018.jy@xxxxxxxxxxx>
---
 fs/xfs/xfs_iops.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index b34e8e4344a8..9487e68bdd3d 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -146,10 +146,12 @@ xfs_create_need_xattr(
 	struct posix_acl *default_acl,
 	struct posix_acl *acl)
 {
+#ifdef CONFIG_XFS_POSIX_ACL
 	if (acl)
 		return true;
 	if (default_acl)
 		return true;
+#endif
 #if IS_ENABLED(CONFIG_SECURITY)
 	if (dir->i_sb->s_security)
 		return true;
@@ -184,9 +186,11 @@ xfs_generic_create(
 		rdev = 0;
 	}
 
+#ifdef CONFIG_XFS_POSIX_ACL
 	error = posix_acl_create(dir, &mode, &default_acl, &acl);
 	if (error)
 		return error;
+#endif
 
 	/* Verify mode is valid also for tmpfile case */
 	error = xfs_dentry_mode_to_name(&name, dentry, mode);
@@ -241,8 +245,10 @@ xfs_generic_create(
 	xfs_finish_inode_setup(ip);
 
  out_free_acl:
+#ifdef CONFIG_XFS_POSIX_ACL
 	posix_acl_release(default_acl);
 	posix_acl_release(acl);
+#endif
 	return error;
 
  out_cleanup_inode:
-- 
2.27.0




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux