diff options
Diffstat (limited to 'fs/fuse/inode.c')
-rw-r--r-- | fs/fuse/inode.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 47c96fdca1ac..459b73dd45e1 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -292,6 +292,7 @@ static void fuse_put_super(struct super_block *sb) | |||
292 | list_del(&fc->entry); | 292 | list_del(&fc->entry); |
293 | fuse_ctl_remove_conn(fc); | 293 | fuse_ctl_remove_conn(fc); |
294 | mutex_unlock(&fuse_mutex); | 294 | mutex_unlock(&fuse_mutex); |
295 | bdi_destroy(&fc->bdi); | ||
295 | fuse_conn_put(fc); | 296 | fuse_conn_put(fc); |
296 | } | 297 | } |
297 | 298 | ||
@@ -532,7 +533,6 @@ void fuse_conn_put(struct fuse_conn *fc) | |||
532 | if (fc->destroy_req) | 533 | if (fc->destroy_req) |
533 | fuse_request_free(fc->destroy_req); | 534 | fuse_request_free(fc->destroy_req); |
534 | mutex_destroy(&fc->inst_mutex); | 535 | mutex_destroy(&fc->inst_mutex); |
535 | bdi_destroy(&fc->bdi); | ||
536 | fc->release(fc); | 536 | fc->release(fc); |
537 | } | 537 | } |
538 | } | 538 | } |
@@ -805,16 +805,18 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
805 | int err; | 805 | int err; |
806 | int is_bdev = sb->s_bdev != NULL; | 806 | int is_bdev = sb->s_bdev != NULL; |
807 | 807 | ||
808 | err = -EINVAL; | ||
808 | if (sb->s_flags & MS_MANDLOCK) | 809 | if (sb->s_flags & MS_MANDLOCK) |
809 | return -EINVAL; | 810 | goto err; |
810 | 811 | ||
811 | if (!parse_fuse_opt((char *) data, &d, is_bdev)) | 812 | if (!parse_fuse_opt((char *) data, &d, is_bdev)) |
812 | return -EINVAL; | 813 | goto err; |
813 | 814 | ||
814 | if (is_bdev) { | 815 | if (is_bdev) { |
815 | #ifdef CONFIG_BLOCK | 816 | #ifdef CONFIG_BLOCK |
817 | err = -EINVAL; | ||
816 | if (!sb_set_blocksize(sb, d.blksize)) | 818 | if (!sb_set_blocksize(sb, d.blksize)) |
817 | return -EINVAL; | 819 | goto err; |
818 | #endif | 820 | #endif |
819 | } else { | 821 | } else { |
820 | sb->s_blocksize = PAGE_CACHE_SIZE; | 822 | sb->s_blocksize = PAGE_CACHE_SIZE; |
@@ -826,20 +828,22 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
826 | sb->s_export_op = &fuse_export_operations; | 828 | sb->s_export_op = &fuse_export_operations; |
827 | 829 | ||
828 | file = fget(d.fd); | 830 | file = fget(d.fd); |
831 | err = -EINVAL; | ||
829 | if (!file) | 832 | if (!file) |
830 | return -EINVAL; | 833 | goto err; |
831 | 834 | ||
832 | if (file->f_op != &fuse_dev_operations) | 835 | if (file->f_op != &fuse_dev_operations) |
833 | return -EINVAL; | 836 | goto err_fput; |
834 | 837 | ||
835 | fc = kmalloc(sizeof(*fc), GFP_KERNEL); | 838 | fc = kmalloc(sizeof(*fc), GFP_KERNEL); |
839 | err = -ENOMEM; | ||
836 | if (!fc) | 840 | if (!fc) |
837 | return -ENOMEM; | 841 | goto err_fput; |
838 | 842 | ||
839 | err = fuse_conn_init(fc, sb); | 843 | err = fuse_conn_init(fc, sb); |
840 | if (err) { | 844 | if (err) { |
841 | kfree(fc); | 845 | kfree(fc); |
842 | return err; | 846 | goto err_fput; |
843 | } | 847 | } |
844 | 848 | ||
845 | fc->release = fuse_free_conn; | 849 | fc->release = fuse_free_conn; |
@@ -854,12 +858,12 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
854 | err = -ENOMEM; | 858 | err = -ENOMEM; |
855 | root = fuse_get_root_inode(sb, d.rootmode); | 859 | root = fuse_get_root_inode(sb, d.rootmode); |
856 | if (!root) | 860 | if (!root) |
857 | goto err; | 861 | goto err_put_conn; |
858 | 862 | ||
859 | root_dentry = d_alloc_root(root); | 863 | root_dentry = d_alloc_root(root); |
860 | if (!root_dentry) { | 864 | if (!root_dentry) { |
861 | iput(root); | 865 | iput(root); |
862 | goto err; | 866 | goto err_put_conn; |
863 | } | 867 | } |
864 | 868 | ||
865 | init_req = fuse_request_alloc(); | 869 | init_req = fuse_request_alloc(); |
@@ -903,9 +907,11 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
903 | fuse_request_free(init_req); | 907 | fuse_request_free(init_req); |
904 | err_put_root: | 908 | err_put_root: |
905 | dput(root_dentry); | 909 | dput(root_dentry); |
906 | err: | 910 | err_put_conn: |
907 | fput(file); | ||
908 | fuse_conn_put(fc); | 911 | fuse_conn_put(fc); |
912 | err_fput: | ||
913 | fput(file); | ||
914 | err: | ||
909 | return err; | 915 | return err; |
910 | } | 916 | } |
911 | 917 | ||