if (ret)
goto out_release;
}
- ret = posix_acl_create(&acl, GFP_NOFS, &inode->i_mode);
+ ret = __posix_acl_create(&acl, GFP_NOFS, &inode->i_mode);
if (ret < 0)
goto out;
else if (ret > 0)
out:
return ret;
}
-
-int ceph_acl_chmod(struct dentry *dentry, struct inode *inode)
-{
- struct posix_acl *acl;
- int ret = 0;
-
- if (S_ISLNK(inode->i_mode)) {
- ret = -EOPNOTSUPP;
- goto out;
- }
-
- if (!IS_POSIXACL(inode))
- goto out;
-
- acl = ceph_get_acl(inode, ACL_TYPE_ACCESS);
- if (IS_ERR_OR_NULL(acl)) {
- ret = PTR_ERR(acl);
- goto out;
- }
-
- ret = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
- if (ret)
- goto out;
- ret = ceph_set_acl(dentry, inode, acl, ACL_TYPE_ACCESS);
- posix_acl_release(acl);
-out:
- return ret;
-}
-
-static int ceph_xattr_acl_get(struct dentry *dentry, const char *name,
- void *value, size_t size, int type)
-{
- struct posix_acl *acl;
- int ret = 0;
-
- if (!IS_POSIXACL(dentry->d_inode))
- return -EOPNOTSUPP;
-
- acl = ceph_get_acl(dentry->d_inode, type);
- if (IS_ERR(acl))
- return PTR_ERR(acl);
- if (acl == NULL)
- return -ENODATA;
-
- ret = posix_acl_to_xattr(&init_user_ns, acl, value, size);
- posix_acl_release(acl);
-
- return ret;
-}
-
-static int ceph_xattr_acl_set(struct dentry *dentry, const char *name,
- const void *value, size_t size, int flags, int type)
-{
- int ret = 0;
- struct posix_acl *acl = NULL;
-
- if (!inode_owner_or_capable(dentry->d_inode)) {
- ret = -EPERM;
- goto out;
- }
-
- if (!IS_POSIXACL(dentry->d_inode)) {
- ret = -EOPNOTSUPP;
- goto out;
- }
-
- if (value) {
- acl = posix_acl_from_xattr(&init_user_ns, value, size);
- if (IS_ERR(acl)) {
- ret = PTR_ERR(acl);
- goto out;
- }
-
- if (acl) {
- ret = posix_acl_valid(acl);
- if (ret)
- goto out_release;
- }
- }
-
- ret = ceph_set_acl(dentry, dentry->d_inode, acl, type);
-
-out_release:
- posix_acl_release(acl);
-out:
- return ret;
-}
-
-const struct xattr_handler ceph_xattr_acl_default_handler = {
- .prefix = POSIX_ACL_XATTR_DEFAULT,
- .flags = ACL_TYPE_DEFAULT,
- .get = ceph_xattr_acl_get,
- .set = ceph_xattr_acl_set,
-};
-
-const struct xattr_handler ceph_xattr_acl_access_handler = {
- .prefix = POSIX_ACL_XATTR_ACCESS,
- .flags = ACL_TYPE_ACCESS,
- .get = ceph_xattr_acl_get,
- .set = ceph_xattr_acl_set,
-};
extern void ceph_xattr_exit(void);
/* acl.c */
-extern const struct xattr_handler ceph_xattr_acl_access_handler;
-extern const struct xattr_handler ceph_xattr_acl_default_handler;
extern const struct xattr_handler *ceph_xattr_handlers[];
#ifdef CONFIG_CEPH_FS_POSIX_ACL
struct posix_acl *ceph_get_acl(struct inode *, int);
int ceph_init_acl(struct dentry *, struct inode *, struct inode *);
-int ceph_acl_chmod(struct dentry *, struct inode *);
void ceph_forget_all_cached_acls(struct inode *inode);
#else
#include <linux/ceph/decode.h>
#include <linux/xattr.h>
+#include <linux/posix_acl_xattr.h>
#include <linux/slab.h>
#define XATTR_CEPH_PREFIX "ceph."
*/
const struct xattr_handler *ceph_xattr_handlers[] = {
#ifdef CONFIG_CEPH_FS_POSIX_ACL
- &ceph_xattr_acl_access_handler,
- &ceph_xattr_acl_default_handler,
+ &posix_acl_access_xattr_handler,
+ &posix_acl_default_xattr_handler,
#endif
NULL,
};