[PATCH] kvm: VMX: Reload ds and es even in 64-bit mode
[platform/adaptation/renesas_rcar/renesas_kernel.git] / fs / fuse / inode.c
index 1baaaeb..2202551 100644 (file)
@@ -112,7 +112,7 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr)
 {
        struct fuse_conn *fc = get_fuse_conn(inode);
        if (S_ISREG(inode->i_mode) && i_size_read(inode) != attr->size)
 {
        struct fuse_conn *fc = get_fuse_conn(inode);
        if (S_ISREG(inode->i_mode) && i_size_read(inode) != attr->size)
-               invalidate_inode_pages(inode->i_mapping);
+               invalidate_mapping_pages(inode->i_mapping, 0, -1);
 
        inode->i_ino     = attr->ino;
        inode->i_mode    = (inode->i_mode & S_IFMT) + (attr->mode & 07777);
 
        inode->i_ino     = attr->ino;
        inode->i_mode    = (inode->i_mode & S_IFMT) + (attr->mode & 07777);
@@ -206,10 +206,23 @@ static void fuse_umount_begin(struct vfsmount *vfsmnt, int flags)
                fuse_abort_conn(get_fuse_conn_super(vfsmnt->mnt_sb));
 }
 
                fuse_abort_conn(get_fuse_conn_super(vfsmnt->mnt_sb));
 }
 
+static void fuse_send_destroy(struct fuse_conn *fc)
+{
+       struct fuse_req *req = fc->destroy_req;
+       if (req && fc->conn_init) {
+               fc->destroy_req = NULL;
+               req->in.h.opcode = FUSE_DESTROY;
+               req->force = 1;
+               request_send(fc, req);
+               fuse_put_request(fc, req);
+       }
+}
+
 static void fuse_put_super(struct super_block *sb)
 {
        struct fuse_conn *fc = get_fuse_conn_super(sb);
 
 static void fuse_put_super(struct super_block *sb)
 {
        struct fuse_conn *fc = get_fuse_conn_super(sb);
 
+       fuse_send_destroy(fc);
        spin_lock(&fc->lock);
        fc->connected = 0;
        fc->blocked = 0;
        spin_lock(&fc->lock);
        fc->connected = 0;
        fc->blocked = 0;
@@ -410,6 +423,8 @@ static struct fuse_conn *new_conn(void)
 void fuse_conn_put(struct fuse_conn *fc)
 {
        if (atomic_dec_and_test(&fc->count)) {
 void fuse_conn_put(struct fuse_conn *fc)
 {
        if (atomic_dec_and_test(&fc->count)) {
+               if (fc->destroy_req)
+                       fuse_request_free(fc->destroy_req);
                mutex_destroy(&fc->inst_mutex);
                kfree(fc);
        }
                mutex_destroy(&fc->inst_mutex);
                kfree(fc);
        }
@@ -466,6 +481,7 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
                fc->bdi.ra_pages = min(fc->bdi.ra_pages, ra_pages);
                fc->minor = arg->minor;
                fc->max_write = arg->minor < 5 ? 4096 : arg->max_write;
                fc->bdi.ra_pages = min(fc->bdi.ra_pages, ra_pages);
                fc->minor = arg->minor;
                fc->max_write = arg->minor < 5 ? 4096 : arg->max_write;
+               fc->conn_init = 1;
        }
        fuse_put_request(fc, req);
        fc->blocked = 0;
        }
        fuse_put_request(fc, req);
        fc->blocked = 0;
@@ -519,8 +535,10 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
                return -EINVAL;
 
        if (is_bdev) {
                return -EINVAL;
 
        if (is_bdev) {
+#ifdef CONFIG_BLOCK
                if (!sb_set_blocksize(sb, d.blksize))
                        return -EINVAL;
                if (!sb_set_blocksize(sb, d.blksize))
                        return -EINVAL;
+#endif
        } else {
                sb->s_blocksize = PAGE_CACHE_SIZE;
                sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
        } else {
                sb->s_blocksize = PAGE_CACHE_SIZE;
                sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
@@ -563,6 +581,12 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
        if (!init_req)
                goto err_put_root;
 
        if (!init_req)
                goto err_put_root;
 
+       if (is_bdev) {
+               fc->destroy_req = fuse_request_alloc();
+               if (!fc->destroy_req)
+                       goto err_put_root;
+       }
+
        mutex_lock(&fuse_mutex);
        err = -EINVAL;
        if (file->private_data)
        mutex_lock(&fuse_mutex);
        err = -EINVAL;
        if (file->private_data)
@@ -607,6 +631,14 @@ static int fuse_get_sb(struct file_system_type *fs_type,
        return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super, mnt);
 }
 
        return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super, mnt);
 }
 
+static struct file_system_type fuse_fs_type = {
+       .owner          = THIS_MODULE,
+       .name           = "fuse",
+       .get_sb         = fuse_get_sb,
+       .kill_sb        = kill_anon_super,
+};
+
+#ifdef CONFIG_BLOCK
 static int fuse_get_sb_blk(struct file_system_type *fs_type,
                           int flags, const char *dev_name,
                           void *raw_data, struct vfsmount *mnt)
 static int fuse_get_sb_blk(struct file_system_type *fs_type,
                           int flags, const char *dev_name,
                           void *raw_data, struct vfsmount *mnt)
@@ -615,13 +647,6 @@ static int fuse_get_sb_blk(struct file_system_type *fs_type,
                           mnt);
 }
 
                           mnt);
 }
 
-static struct file_system_type fuse_fs_type = {
-       .owner          = THIS_MODULE,
-       .name           = "fuse",
-       .get_sb         = fuse_get_sb,
-       .kill_sb        = kill_anon_super,
-};
-
 static struct file_system_type fuseblk_fs_type = {
        .owner          = THIS_MODULE,
        .name           = "fuseblk",
 static struct file_system_type fuseblk_fs_type = {
        .owner          = THIS_MODULE,
        .name           = "fuseblk",
@@ -630,6 +655,26 @@ static struct file_system_type fuseblk_fs_type = {
        .fs_flags       = FS_REQUIRES_DEV,
 };
 
        .fs_flags       = FS_REQUIRES_DEV,
 };
 
+static inline int register_fuseblk(void)
+{
+       return register_filesystem(&fuseblk_fs_type);
+}
+
+static inline void unregister_fuseblk(void)
+{
+       unregister_filesystem(&fuseblk_fs_type);
+}
+#else
+static inline int register_fuseblk(void)
+{
+       return 0;
+}
+
+static inline void unregister_fuseblk(void)
+{
+}
+#endif
+
 static decl_subsys(fuse, NULL, NULL);
 static decl_subsys(connections, NULL, NULL);
 
 static decl_subsys(fuse, NULL, NULL);
 static decl_subsys(connections, NULL, NULL);
 
@@ -651,7 +696,7 @@ static int __init fuse_fs_init(void)
        if (err)
                goto out;
 
        if (err)
                goto out;
 
-       err = register_filesystem(&fuseblk_fs_type);
+       err = register_fuseblk();
        if (err)
                goto out_unreg;
 
        if (err)
                goto out_unreg;
 
@@ -666,7 +711,7 @@ static int __init fuse_fs_init(void)
        return 0;
 
  out_unreg2:
        return 0;
 
  out_unreg2:
-       unregister_filesystem(&fuseblk_fs_type);
+       unregister_fuseblk();
  out_unreg:
        unregister_filesystem(&fuse_fs_type);
  out:
  out_unreg:
        unregister_filesystem(&fuse_fs_type);
  out:
@@ -676,7 +721,7 @@ static int __init fuse_fs_init(void)
 static void fuse_fs_cleanup(void)
 {
        unregister_filesystem(&fuse_fs_type);
 static void fuse_fs_cleanup(void)
 {
        unregister_filesystem(&fuse_fs_type);
-       unregister_filesystem(&fuseblk_fs_type);
+       unregister_fuseblk();
        kmem_cache_destroy(fuse_inode_cachep);
 }
 
        kmem_cache_destroy(fuse_inode_cachep);
 }