aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2009-01-26 09:00:58 -0500
committerMiklos Szeredi <mszeredi@suse.de>2009-01-26 09:00:58 -0500
commitc2b8f006909b9bf9e165dfdf3c378527938c4497 (patch)
tree6e9549ba41936078a5d9e46fbc150bf3aa6f57be /fs/fuse
parent3ddf1e7f57237ac7c5d5bfb7058f1ea4f970b661 (diff)
fuse: fuse_fill_super error handling cleanup
Clean up error handling for the whole of fuse_fill_super() function. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/inode.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 6893717b6536..dc649f6bc3e5 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -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,25 +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 fput(file); 836 goto err_fput;
834 return -EINVAL;
835 }
836 837
837 fc = kmalloc(sizeof(*fc), GFP_KERNEL); 838 fc = kmalloc(sizeof(*fc), GFP_KERNEL);
838 if (!fc) { 839 err = -ENOMEM;
839 fput(file); 840 if (!fc)
840 return -ENOMEM; 841 goto err_fput;
841 }
842 842
843 err = fuse_conn_init(fc, sb); 843 err = fuse_conn_init(fc, sb);
844 if (err) { 844 if (err) {
845 fput(file);
846 kfree(fc); 845 kfree(fc);
847 return err; 846 goto err_fput;
848 } 847 }
849 848
850 fc->release = fuse_free_conn; 849 fc->release = fuse_free_conn;
@@ -859,12 +858,12 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
859 err = -ENOMEM; 858 err = -ENOMEM;
860 root = fuse_get_root_inode(sb, d.rootmode); 859 root = fuse_get_root_inode(sb, d.rootmode);
861 if (!root) 860 if (!root)
862 goto err; 861 goto err_put_conn;
863 862
864 root_dentry = d_alloc_root(root); 863 root_dentry = d_alloc_root(root);
865 if (!root_dentry) { 864 if (!root_dentry) {
866 iput(root); 865 iput(root);
867 goto err; 866 goto err_put_conn;
868 } 867 }
869 868
870 init_req = fuse_request_alloc(); 869 init_req = fuse_request_alloc();
@@ -908,9 +907,11 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
908 fuse_request_free(init_req); 907 fuse_request_free(init_req);
909 err_put_root: 908 err_put_root:
910 dput(root_dentry); 909 dput(root_dentry);
911 err: 910 err_put_conn:
912 fput(file);
913 fuse_conn_put(fc); 911 fuse_conn_put(fc);
912 err_fput:
913 fput(file);
914 err:
914 return err; 915 return err;
915} 916}
916 917