|
@@ -45,7 +45,7 @@ static struct vfsmount *shm_mnt;
|
|
#include <linux/xattr.h>
|
|
#include <linux/xattr.h>
|
|
#include <linux/exportfs.h>
|
|
#include <linux/exportfs.h>
|
|
#include <linux/posix_acl.h>
|
|
#include <linux/posix_acl.h>
|
|
-#include <linux/generic_acl.h>
|
|
|
|
|
|
+#include <linux/posix_acl_xattr.h>
|
|
#include <linux/mman.h>
|
|
#include <linux/mman.h>
|
|
#include <linux/string.h>
|
|
#include <linux/string.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/slab.h>
|
|
@@ -620,10 +620,8 @@ static int shmem_setattr(struct dentry *dentry, struct iattr *attr)
|
|
}
|
|
}
|
|
|
|
|
|
setattr_copy(inode, attr);
|
|
setattr_copy(inode, attr);
|
|
-#ifdef CONFIG_TMPFS_POSIX_ACL
|
|
|
|
if (attr->ia_valid & ATTR_MODE)
|
|
if (attr->ia_valid & ATTR_MODE)
|
|
- error = generic_acl_chmod(inode);
|
|
|
|
-#endif
|
|
|
|
|
|
+ error = posix_acl_chmod(inode, inode->i_mode);
|
|
return error;
|
|
return error;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1937,22 +1935,14 @@ shmem_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
|
|
|
|
|
|
inode = shmem_get_inode(dir->i_sb, dir, mode, dev, VM_NORESERVE);
|
|
inode = shmem_get_inode(dir->i_sb, dir, mode, dev, VM_NORESERVE);
|
|
if (inode) {
|
|
if (inode) {
|
|
-#ifdef CONFIG_TMPFS_POSIX_ACL
|
|
|
|
- error = generic_acl_init(inode, dir);
|
|
|
|
- if (error) {
|
|
|
|
- iput(inode);
|
|
|
|
- return error;
|
|
|
|
- }
|
|
|
|
-#endif
|
|
|
|
|
|
+ error = simple_acl_create(dir, inode);
|
|
|
|
+ if (error)
|
|
|
|
+ goto out_iput;
|
|
error = security_inode_init_security(inode, dir,
|
|
error = security_inode_init_security(inode, dir,
|
|
&dentry->d_name,
|
|
&dentry->d_name,
|
|
shmem_initxattrs, NULL);
|
|
shmem_initxattrs, NULL);
|
|
- if (error) {
|
|
|
|
- if (error != -EOPNOTSUPP) {
|
|
|
|
- iput(inode);
|
|
|
|
- return error;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ if (error && error != -EOPNOTSUPP)
|
|
|
|
+ goto out_iput;
|
|
|
|
|
|
error = 0;
|
|
error = 0;
|
|
dir->i_size += BOGO_DIRENT_SIZE;
|
|
dir->i_size += BOGO_DIRENT_SIZE;
|
|
@@ -1961,6 +1951,9 @@ shmem_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
|
|
dget(dentry); /* Extra count - pin the dentry in core */
|
|
dget(dentry); /* Extra count - pin the dentry in core */
|
|
}
|
|
}
|
|
return error;
|
|
return error;
|
|
|
|
+out_iput:
|
|
|
|
+ iput(inode);
|
|
|
|
+ return error;
|
|
}
|
|
}
|
|
|
|
|
|
static int
|
|
static int
|
|
@@ -1974,24 +1967,17 @@ shmem_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
|
|
error = security_inode_init_security(inode, dir,
|
|
error = security_inode_init_security(inode, dir,
|
|
NULL,
|
|
NULL,
|
|
shmem_initxattrs, NULL);
|
|
shmem_initxattrs, NULL);
|
|
- if (error) {
|
|
|
|
- if (error != -EOPNOTSUPP) {
|
|
|
|
- iput(inode);
|
|
|
|
- return error;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-#ifdef CONFIG_TMPFS_POSIX_ACL
|
|
|
|
- error = generic_acl_init(inode, dir);
|
|
|
|
- if (error) {
|
|
|
|
- iput(inode);
|
|
|
|
- return error;
|
|
|
|
- }
|
|
|
|
-#else
|
|
|
|
- error = 0;
|
|
|
|
-#endif
|
|
|
|
|
|
+ if (error && error != -EOPNOTSUPP)
|
|
|
|
+ goto out_iput;
|
|
|
|
+ error = simple_acl_create(dir, inode);
|
|
|
|
+ if (error)
|
|
|
|
+ goto out_iput;
|
|
d_tmpfile(dentry, inode);
|
|
d_tmpfile(dentry, inode);
|
|
}
|
|
}
|
|
return error;
|
|
return error;
|
|
|
|
+out_iput:
|
|
|
|
+ iput(inode);
|
|
|
|
+ return error;
|
|
}
|
|
}
|
|
|
|
|
|
static int shmem_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
|
|
static int shmem_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
|
|
@@ -2223,8 +2209,8 @@ static int shmem_initxattrs(struct inode *inode,
|
|
|
|
|
|
static const struct xattr_handler *shmem_xattr_handlers[] = {
|
|
static const struct xattr_handler *shmem_xattr_handlers[] = {
|
|
#ifdef CONFIG_TMPFS_POSIX_ACL
|
|
#ifdef CONFIG_TMPFS_POSIX_ACL
|
|
- &generic_acl_access_handler,
|
|
|
|
- &generic_acl_default_handler,
|
|
|
|
|
|
+ &posix_acl_access_xattr_handler,
|
|
|
|
+ &posix_acl_default_xattr_handler,
|
|
#endif
|
|
#endif
|
|
NULL
|
|
NULL
|
|
};
|
|
};
|
|
@@ -2740,6 +2726,7 @@ static const struct inode_operations shmem_inode_operations = {
|
|
.getxattr = shmem_getxattr,
|
|
.getxattr = shmem_getxattr,
|
|
.listxattr = shmem_listxattr,
|
|
.listxattr = shmem_listxattr,
|
|
.removexattr = shmem_removexattr,
|
|
.removexattr = shmem_removexattr,
|
|
|
|
+ .set_acl = simple_set_acl,
|
|
#endif
|
|
#endif
|
|
};
|
|
};
|
|
|
|
|
|
@@ -2764,6 +2751,7 @@ static const struct inode_operations shmem_dir_inode_operations = {
|
|
#endif
|
|
#endif
|
|
#ifdef CONFIG_TMPFS_POSIX_ACL
|
|
#ifdef CONFIG_TMPFS_POSIX_ACL
|
|
.setattr = shmem_setattr,
|
|
.setattr = shmem_setattr,
|
|
|
|
+ .set_acl = simple_set_acl,
|
|
#endif
|
|
#endif
|
|
};
|
|
};
|
|
|
|
|
|
@@ -2776,6 +2764,7 @@ static const struct inode_operations shmem_special_inode_operations = {
|
|
#endif
|
|
#endif
|
|
#ifdef CONFIG_TMPFS_POSIX_ACL
|
|
#ifdef CONFIG_TMPFS_POSIX_ACL
|
|
.setattr = shmem_setattr,
|
|
.setattr = shmem_setattr,
|
|
|
|
+ .set_acl = simple_set_acl,
|
|
#endif
|
|
#endif
|
|
};
|
|
};
|
|
|
|
|