mirror of
https://github.com/versity/scoutfs.git
synced 2025-12-23 05:25:18 +00:00
POSIX ACL changes.
The .get_acl() method now gets passed a mnt_idmap arg, and we can now choose to implement either .get_acl() or .get_inode_acl(). Technically .get_acl() is a new implementation, and .get_inode_acl() is the old. That second method now also gets an rcu flag passed, but we should be fine either way. Deeper under the covers however we do need to hook up the .set_acl() method for inodes, otherwise setfacl will just fail with -ENOTSUPP. To make this not super messy (it already is) we tack on the get_acl() changes here. This is all roughly ca. v6.1-rc1-4-g7420332a6ff4. Signed-off-by: Auke Kok <auke.kok@versity.com>
This commit is contained in:
@@ -478,3 +478,11 @@ endif
|
|||||||
ifneq (,$(shell grep '^unsigned int stack_trace_save' include/linux/stacktrace.h))
|
ifneq (,$(shell grep '^unsigned int stack_trace_save' include/linux/stacktrace.h))
|
||||||
ccflags-y += -DKC_STACK_TRACE_SAVE
|
ccflags-y += -DKC_STACK_TRACE_SAVE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# v6.1-rc1-4-g7420332a6ff4
|
||||||
|
#
|
||||||
|
# .get_acl() method now has dentry arg (and mnt_idmap). The old get_acl has been renamed
|
||||||
|
# to get_inode_acl() and is still available as well, but has an extra rcu param.
|
||||||
|
ifneq (,$(shell grep 'struct posix_acl ...get_acl..struct mnt_idmap ., struct dentry' include/linux/fs.h))
|
||||||
|
ccflags-y += -DKC_GET_ACL_DENTRY
|
||||||
|
endif
|
||||||
|
|||||||
@@ -107,8 +107,15 @@ struct posix_acl *scoutfs_get_acl_locked(struct inode *inode, int type, struct s
|
|||||||
return acl;
|
return acl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef KC_GET_ACL_DENTRY
|
||||||
|
struct posix_acl *scoutfs_get_acl(KC_VFS_NS_DEF
|
||||||
|
struct dentry *dentry, int type)
|
||||||
|
{
|
||||||
|
struct inode *inode = dentry->d_inode;
|
||||||
|
#else
|
||||||
struct posix_acl *scoutfs_get_acl(struct inode *inode, int type)
|
struct posix_acl *scoutfs_get_acl(struct inode *inode, int type)
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
struct super_block *sb = inode->i_sb;
|
struct super_block *sb = inode->i_sb;
|
||||||
struct scoutfs_lock *lock = NULL;
|
struct scoutfs_lock *lock = NULL;
|
||||||
struct posix_acl *acl;
|
struct posix_acl *acl;
|
||||||
@@ -201,8 +208,15 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef KC_GET_ACL_DENTRY
|
||||||
|
int scoutfs_set_acl(KC_VFS_NS_DEF
|
||||||
|
struct dentry *dentry, struct posix_acl *acl, int type)
|
||||||
|
{
|
||||||
|
struct inode *inode = dentry->d_inode;
|
||||||
|
#else
|
||||||
int scoutfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
|
int scoutfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
struct super_block *sb = inode->i_sb;
|
struct super_block *sb = inode->i_sb;
|
||||||
struct scoutfs_lock *lock = NULL;
|
struct scoutfs_lock *lock = NULL;
|
||||||
LIST_HEAD(ind_locks);
|
LIST_HEAD(ind_locks);
|
||||||
@@ -240,7 +254,12 @@ int scoutfs_acl_get_xattr(struct dentry *dentry, const char *name, void *value,
|
|||||||
if (!IS_POSIXACL(dentry->d_inode))
|
if (!IS_POSIXACL(dentry->d_inode))
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
|
#ifdef KC_GET_ACL_DENTRY
|
||||||
|
acl = scoutfs_get_acl(KC_VFS_INIT_NS
|
||||||
|
dentry, type);
|
||||||
|
#else
|
||||||
acl = scoutfs_get_acl(dentry->d_inode, type);
|
acl = scoutfs_get_acl(dentry->d_inode, type);
|
||||||
|
#endif
|
||||||
if (IS_ERR(acl))
|
if (IS_ERR(acl))
|
||||||
return PTR_ERR(acl);
|
return PTR_ERR(acl);
|
||||||
if (acl == NULL)
|
if (acl == NULL)
|
||||||
@@ -286,7 +305,11 @@ int scoutfs_acl_set_xattr(struct dentry *dentry, const char *name, const void *v
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef KC_GET_ACL_DENTRY
|
||||||
|
ret = scoutfs_set_acl(KC_VFS_INIT_NS dentry, acl, type);
|
||||||
|
#else
|
||||||
ret = scoutfs_set_acl(dentry->d_inode, acl, type);
|
ret = scoutfs_set_acl(dentry->d_inode, acl, type);
|
||||||
|
#endif
|
||||||
out:
|
out:
|
||||||
posix_acl_release(acl);
|
posix_acl_release(acl);
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
#ifndef _SCOUTFS_ACL_H_
|
#ifndef _SCOUTFS_ACL_H_
|
||||||
#define _SCOUTFS_ACL_H_
|
#define _SCOUTFS_ACL_H_
|
||||||
|
|
||||||
|
#ifdef KC_GET_ACL_DENTRY
|
||||||
|
struct posix_acl *scoutfs_get_acl(KC_VFS_NS_DEF struct dentry *dentry, int type);
|
||||||
|
int scoutfs_set_acl(KC_VFS_NS_DEF struct dentry *dentry, struct posix_acl *acl, int type);
|
||||||
|
#else
|
||||||
struct posix_acl *scoutfs_get_acl(struct inode *inode, int type);
|
struct posix_acl *scoutfs_get_acl(struct inode *inode, int type);
|
||||||
struct posix_acl *scoutfs_get_acl_locked(struct inode *inode, int type, struct scoutfs_lock *lock);
|
|
||||||
int scoutfs_set_acl(struct inode *inode, struct posix_acl *acl, int type);
|
int scoutfs_set_acl(struct inode *inode, struct posix_acl *acl, int type);
|
||||||
|
#endif
|
||||||
|
struct posix_acl *scoutfs_get_acl_locked(struct inode *inode, int type, struct scoutfs_lock *lock);
|
||||||
int scoutfs_set_acl_locked(struct inode *inode, struct posix_acl *acl, int type,
|
int scoutfs_set_acl_locked(struct inode *inode, struct posix_acl *acl, int type,
|
||||||
struct scoutfs_lock *lock, struct list_head *ind_locks);
|
struct scoutfs_lock *lock, struct list_head *ind_locks);
|
||||||
#ifdef KC_XATTR_STRUCT_XATTR_HANDLER
|
#ifdef KC_XATTR_STRUCT_XATTR_HANDLER
|
||||||
|
|||||||
@@ -2053,6 +2053,9 @@ const struct inode_operations scoutfs_dir_iops = {
|
|||||||
#endif
|
#endif
|
||||||
.listxattr = scoutfs_listxattr,
|
.listxattr = scoutfs_listxattr,
|
||||||
.get_acl = scoutfs_get_acl,
|
.get_acl = scoutfs_get_acl,
|
||||||
|
#ifdef KC_GET_ACL_DENTRY
|
||||||
|
.set_acl = scoutfs_set_acl,
|
||||||
|
#endif
|
||||||
.symlink = scoutfs_symlink,
|
.symlink = scoutfs_symlink,
|
||||||
.permission = scoutfs_permission,
|
.permission = scoutfs_permission,
|
||||||
#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER
|
#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER
|
||||||
|
|||||||
@@ -150,6 +150,9 @@ static const struct inode_operations scoutfs_file_iops = {
|
|||||||
#endif
|
#endif
|
||||||
.listxattr = scoutfs_listxattr,
|
.listxattr = scoutfs_listxattr,
|
||||||
.get_acl = scoutfs_get_acl,
|
.get_acl = scoutfs_get_acl,
|
||||||
|
#ifdef KC_GET_ACL_DENTRY
|
||||||
|
.set_acl = scoutfs_set_acl,
|
||||||
|
#endif
|
||||||
.fiemap = scoutfs_data_fiemap,
|
.fiemap = scoutfs_data_fiemap,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -163,6 +166,9 @@ static const struct inode_operations scoutfs_special_iops = {
|
|||||||
#endif
|
#endif
|
||||||
.listxattr = scoutfs_listxattr,
|
.listxattr = scoutfs_listxattr,
|
||||||
.get_acl = scoutfs_get_acl,
|
.get_acl = scoutfs_get_acl,
|
||||||
|
#ifdef KC_GET_ACL_DENTRY
|
||||||
|
.set_acl = scoutfs_set_acl,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user