diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2009-01-26 15:00:58 +0100 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.de> | 2009-01-26 15:00:58 +0100 |
commit | c2b8f006909b9bf9e165dfdf3c378527938c4497 (patch) | |
tree | 6e9549ba41936078a5d9e46fbc150bf3aa6f57be /fs/fuse | |
parent | 3ddf1e7f57237ac7c5d5bfb7058f1ea4f970b661 (diff) | |
download | kernel_goldelico_gta04-c2b8f006909b9bf9e165dfdf3c378527938c4497.zip kernel_goldelico_gta04-c2b8f006909b9bf9e165dfdf3c378527938c4497.tar.gz kernel_goldelico_gta04-c2b8f006909b9bf9e165dfdf3c378527938c4497.tar.bz2 |
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.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 6893717..dc649f6 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) int err; int is_bdev = sb->s_bdev != NULL; + err = -EINVAL; if (sb->s_flags & MS_MANDLOCK) - return -EINVAL; + goto err; if (!parse_fuse_opt((char *) data, &d, is_bdev)) - return -EINVAL; + goto err; if (is_bdev) { #ifdef CONFIG_BLOCK + err = -EINVAL; if (!sb_set_blocksize(sb, d.blksize)) - return -EINVAL; + goto err; #endif } else { sb->s_blocksize = PAGE_CACHE_SIZE; @@ -826,25 +828,22 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) sb->s_export_op = &fuse_export_operations; file = fget(d.fd); + err = -EINVAL; if (!file) - return -EINVAL; + goto err; - if (file->f_op != &fuse_dev_operations) { - fput(file); - return -EINVAL; - } + if (file->f_op != &fuse_dev_operations) + goto err_fput; fc = kmalloc(sizeof(*fc), GFP_KERNEL); - if (!fc) { - fput(file); - return -ENOMEM; - } + err = -ENOMEM; + if (!fc) + goto err_fput; err = fuse_conn_init(fc, sb); if (err) { - fput(file); kfree(fc); - return err; + goto err_fput; } fc->release = fuse_free_conn; @@ -859,12 +858,12 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) err = -ENOMEM; root = fuse_get_root_inode(sb, d.rootmode); if (!root) - goto err; + goto err_put_conn; root_dentry = d_alloc_root(root); if (!root_dentry) { iput(root); - goto err; + goto err_put_conn; } init_req = fuse_request_alloc(); @@ -908,9 +907,11 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) fuse_request_free(init_req); err_put_root: dput(root_dentry); - err: - fput(file); + err_put_conn: fuse_conn_put(fc); + err_fput: + fput(file); + err: return err; } |