From: Aneesh Kumar K.V Date: Fri, 11 Jun 2010 16:12:51 +0530 Subject: [PATCH 15/16] ext4: Use IS_POSIXACL() to check for POSIX ACL support Patch-mainline: not yet Use IS_POSIXACL() instead of a file system specific mount flag since we have IS_POSIXACL() in the vfs already, anyway. Signed-off-by: Aneesh Kumar K.V Signed-off-by: Andreas Gruenbacher --- fs/ext4/acl.c | 16 ++++++++-------- fs/ext4/ext4.h | 1 - fs/ext4/super.c | 16 +++++----------- 3 files changed, 13 insertions(+), 20 deletions(-) --- a/fs/ext4/acl.c +++ b/fs/ext4/acl.c @@ -139,7 +139,7 @@ ext4_get_acl(struct inode *inode, int ty struct posix_acl *acl; int retval; - if (!test_opt(inode->i_sb, POSIX_ACL)) + if (!IS_POSIXACL(inode)) return NULL; acl = get_cached_acl(inode, type); @@ -266,7 +266,7 @@ ext4_init_acl(handle_t *handle, struct i int error = 0; if (!S_ISLNK(inode->i_mode)) { - if (test_opt(dir->i_sb, POSIX_ACL)) { + if (IS_POSIXACL(inode)) { acl = ext4_get_acl(dir, ACL_TYPE_DEFAULT); if (IS_ERR(acl)) return PTR_ERR(acl); @@ -274,7 +274,7 @@ ext4_init_acl(handle_t *handle, struct i if (!acl) inode->i_mode &= ~current_umask(); } - if (test_opt(inode->i_sb, POSIX_ACL) && acl) { + if (IS_POSIXACL(inode) && acl) { struct posix_acl *clone; mode_t mode; @@ -328,7 +328,7 @@ ext4_acl_chmod(struct inode *inode) if (S_ISLNK(inode->i_mode)) return -EOPNOTSUPP; - if (!test_opt(inode->i_sb, POSIX_ACL)) + if (!IS_POSIXACL(inode)) return 0; acl = ext4_get_acl(inode, ACL_TYPE_ACCESS); if (IS_ERR(acl) || !acl) @@ -370,7 +370,7 @@ ext4_xattr_list_acl_access(struct dentry { const size_t size = sizeof(POSIX_ACL_XATTR_ACCESS); - if (!test_opt(dentry->d_sb, POSIX_ACL)) + if (!IS_POSIXACL(dentry->d_inode)) return 0; if (list && size <= list_len) memcpy(list, POSIX_ACL_XATTR_ACCESS, size); @@ -383,7 +383,7 @@ ext4_xattr_list_acl_default(struct dentr { const size_t size = sizeof(POSIX_ACL_XATTR_DEFAULT); - if (!test_opt(dentry->d_sb, POSIX_ACL)) + if (!IS_POSIXACL(dentry->d_inode)) return 0; if (list && size <= list_len) memcpy(list, POSIX_ACL_XATTR_DEFAULT, size); @@ -399,7 +399,7 @@ ext4_xattr_get_acl(struct dentry *dentry if (strcmp(name, "") != 0) return -EINVAL; - if (!test_opt(dentry->d_sb, POSIX_ACL)) + if (!IS_POSIXACL(dentry->d_inode)) return -EOPNOTSUPP; acl = ext4_get_acl(dentry->d_inode, type); @@ -424,7 +424,7 @@ ext4_xattr_set_acl(struct dentry *dentry if (strcmp(name, "") != 0) return -EINVAL; - if (!test_opt(inode->i_sb, POSIX_ACL)) + if (!IS_POSIXACL(dentry->d_inode)) return -EOPNOTSUPP; if (!is_owner_or_cap(inode)) return -EPERM; --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -875,7 +875,6 @@ struct ext4_inode_info { #define EXT4_MOUNT_UPDATE_JOURNAL 0x01000 /* Update the journal format */ #define EXT4_MOUNT_NO_UID32 0x02000 /* Disable 32-bit UIDs */ #define EXT4_MOUNT_XATTR_USER 0x04000 /* Extended user attributes */ -#define EXT4_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */ #define EXT4_MOUNT_NO_AUTO_DA_ALLOC 0x10000 /* No auto delalloc mapping */ #define EXT4_MOUNT_BARRIER 0x20000 /* Use block barriers */ #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */ --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -974,9 +974,9 @@ static int ext4_show_options(struct seq_ } #endif #ifdef CONFIG_EXT4_FS_POSIX_ACL - if (test_opt(sb, POSIX_ACL) && !(def_mount_opts & EXT4_DEFM_ACL)) + if ((sb->s_flags & MS_POSIXACL) && !(def_mount_opts & EXT4_DEFM_ACL)) seq_puts(seq, ",acl"); - if (!test_opt(sb, POSIX_ACL) && (def_mount_opts & EXT4_DEFM_ACL)) + if (!(sb->s_flags & MS_POSIXACL) && (def_mount_opts & EXT4_DEFM_ACL)) seq_puts(seq, ",noacl"); #endif if (sbi->s_commit_interval != JBD2_DEFAULT_MAX_COMMIT_AGE*HZ) { @@ -1481,10 +1481,10 @@ static int parse_options(char *options, #endif #ifdef CONFIG_EXT4_FS_POSIX_ACL case Opt_acl: - set_opt(sb, POSIX_ACL); + sb->s_flags |= MS_POSIXACL; break; case Opt_noacl: - clear_opt(sb, POSIX_ACL); + sb->s_flags &= ~MS_POSIXACL; break; #else case Opt_acl: @@ -2644,7 +2644,7 @@ static int ext4_fill_super(struct super_ #endif #ifdef CONFIG_EXT4_FS_POSIX_ACL if (def_mount_opts & EXT4_DEFM_ACL) - set_opt(sb, POSIX_ACL); + sb->s_flags |= MS_POSIXACL; #endif if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA) set_opt(sb, JOURNAL_DATA); @@ -2691,9 +2691,6 @@ static int ext4_fill_super(struct super_ &journal_ioprio, NULL, 0)) goto failed_mount; - sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | - (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); - if (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV && (EXT4_HAS_COMPAT_FEATURE(sb, ~0U) || EXT4_HAS_RO_COMPAT_FEATURE(sb, ~0U) || @@ -3753,9 +3750,6 @@ static int ext4_remount(struct super_blo if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) ext4_abort(sb, "Abort forced by user"); - sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | - (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); - es = sbi->s_es; if (sbi->s_journal) {