Commit ef14f0c1 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Christoph Hellwig

xfs: use generic Posix ACL code

This patch rips out the XFS ACL handling code and uses the generic
fs/posix_acl.c code instead.  The ondisk format is of course left
unchanged.

This also introduces the same ACL caching all other Linux filesystems do
by adding pointers to the acl and default acl in struct xfs_inode.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarEric Sandeen <sandeen@sandeen.net>
parent 8b5403a6
...@@ -39,6 +39,7 @@ config XFS_QUOTA ...@@ -39,6 +39,7 @@ config XFS_QUOTA
config XFS_POSIX_ACL config XFS_POSIX_ACL
bool "XFS POSIX ACL support" bool "XFS POSIX ACL support"
depends on XFS_FS depends on XFS_FS
select FS_POSIX_ACL
help help
POSIX Access Control Lists (ACLs) support permissions for users and POSIX Access Control Lists (ACLs) support permissions for users and
groups beyond the owner/group/world scheme. groups beyond the owner/group/world scheme.
......
...@@ -40,7 +40,7 @@ xfs-$(CONFIG_PROC_FS) += quota/xfs_qm_stats.o ...@@ -40,7 +40,7 @@ xfs-$(CONFIG_PROC_FS) += quota/xfs_qm_stats.o
endif endif
xfs-$(CONFIG_XFS_RT) += xfs_rtalloc.o xfs-$(CONFIG_XFS_RT) += xfs_rtalloc.o
xfs-$(CONFIG_XFS_POSIX_ACL) += xfs_acl.o xfs-$(CONFIG_XFS_POSIX_ACL) += $(XFS_LINUX)/xfs_acl.o
xfs-$(CONFIG_PROC_FS) += $(XFS_LINUX)/xfs_stats.o xfs-$(CONFIG_PROC_FS) += $(XFS_LINUX)/xfs_stats.o
xfs-$(CONFIG_SYSCTL) += $(XFS_LINUX)/xfs_sysctl.o xfs-$(CONFIG_SYSCTL) += $(XFS_LINUX)/xfs_sysctl.o
xfs-$(CONFIG_COMPAT) += $(XFS_LINUX)/xfs_ioctl32.o xfs-$(CONFIG_COMPAT) += $(XFS_LINUX)/xfs_ioctl32.o
......
This diff is collapsed.
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include "xfs_itable.h" #include "xfs_itable.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_acl.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h" #include "xfs_fs.h"
#include "xfs_acl.h"
#include "xfs_bit.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h" #include "xfs_inum.h"
...@@ -51,6 +52,7 @@ ...@@ -51,6 +52,7 @@
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/xattr.h> #include <linux/xattr.h>
#include <linux/namei.h> #include <linux/namei.h>
#include <linux/posix_acl.h>
#include <linux/security.h> #include <linux/security.h>
#include <linux/falloc.h> #include <linux/falloc.h>
#include <linux/fiemap.h> #include <linux/fiemap.h>
...@@ -202,9 +204,8 @@ xfs_vn_mknod( ...@@ -202,9 +204,8 @@ xfs_vn_mknod(
{ {
struct inode *inode; struct inode *inode;
struct xfs_inode *ip = NULL; struct xfs_inode *ip = NULL;
xfs_acl_t *default_acl = NULL; struct posix_acl *default_acl = NULL;
struct xfs_name name; struct xfs_name name;
int (*test_default_acl)(struct inode *) = _ACL_DEFAULT_EXISTS;
int error; int error;
/* /*
...@@ -219,18 +220,14 @@ xfs_vn_mknod( ...@@ -219,18 +220,14 @@ xfs_vn_mknod(
rdev = 0; rdev = 0;
} }
if (test_default_acl && test_default_acl(dir)) { if (IS_POSIXACL(dir)) {
if (!_ACL_ALLOC(default_acl)) { default_acl = xfs_get_acl(dir, ACL_TYPE_DEFAULT);
return -ENOMEM; if (IS_ERR(default_acl))
} return -PTR_ERR(default_acl);
if (!_ACL_GET_DEFAULT(dir, default_acl)) {
_ACL_FREE(default_acl);
default_acl = NULL;
}
}
if (IS_POSIXACL(dir) && !default_acl) if (!default_acl)
mode &= ~current->fs->umask; mode &= ~current->fs->umask;
}
xfs_dentry_to_name(&name, dentry); xfs_dentry_to_name(&name, dentry);
error = xfs_create(XFS_I(dir), &name, mode, rdev, &ip, NULL); error = xfs_create(XFS_I(dir), &name, mode, rdev, &ip, NULL);
...@@ -244,10 +241,10 @@ xfs_vn_mknod( ...@@ -244,10 +241,10 @@ xfs_vn_mknod(
goto out_cleanup_inode; goto out_cleanup_inode;
if (default_acl) { if (default_acl) {
error = _ACL_INHERIT(inode, mode, default_acl); error = -xfs_inherit_acl(inode, default_acl);
if (unlikely(error)) if (unlikely(error))
goto out_cleanup_inode; goto out_cleanup_inode;
_ACL_FREE(default_acl); posix_acl_release(default_acl);
} }
...@@ -257,8 +254,7 @@ xfs_vn_mknod( ...@@ -257,8 +254,7 @@ xfs_vn_mknod(
out_cleanup_inode: out_cleanup_inode:
xfs_cleanup_inode(dir, inode, dentry); xfs_cleanup_inode(dir, inode, dentry);
out_free_acl: out_free_acl:
if (default_acl) posix_acl_release(default_acl);
_ACL_FREE(default_acl);
return -error; return -error;
} }
...@@ -488,26 +484,6 @@ xfs_vn_put_link( ...@@ -488,26 +484,6 @@ xfs_vn_put_link(
kfree(s); kfree(s);
} }
#ifdef CONFIG_XFS_POSIX_ACL
STATIC int
xfs_check_acl(
struct inode *inode,
int mask)
{
struct xfs_inode *ip = XFS_I(inode);
int error;
xfs_itrace_entry(ip);
if (XFS_IFORK_Q(ip)) {
error = xfs_acl_iaccess(ip, mask, NULL);
if (error != -1)
return -error;
}
return -EAGAIN;
}
STATIC int STATIC int
xfs_vn_permission( xfs_vn_permission(
struct inode *inode, struct inode *inode,
...@@ -515,9 +491,6 @@ xfs_vn_permission( ...@@ -515,9 +491,6 @@ xfs_vn_permission(
{ {
return generic_permission(inode, mask, xfs_check_acl); return generic_permission(inode, mask, xfs_check_acl);
} }
#else
#define xfs_vn_permission NULL
#endif
STATIC int STATIC int
xfs_vn_getattr( xfs_vn_getattr(
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_itable.h" #include "xfs_itable.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_acl.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_inode_item.h" #include "xfs_inode_item.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#include "xfs_itable.h" #include "xfs_itable.h"
#include "xfs_fsops.h" #include "xfs_fsops.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_acl.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_utils.h" #include "xfs_utils.h"
...@@ -1735,18 +1734,8 @@ xfs_init_zones(void) ...@@ -1735,18 +1734,8 @@ xfs_init_zones(void)
if (!xfs_ili_zone) if (!xfs_ili_zone)
goto out_destroy_inode_zone; goto out_destroy_inode_zone;
#ifdef CONFIG_XFS_POSIX_ACL
xfs_acl_zone = kmem_zone_init(sizeof(xfs_acl_t), "xfs_acl");
if (!xfs_acl_zone)
goto out_destroy_ili_zone;
#endif
return 0; return 0;
#ifdef CONFIG_XFS_POSIX_ACL
out_destroy_ili_zone:
#endif
kmem_zone_destroy(xfs_ili_zone);
out_destroy_inode_zone: out_destroy_inode_zone:
kmem_zone_destroy(xfs_inode_zone); kmem_zone_destroy(xfs_inode_zone);
out_destroy_efi_zone: out_destroy_efi_zone:
...@@ -1780,9 +1769,6 @@ xfs_init_zones(void) ...@@ -1780,9 +1769,6 @@ xfs_init_zones(void)
STATIC void STATIC void
xfs_destroy_zones(void) xfs_destroy_zones(void)
{ {
#ifdef CONFIG_XFS_POSIX_ACL
kmem_zone_destroy(xfs_acl_zone);
#endif
kmem_zone_destroy(xfs_ili_zone); kmem_zone_destroy(xfs_ili_zone);
kmem_zone_destroy(xfs_inode_zone); kmem_zone_destroy(xfs_inode_zone);
kmem_zone_destroy(xfs_efi_zone); kmem_zone_destroy(xfs_efi_zone);
......
...@@ -29,67 +29,6 @@ ...@@ -29,67 +29,6 @@
#include <linux/xattr.h> #include <linux/xattr.h>
/*
* ACL handling. Should eventually be moved into xfs_acl.c
*/
static int
xfs_decode_acl(const char *name)
{
if (strcmp(name, "posix_acl_access") == 0)
return _ACL_TYPE_ACCESS;
else if (strcmp(name, "posix_acl_default") == 0)
return _ACL_TYPE_DEFAULT;
return -EINVAL;
}
/*
* Get system extended attributes which at the moment only
* includes Posix ACLs.
*/
static int
xfs_xattr_system_get(struct inode *inode, const char *name,
void *buffer, size_t size)
{
int acl;
acl = xfs_decode_acl(name);
if (acl < 0)
return acl;
return xfs_acl_vget(inode, buffer, size, acl);
}
static int
xfs_xattr_system_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags)
{
int acl;
acl = xfs_decode_acl(name);
if (acl < 0)
return acl;
if (flags & XATTR_CREATE)
return -EINVAL;
if (!value)
return xfs_acl_vremove(inode, acl);
return xfs_acl_vset(inode, (void *)value, size, acl);
}
static struct xattr_handler xfs_xattr_system_handler = {
.prefix = XATTR_SYSTEM_PREFIX,
.get = xfs_xattr_system_get,
.set = xfs_xattr_system_set,
};
/*
* Real xattr handling. The only difference between the namespaces is
* a flag passed to the low-level attr code.
*/
static int static int
__xfs_xattr_get(struct inode *inode, const char *name, __xfs_xattr_get(struct inode *inode, const char *name,
void *value, size_t size, int xflags) void *value, size_t size, int xflags)
...@@ -199,7 +138,9 @@ struct xattr_handler *xfs_xattr_handlers[] = { ...@@ -199,7 +138,9 @@ struct xattr_handler *xfs_xattr_handlers[] = {
&xfs_xattr_user_handler, &xfs_xattr_user_handler,
&xfs_xattr_trusted_handler, &xfs_xattr_trusted_handler,
&xfs_xattr_security_handler, &xfs_xattr_security_handler,
#ifdef CONFIG_XFS_POSIX_ACL
&xfs_xattr_system_handler, &xfs_xattr_system_handler,
#endif
NULL NULL
}; };
...@@ -310,7 +251,7 @@ xfs_vn_listxattr(struct dentry *dentry, char *data, size_t size) ...@@ -310,7 +251,7 @@ xfs_vn_listxattr(struct dentry *dentry, char *data, size_t size)
/* /*
* Then add the two synthetic ACL attributes. * Then add the two synthetic ACL attributes.
*/ */
if (xfs_acl_vhasacl_access(inode)) { if (posix_acl_access_exists(inode)) {
error = list_one_attr(POSIX_ACL_XATTR_ACCESS, error = list_one_attr(POSIX_ACL_XATTR_ACCESS,
strlen(POSIX_ACL_XATTR_ACCESS) + 1, strlen(POSIX_ACL_XATTR_ACCESS) + 1,
data, size, &context.count); data, size, &context.count);
...@@ -318,7 +259,7 @@ xfs_vn_listxattr(struct dentry *dentry, char *data, size_t size) ...@@ -318,7 +259,7 @@ xfs_vn_listxattr(struct dentry *dentry, char *data, size_t size)
return error; return error;
} }
if (xfs_acl_vhasacl_default(inode)) { if (posix_acl_default_exists(inode)) {
error = list_one_attr(POSIX_ACL_XATTR_DEFAULT, error = list_one_attr(POSIX_ACL_XATTR_DEFAULT,
strlen(POSIX_ACL_XATTR_DEFAULT) + 1, strlen(POSIX_ACL_XATTR_DEFAULT) + 1,
data, size, &context.count); data, size, &context.count);
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_itable.h" #include "xfs_itable.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_acl.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_trans_space.h" #include "xfs_trans_space.h"
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_itable.h" #include "xfs_itable.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_acl.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_trans_priv.h" #include "xfs_trans_priv.h"
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_acl.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_trans_space.h" #include "xfs_trans_space.h"
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_acl.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_qm.h" #include "xfs_qm.h"
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_acl.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_qm.h" #include "xfs_qm.h"
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_acl.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_utils.h" #include "xfs_utils.h"
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "xfs_rtalloc.h" #include "xfs_rtalloc.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_acl.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_trans_priv.h" #include "xfs_trans_priv.h"
......
This diff is collapsed.
...@@ -18,26 +18,22 @@ ...@@ -18,26 +18,22 @@
#ifndef __XFS_ACL_H__ #ifndef __XFS_ACL_H__
#define __XFS_ACL_H__ #define __XFS_ACL_H__
/* struct inode;
* Access Control Lists struct posix_acl;
*/ struct xfs_inode;
typedef __uint16_t xfs_acl_perm_t;
typedef __int32_t xfs_acl_tag_t;
typedef __int32_t xfs_acl_id_t;
#define XFS_ACL_MAX_ENTRIES 25 #define XFS_ACL_MAX_ENTRIES 25
#define XFS_ACL_NOT_PRESENT (-1) #define XFS_ACL_NOT_PRESENT (-1)
typedef struct xfs_acl_entry { /* On-disk XFS access control list structure */
xfs_acl_tag_t ae_tag; struct xfs_acl {
xfs_acl_id_t ae_id; __be32 acl_cnt;
xfs_acl_perm_t ae_perm; struct xfs_acl_entry {
} xfs_acl_entry_t; __be32 ae_tag;
__be32 ae_id;
typedef struct xfs_acl { __be16 ae_perm;
__int32_t acl_cnt; } acl_entry[XFS_ACL_MAX_ENTRIES];
xfs_acl_entry_t acl_entry[XFS_ACL_MAX_ENTRIES]; };
} xfs_acl_t;
/* On-disk XFS extended attribute names */ /* On-disk XFS extended attribute names */
#define SGI_ACL_FILE "SGI_ACL_FILE" #define SGI_ACL_FILE "SGI_ACL_FILE"
...@@ -45,54 +41,25 @@ typedef struct xfs_acl { ...@@ -45,54 +41,25 @@ typedef struct xfs_acl {
#define SGI_ACL_FILE_SIZE (sizeof(SGI_ACL_FILE)-1) #define SGI_ACL_FILE_SIZE (sizeof(SGI_ACL_FILE)-1)
#define SGI_ACL_DEFAULT_SIZE (sizeof(SGI_ACL_DEFAULT)-1) #define SGI_ACL_DEFAULT_SIZE (sizeof(SGI_ACL_DEFAULT)-1)
#define _ACL_TYPE_ACCESS 1
#define _ACL_TYPE_DEFAULT 2
#ifdef CONFIG_XFS_POSIX_ACL #ifdef CONFIG_XFS_POSIX_ACL
extern int xfs_check_acl(struct inode *inode, int mask);
extern struct posix_acl *xfs_get_acl(struct inode *inode, int type);
extern int xfs_inherit_acl(struct inode *inode, struct posix_acl *default_acl);
extern int xfs_acl_chmod(struct inode *inode);
extern void xfs_inode_init_acls(struct xfs_inode *ip);
extern void xfs_inode_clear_acls(struct xfs_inode *ip);
extern int posix_acl_access_exists(struct inode *inode);
extern int posix_acl_default_exists(struct inode *inode);
struct vattr; extern struct xattr_handler xfs_xattr_system_handler;
struct xfs_inode;
extern struct kmem_zone *xfs_acl_zone;
#define xfs_acl_zone_init(zone, name) \
(zone) = kmem_zone_init(sizeof(xfs_acl_t), (name))
#define xfs_acl_zone_destroy(zone) kmem_zone_destroy(zone)
extern int xfs_acl_inherit(struct inode *, mode_t mode, xfs_acl_t *);
extern int xfs_acl_iaccess(struct xfs_inode *, mode_t, cred_t *);
extern int xfs_acl_vtoacl(struct inode *, xfs_acl_t *, xfs_acl_t *);
extern int xfs_acl_vhasacl_access(struct inode *);
extern int xfs_acl_vhasacl_default(struct inode *);
extern int xfs_acl_vset(struct inode *, void *, size_t, int);
extern int xfs_acl_vget(struct inode *, void *, size_t, int);
extern int xfs_acl_vremove(struct inode *, int);
#define _ACL_PERM_INVALID(perm) ((perm) & ~(ACL_READ|ACL_WRITE|ACL_EXECUTE))
#define _ACL_INHERIT(c,m,d) (xfs_acl_inherit(c,m,d))
#define _ACL_GET_ACCESS(pv,pa) (xfs_acl_vtoacl(pv,pa,NULL) == 0)
#define _ACL_GET_DEFAULT(pv,pd) (xfs_acl_vtoacl(pv,NULL,pd) == 0)
#define _ACL_ACCESS_EXISTS xfs_acl_vhasacl_access
#define _ACL_DEFAULT_EXISTS xfs_acl_vhasacl_default
#define _ACL_ALLOC(a) ((a) = kmem_zone_alloc(xfs_acl_zone, KM_SLEEP))
#define _ACL_FREE(a) ((a)? kmem_zone_free(xfs_acl_zone, (a)):(void)0)
#else #else
#define xfs_acl_zone_init(zone,name) # define xfs_check_acl NULL
#define xfs_acl_zone_destroy(zone) # define xfs_get_acl(inode, type) NULL
#define xfs_acl_vset(v,p,sz,t) (-EOPNOTSUPP) # define xfs_inherit_acl(inode, default_acl) 0
#define xfs_acl_vget(v,p,sz,t) (-EOPNOTSUPP) # define xfs_acl_chmod(inode) 0
#define xfs_acl_vremove(v,t) (-EOPNOTSUPP) # define xfs_inode_init_acls(ip)
#define xfs_acl_vhasacl_access(v) (0) # define xfs_inode_clear_acls(ip)
#define xfs_acl_vhasacl_default(v) (0) # define posix_acl_access_exists(inode) 0
#define _ACL_ALLOC(a) (1) /* successfully allocate nothing */ # define posix_acl_default_exists(inode) 0
#define _ACL_FREE(a) ((void)0) #endif /* CONFIG_XFS_POSIX_ACL */
#define _ACL_INHERIT(c,m,d) (0)
#define _ACL_GET_ACCESS(pv,pa) (0)
#define _ACL_GET_DEFAULT(pv,pd) (0)
#define _ACL_ACCESS_EXISTS (NULL)
#define _ACL_DEFAULT_EXISTS (NULL)
#endif
#endif /* __XFS_ACL_H__ */ #endif /* __XFS_ACL_H__ */
...@@ -73,28 +73,6 @@ static inline void be64_add_cpu(__be64 *a, __s64 b) ...@@ -73,28 +73,6 @@ static inline void be64_add_cpu(__be64 *a, __s64 b)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
/* do we need conversion? */
#define ARCH_NOCONVERT 1
#ifdef XFS_NATIVE_HOST
# define ARCH_CONVERT ARCH_NOCONVERT
#else
# define ARCH_CONVERT 0
#endif
/* generic swapping macros */
#ifndef HAVE_SWABMACROS
#define INT_SWAP16(type,var) ((typeof(type))(__swab16((__u16)(var))))
#define INT_SWAP32(type,var) ((typeof(type))(__swab32((__u32)(var))))
#define INT_SWAP64(type,var) ((typeof(type))(__swab64((__u64)(var))))
#endif
#define INT_SWAP(type, var) \
((sizeof(type) == 8) ? INT_SWAP64(type,var) : \
((sizeof(type) == 4) ? INT_SWAP32(type,var) : \
((sizeof(type) == 2) ? INT_SWAP16(type,var) : \
(var))))
/* /*
* get and set integers from potentially unaligned locations * get and set integers from potentially unaligned locations
*/ */
...@@ -107,16 +85,6 @@ static inline void be64_add_cpu(__be64 *a, __s64 b) ...@@ -107,16 +85,6 @@ static inline void be64_add_cpu(__be64 *a, __s64 b)
((__u8*)(pointer))[1] = (((value) ) & 0xff); \ ((__u8*)(pointer))[1] = (((value) ) & 0xff); \
} }
/* does not return a value */
#define INT_SET(reference,arch,valueref) \
(__builtin_constant_p(valueref) ? \
(void)( (reference) = ( ((arch) != ARCH_NOCONVERT) ? (INT_SWAP((reference),(valueref))) : (valueref)) ) : \
(void)( \
((reference) = (valueref)), \
( ((arch) != ARCH_NOCONVERT) ? (reference) = INT_SWAP((reference),(reference)) : 0 ) \
) \
)
/* /*
* In directories inode numbers are stored as unaligned arrays of unsigned * In directories inode numbers are stored as unaligned arrays of unsigned
* 8bit integers on disk. * 8bit integers on disk.
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_trans_space.h" #include "xfs_trans_space.h"
#include "xfs_acl.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_vnodeops.h" #include "xfs_vnodeops.h"
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h" #include "xfs_fs.h"
#include "xfs_types.h" #include "xfs_types.h"
#include "xfs_acl.h"
#include "xfs_bit.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
#include "xfs_inum.h" #include "xfs_inum.h"
...@@ -82,6 +83,7 @@ xfs_inode_alloc( ...@@ -82,6 +83,7 @@ xfs_inode_alloc(
memset(&ip->i_d, 0, sizeof(xfs_icdinode_t)); memset(&ip->i_d, 0, sizeof(xfs_icdinode_t));
ip->i_size = 0; ip->i_size = 0;
ip->i_new_size = 0; ip->i_new_size = 0;
xfs_inode_init_acls(ip);
/* /*
* Initialize inode's trace buffers. * Initialize inode's trace buffers.
...@@ -558,6 +560,7 @@ xfs_ireclaim( ...@@ -558,6 +560,7 @@ xfs_ireclaim(
ASSERT(atomic_read(&ip->i_pincount) == 0); ASSERT(atomic_read(&ip->i_pincount) == 0);
ASSERT(!spin_is_locked(&ip->i_flags_lock)); ASSERT(!spin_is_locked(&ip->i_flags_lock));
ASSERT(completion_done(&ip->i_flush)); ASSERT(completion_done(&ip->i_flush));
xfs_inode_clear_acls(ip);
kmem_zone_free(xfs_inode_zone, ip); kmem_zone_free(xfs_inode_zone, ip);
} }
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#include "xfs_utils.h" #include "xfs_utils.h"
#include "xfs_dir2_trace.h" #include "xfs_dir2_trace.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_acl.h"
#include "xfs_filestream.h" #include "xfs_filestream.h"
#include "xfs_vnodeops.h" #include "xfs_vnodeops.h"
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#ifndef __XFS_INODE_H__ #ifndef __XFS_INODE_H__
#define __XFS_INODE_H__ #define __XFS_INODE_H__
struct posix_acl;
struct xfs_dinode; struct xfs_dinode;
struct xfs_inode; struct xfs_inode;
...@@ -272,6 +273,11 @@ typedef struct xfs_inode { ...@@ -272,6 +273,11 @@ typedef struct xfs_inode {
/* VFS inode */ /* VFS inode */
struct inode i_vnode; /* embedded VFS inode */ struct inode i_vnode; /* embedded VFS inode */
#ifdef CONFIG_XFS_POSIX_ACL
struct posix_acl *i_acl;
struct posix_acl *i_default_acl;
#endif
/* Trace buffers per inode. */ /* Trace buffers per inode. */
#ifdef XFS_INODE_TRACE #ifdef XFS_INODE_TRACE
struct ktrace *i_trace; /* general inode trace */ struct ktrace *i_trace; /* general inode trace */
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_itable.h" #include "xfs_itable.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_acl.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_trans_space.h" #include "xfs_trans_space.h"
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include "xfs_ialloc.h" #include "xfs_ialloc.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_acl.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_rw.h" #include "xfs_rw.h"
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "xfs_ialloc.h" #include "xfs_ialloc.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
#include "xfs_bmap.h" #include "xfs_bmap.h"
#include "xfs_acl.h"
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_error.h" #include "xfs_error.h"
...@@ -467,8 +468,20 @@ xfs_setattr( ...@@ -467,8 +468,20 @@ xfs_setattr(
xfs_qm_dqrele(udqp); xfs_qm_dqrele(udqp);
xfs_qm_dqrele(gdqp); xfs_qm_dqrele(gdqp);
if (code) { if (code)
return code; return code;
/*
* XXX(hch): Updating the ACL entries is not atomic vs the i_mode
* update. We could avoid this with linked transactions
* and passing down the transaction pointer all the way
* to attr_set. No previous user of the generic
* Posix ACL code seems to care about this issue either.
*/
if ((mask & ATTR_MODE) && !(flags & XFS_ATTR_NOACL)) {
code = -xfs_acl_chmod(inode);
if (code)
return XFS_ERROR(code);
} }
if (DM_EVENT_ENABLED(ip, DM_EVENT_ATTRIBUTE) && if (DM_EVENT_ENABLED(ip, DM_EVENT_ATTRIBUTE) &&
......
...@@ -18,6 +18,7 @@ int xfs_setattr(struct xfs_inode *ip, struct iattr *vap, int flags); ...@@ -18,6 +18,7 @@ int xfs_setattr(struct xfs_inode *ip, struct iattr *vap, int flags);
#define XFS_ATTR_DMI 0x01 /* invocation from a DMI function */ #define XFS_ATTR_DMI 0x01 /* invocation from a DMI function */
#define XFS_ATTR_NONBLOCK 0x02 /* return EAGAIN if operation would block */ #define XFS_ATTR_NONBLOCK 0x02 /* return EAGAIN if operation would block */
#define XFS_ATTR_NOLOCK 0x04 /* Don't grab any conflicting locks */ #define XFS_ATTR_NOLOCK 0x04 /* Don't grab any conflicting locks */
#define XFS_ATTR_NOACL 0x08 /* Don't call xfs_acl_chmod */
int xfs_readlink(struct xfs_inode *ip, char *link); int xfs_readlink(struct xfs_inode *ip, char *link);
int xfs_fsync(struct xfs_inode *ip); int xfs_fsync(struct xfs_inode *ip);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment