net/mlx5: Change the acl enable prototype to return status
[cascardo/linux.git] / fs / fuse / inode.c
index 4e05b51..1714109 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/random.h>
 #include <linux/sched.h>
 #include <linux/exportfs.h>
+#include <linux/posix_acl.h>
 
 MODULE_AUTHOR("Miklos Szeredi <miklos@szeredi.hu>");
 MODULE_DESCRIPTION("Filesystem in Userspace");
@@ -66,7 +67,8 @@ struct fuse_mount_data {
        unsigned rootmode_present:1;
        unsigned user_id_present:1;
        unsigned group_id_present:1;
-       unsigned flags;
+       unsigned default_permissions:1;
+       unsigned allow_other:1;
        unsigned max_read;
        unsigned blksize;
 };
@@ -192,7 +194,7 @@ void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
         * check in may_delete().
         */
        fi->orig_i_mode = inode->i_mode;
-       if (!(fc->flags & FUSE_DEFAULT_PERMISSIONS))
+       if (!fc->default_permissions)
                inode->i_mode &= ~S_ISVTX;
 
        fi->orig_ino = attr->ino;
@@ -340,6 +342,7 @@ int fuse_reverse_inval_inode(struct super_block *sb, u64 nodeid,
                return -ENOENT;
 
        fuse_invalidate_attr(inode);
+       forget_all_cached_acls(inode);
        if (offset >= 0) {
                pg_start = offset >> PAGE_SHIFT;
                if (len <= 0)
@@ -532,11 +535,11 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
                        break;
 
                case OPT_DEFAULT_PERMISSIONS:
-                       d->flags |= FUSE_DEFAULT_PERMISSIONS;
+                       d->default_permissions = 1;
                        break;
 
                case OPT_ALLOW_OTHER:
-                       d->flags |= FUSE_ALLOW_OTHER;
+                       d->allow_other = 1;
                        break;
 
                case OPT_MAX_READ:
@@ -570,9 +573,9 @@ static int fuse_show_options(struct seq_file *m, struct dentry *root)
 
        seq_printf(m, ",user_id=%u", from_kuid_munged(&init_user_ns, fc->user_id));
        seq_printf(m, ",group_id=%u", from_kgid_munged(&init_user_ns, fc->group_id));
-       if (fc->flags & FUSE_DEFAULT_PERMISSIONS)
+       if (fc->default_permissions)
                seq_puts(m, ",default_permissions");
-       if (fc->flags & FUSE_ALLOW_OTHER)
+       if (fc->allow_other)
                seq_puts(m, ",allow_other");
        if (fc->max_read != ~0)
                seq_printf(m, ",max_read=%u", fc->max_read);
@@ -910,8 +913,15 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
                                fc->writeback_cache = 1;
                        if (arg->flags & FUSE_PARALLEL_DIROPS)
                                fc->parallel_dirops = 1;
+                       if (arg->flags & FUSE_HANDLE_KILLPRIV)
+                               fc->handle_killpriv = 1;
                        if (arg->time_gran && arg->time_gran <= 1000000000)
                                fc->sb->s_time_gran = arg->time_gran;
+                       if ((arg->flags & FUSE_POSIX_ACL)) {
+                               fc->default_permissions = 1;
+                               fc->posix_acl = 1;
+                               fc->sb->s_xattr = fuse_acl_xattr_handlers;
+                       }
                } else {
                        ra_pages = fc->max_read / PAGE_SIZE;
                        fc->no_lock = 1;
@@ -941,7 +951,7 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req)
                FUSE_FLOCK_LOCKS | FUSE_HAS_IOCTL_DIR | FUSE_AUTO_INVAL_DATA |
                FUSE_DO_READDIRPLUS | FUSE_READDIRPLUS_AUTO | FUSE_ASYNC_DIO |
                FUSE_WRITEBACK_CACHE | FUSE_NO_OPEN_SUPPORT |
-               FUSE_PARALLEL_DIROPS;
+               FUSE_PARALLEL_DIROPS | FUSE_HANDLE_KILLPRIV | FUSE_POSIX_ACL;
        req->in.h.opcode = FUSE_INIT;
        req->in.numargs = 1;
        req->in.args[0].size = sizeof(*arg);
@@ -1071,6 +1081,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
        }
        sb->s_magic = FUSE_SUPER_MAGIC;
        sb->s_op = &fuse_super_operations;
+       sb->s_xattr = fuse_xattr_handlers;
        sb->s_maxbytes = MAX_LFS_FILESIZE;
        sb->s_time_gran = 1;
        sb->s_export_op = &fuse_export_operations;
@@ -1109,7 +1120,8 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
                fc->dont_mask = 1;
        sb->s_flags |= MS_POSIXACL;
 
-       fc->flags = d.flags;
+       fc->default_permissions = d.default_permissions;
+       fc->allow_other = d.allow_other;
        fc->user_id = d.user_id;
        fc->group_id = d.group_id;
        fc->max_read = max_t(unsigned, 4096, d.max_read);