diff options
author | Christoph Hellwig <hch@infradead.org> | 2013-12-20 08:16:54 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-01-26 08:26:40 -0500 |
commit | feda821e76f3bbbba4bd54d30b4d4005a7848aa5 (patch) | |
tree | ebd9b6935393c4764dd8ac2f55251380ee9c9319 /mm/shmem.c | |
parent | 013cdf1088d7235da9477a2375654921d9b9ba9f (diff) |
fs: remove generic_acl
And instead convert tmpfs to use the new generic ACL code, with two stub
methods provided for in-memory filesystems.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/shmem.c')
-rw-r--r-- | mm/shmem.c | 57 |
1 files changed, 23 insertions, 34 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 902a14842b74..b21ca543458c 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -45,7 +45,7 @@ static struct vfsmount *shm_mnt; | |||
45 | #include <linux/xattr.h> | 45 | #include <linux/xattr.h> |
46 | #include <linux/exportfs.h> | 46 | #include <linux/exportfs.h> |
47 | #include <linux/posix_acl.h> | 47 | #include <linux/posix_acl.h> |
48 | #include <linux/generic_acl.h> | 48 | #include <linux/posix_acl_xattr.h> |
49 | #include <linux/mman.h> | 49 | #include <linux/mman.h> |
50 | #include <linux/string.h> | 50 | #include <linux/string.h> |
51 | #include <linux/slab.h> | 51 | #include <linux/slab.h> |
@@ -620,10 +620,8 @@ static int shmem_setattr(struct dentry *dentry, struct iattr *attr) | |||
620 | } | 620 | } |
621 | 621 | ||
622 | setattr_copy(inode, attr); | 622 | setattr_copy(inode, attr); |
623 | #ifdef CONFIG_TMPFS_POSIX_ACL | ||
624 | if (attr->ia_valid & ATTR_MODE) | 623 | if (attr->ia_valid & ATTR_MODE) |
625 | error = generic_acl_chmod(inode); | 624 | error = posix_acl_chmod(inode, inode->i_mode); |
626 | #endif | ||
627 | return error; | 625 | return error; |
628 | } | 626 | } |
629 | 627 | ||
@@ -1937,22 +1935,14 @@ shmem_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) | |||
1937 | 1935 | ||
1938 | inode = shmem_get_inode(dir->i_sb, dir, mode, dev, VM_NORESERVE); | 1936 | inode = shmem_get_inode(dir->i_sb, dir, mode, dev, VM_NORESERVE); |
1939 | if (inode) { | 1937 | if (inode) { |
1940 | #ifdef CONFIG_TMPFS_POSIX_ACL | 1938 | error = simple_acl_create(dir, inode); |
1941 | error = generic_acl_init(inode, dir); | 1939 | if (error) |
1942 | if (error) { | 1940 | goto out_iput; |
1943 | iput(inode); | ||
1944 | return error; | ||
1945 | } | ||
1946 | #endif | ||
1947 | error = security_inode_init_security(inode, dir, | 1941 | error = security_inode_init_security(inode, dir, |
1948 | &dentry->d_name, | 1942 | &dentry->d_name, |
1949 | shmem_initxattrs, NULL); | 1943 | shmem_initxattrs, NULL); |
1950 | if (error) { | 1944 | if (error && error != -EOPNOTSUPP) |
1951 | if (error != -EOPNOTSUPP) { | 1945 | goto out_iput; |
1952 | iput(inode); | ||
1953 | return error; | ||
1954 | } | ||
1955 | } | ||
1956 | 1946 | ||
1957 | error = 0; | 1947 | error = 0; |
1958 | dir->i_size += BOGO_DIRENT_SIZE; | 1948 | dir->i_size += BOGO_DIRENT_SIZE; |
@@ -1961,6 +1951,9 @@ shmem_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) | |||
1961 | dget(dentry); /* Extra count - pin the dentry in core */ | 1951 | dget(dentry); /* Extra count - pin the dentry in core */ |
1962 | } | 1952 | } |
1963 | return error; | 1953 | return error; |
1954 | out_iput: | ||
1955 | iput(inode); | ||
1956 | return error; | ||
1964 | } | 1957 | } |
1965 | 1958 | ||
1966 | static int | 1959 | static int |
@@ -1974,24 +1967,17 @@ shmem_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
1974 | error = security_inode_init_security(inode, dir, | 1967 | error = security_inode_init_security(inode, dir, |
1975 | NULL, | 1968 | NULL, |
1976 | shmem_initxattrs, NULL); | 1969 | shmem_initxattrs, NULL); |
1977 | if (error) { | 1970 | if (error && error != -EOPNOTSUPP) |
1978 | if (error != -EOPNOTSUPP) { | 1971 | goto out_iput; |
1979 | iput(inode); | 1972 | error = simple_acl_create(dir, inode); |
1980 | return error; | 1973 | if (error) |
1981 | } | 1974 | goto out_iput; |
1982 | } | ||
1983 | #ifdef CONFIG_TMPFS_POSIX_ACL | ||
1984 | error = generic_acl_init(inode, dir); | ||
1985 | if (error) { | ||
1986 | iput(inode); | ||
1987 | return error; | ||
1988 | } | ||
1989 | #else | ||
1990 | error = 0; | ||
1991 | #endif | ||
1992 | d_tmpfile(dentry, inode); | 1975 | d_tmpfile(dentry, inode); |
1993 | } | 1976 | } |
1994 | return error; | 1977 | return error; |
1978 | out_iput: | ||
1979 | iput(inode); | ||
1980 | return error; | ||
1995 | } | 1981 | } |
1996 | 1982 | ||
1997 | static int shmem_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | 1983 | static int shmem_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
@@ -2223,8 +2209,8 @@ static int shmem_initxattrs(struct inode *inode, | |||
2223 | 2209 | ||
2224 | static const struct xattr_handler *shmem_xattr_handlers[] = { | 2210 | static const struct xattr_handler *shmem_xattr_handlers[] = { |
2225 | #ifdef CONFIG_TMPFS_POSIX_ACL | 2211 | #ifdef CONFIG_TMPFS_POSIX_ACL |
2226 | &generic_acl_access_handler, | 2212 | &posix_acl_access_xattr_handler, |
2227 | &generic_acl_default_handler, | 2213 | &posix_acl_default_xattr_handler, |
2228 | #endif | 2214 | #endif |
2229 | NULL | 2215 | NULL |
2230 | }; | 2216 | }; |
@@ -2740,6 +2726,7 @@ static const struct inode_operations shmem_inode_operations = { | |||
2740 | .getxattr = shmem_getxattr, | 2726 | .getxattr = shmem_getxattr, |
2741 | .listxattr = shmem_listxattr, | 2727 | .listxattr = shmem_listxattr, |
2742 | .removexattr = shmem_removexattr, | 2728 | .removexattr = shmem_removexattr, |
2729 | .set_acl = simple_set_acl, | ||
2743 | #endif | 2730 | #endif |
2744 | }; | 2731 | }; |
2745 | 2732 | ||
@@ -2764,6 +2751,7 @@ static const struct inode_operations shmem_dir_inode_operations = { | |||
2764 | #endif | 2751 | #endif |
2765 | #ifdef CONFIG_TMPFS_POSIX_ACL | 2752 | #ifdef CONFIG_TMPFS_POSIX_ACL |
2766 | .setattr = shmem_setattr, | 2753 | .setattr = shmem_setattr, |
2754 | .set_acl = simple_set_acl, | ||
2767 | #endif | 2755 | #endif |
2768 | }; | 2756 | }; |
2769 | 2757 | ||
@@ -2776,6 +2764,7 @@ static const struct inode_operations shmem_special_inode_operations = { | |||
2776 | #endif | 2764 | #endif |
2777 | #ifdef CONFIG_TMPFS_POSIX_ACL | 2765 | #ifdef CONFIG_TMPFS_POSIX_ACL |
2778 | .setattr = shmem_setattr, | 2766 | .setattr = shmem_setattr, |
2767 | .set_acl = simple_set_acl, | ||
2779 | #endif | 2768 | #endif |
2780 | }; | 2769 | }; |
2781 | 2770 | ||