]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
UBUNTU: SAUCE: aufs -- Convert to use xattr handlers
authorSeth Forshee <seth.forshee@canonical.com>
Tue, 6 Dec 2016 15:27:46 +0000 (09:27 -0600)
committerTim Gardner <tim.gardner@canonical.com>
Mon, 20 Feb 2017 03:57:58 +0000 (20:57 -0700)
Starting with Linux 4.9-rc1 the {get,set,remove}xattr inode
operations have been removed, and filesystems are required to use
xattr handlers instead. There's some partially implemented xattr
handlers commented out in aufs already. Finish those handlers and
convert aufs over to use them.

Fixes FTBFS with 4.9 kernels.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
fs/aufs/i_op.c
fs/aufs/inode.h
fs/aufs/super.c
fs/aufs/xattr.c

index ad00ba5272884726955c016ea83d47b30028a81d..b6902aa32a2ab2f45e82cd96f70ba694a1af612a 100644 (file)
@@ -1387,10 +1387,7 @@ struct inode_operations aufs_iop_nogetattr[AuIop_Last],
                .getattr        = aufs_getattr,
 
 #ifdef CONFIG_AUFS_XATTR
-               .setxattr       = aufs_setxattr,
-               .getxattr       = aufs_getxattr,
                .listxattr      = aufs_listxattr,
-               .removexattr    = aufs_removexattr,
 #endif
 
                .readlink       = generic_readlink,
@@ -1419,10 +1416,7 @@ struct inode_operations aufs_iop_nogetattr[AuIop_Last],
                .getattr        = aufs_getattr,
 
 #ifdef CONFIG_AUFS_XATTR
-               .setxattr       = aufs_setxattr,
-               .getxattr       = aufs_getxattr,
                .listxattr      = aufs_listxattr,
-               .removexattr    = aufs_removexattr,
 #endif
 
                .update_time    = aufs_update_time,
@@ -1440,10 +1434,7 @@ struct inode_operations aufs_iop_nogetattr[AuIop_Last],
                .getattr        = aufs_getattr,
 
 #ifdef CONFIG_AUFS_XATTR
-               .setxattr       = aufs_setxattr,
-               .getxattr       = aufs_getxattr,
                .listxattr      = aufs_listxattr,
-               .removexattr    = aufs_removexattr,
 #endif
 
                .update_time    = aufs_update_time
index 2f8c1c6b9be71a6bf9067b356d538c3cd612ae9e..94d217ff609a5dd9b67ac771536b31b807e9f09f 100644 (file)
@@ -311,17 +311,11 @@ AuStubVoid(au_plink_half_refresh, struct super_block *sb, aufs_bindex_t br_id);
 int au_cpup_xattr(struct dentry *h_dst, struct dentry *h_src, int ignore_flags,
                  unsigned int verbose);
 ssize_t aufs_listxattr(struct dentry *dentry, char *list, size_t size);
-ssize_t aufs_getxattr(struct dentry *dentry, struct inode *inode,
-                     const char *name, void *value, size_t size);
-int aufs_setxattr(struct dentry *dentry, struct inode *inode, const char *name,
-                 const void *value, size_t size, int flags);
-int aufs_removexattr(struct dentry *dentry, const char *name);
-
-/* void au_xattr_init(struct super_block *sb); */
+void au_xattr_init(struct super_block *sb);
 #else
 AuStubInt0(au_cpup_xattr, struct dentry *h_dst, struct dentry *h_src,
           int ignore_flags, unsigned int verbose);
-/* AuStubVoid(au_xattr_init, struct super_block *sb); */
+AuStubVoid(au_xattr_init, struct super_block *sb);
 #endif
 
 #ifdef CONFIG_FS_POSIX_ACL
index 093fba6e249bc932854d20c9d7c1a0f3a57cb72c..5441cb575927746292c228afd07e682b87ba2e41 100644 (file)
@@ -923,7 +923,7 @@ static int aufs_fill_super(struct super_block *sb, void *raw_data,
        sb->s_maxbytes = 0;
        sb->s_stack_depth = 1;
        au_export_init(sb);
-       /* au_xattr_init(sb); */
+       au_xattr_init(sb);
 
        err = alloc_root(sb);
        if (unlikely(err)) {
index e91904450ca401f55788c91b7a9fde19845dff0d..145d9f0654d40a89976d73a04689ed739fca4fe0 100644 (file)
@@ -264,8 +264,8 @@ ssize_t aufs_listxattr(struct dentry *dentry, char *list, size_t size)
        return au_lgxattr(dentry, &arg);
 }
 
-ssize_t aufs_getxattr(struct dentry *dentry, struct inode *inode __maybe_unused,
-                     const char *name, void *value, size_t size)
+static ssize_t aufs_getxattr(struct dentry *dentry, const char *name,
+                            void *value, size_t size)
 {
        struct au_lgxattr arg = {
                .type = AU_XATTR_GET,
@@ -279,8 +279,9 @@ ssize_t aufs_getxattr(struct dentry *dentry, struct inode *inode __maybe_unused,
        return au_lgxattr(dentry, &arg);
 }
 
-int aufs_setxattr(struct dentry *dentry, struct inode *inode, const char *name,
-                 const void *value, size_t size, int flags)
+static int aufs_setxattr(struct dentry *dentry, struct inode *inode,
+                        const char *name, const void *value, size_t size,
+                        int flags)
 {
        struct au_srxattr arg = {
                .type = AU_XATTR_SET,
@@ -295,7 +296,7 @@ int aufs_setxattr(struct dentry *dentry, struct inode *inode, const char *name,
        return au_srxattr(dentry, inode, &arg);
 }
 
-int aufs_removexattr(struct dentry *dentry, const char *name)
+static int aufs_removexattr(struct dentry *dentry, const char *name)
 {
        struct au_srxattr arg = {
                .type = AU_XATTR_REMOVE,
@@ -307,41 +308,38 @@ int aufs_removexattr(struct dentry *dentry, const char *name)
        return au_srxattr(dentry, d_inode(dentry), &arg);
 }
 
-/* ---------------------------------------------------------------------- */
-
-#if 0
-static size_t au_xattr_list(struct dentry *dentry, char *list, size_t list_size,
-                           const char *name, size_t name_len, int type)
-{
-       return aufs_listxattr(dentry, list, list_size);
-}
-
-static int au_xattr_get(struct dentry *dentry, const char *name, void *buffer,
-                       size_t size, int type)
+static int au_xattr_get(const struct xattr_handler *handler,
+                       struct dentry *dentry, struct inode *inode,
+                       const char *name, void *value, size_t size)
 {
-       return aufs_getxattr(dentry, name, buffer, size);
+       return aufs_getxattr(dentry, name, value, size);
 }
 
-static int au_xattr_set(struct dentry *dentry, const char *name,
-                       const void *value, size_t size, int flags, int type)
+static int au_xattr_set(const struct xattr_handler *handler,
+                       struct dentry *dentry, struct inode *inode,
+                       const char *name, const void *value, size_t size,
+                       int flags)
 {
-       return aufs_setxattr(dentry, name, value, size, flags);
+       if (!value) {
+               if (WARN_ON(flags != XATTR_REPLACE))
+                       return -EINVAL;
+               return aufs_removexattr(dentry, name);
+       }
+       return aufs_setxattr(dentry, inode, name, value, size, flags);
 }
 
 static const struct xattr_handler au_xattr_handler = {
-       /* no prefix, no flags */
-       .list   = au_xattr_list,
-       .get    = au_xattr_get,
-       .set    = au_xattr_set
-       /* why no remove? */
+       .prefix = "", /* match anything */
+       .get = au_xattr_get,
+       .set = au_xattr_set,
 };
 
 static const struct xattr_handler *au_xattr_handlers[] = {
-       &au_xattr_handler
+       &au_xattr_handler,
+       NULL
 };
 
 void au_xattr_init(struct super_block *sb)
 {
-       /* sb->s_xattr = au_xattr_handlers; */
+       sb->s_xattr = au_xattr_handlers;
 }
-#endif