diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-12-10 16:35:14 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-01-25 03:13:01 -0500 |
commit | 2309fb8ef40e82c4175100c37eb3d9db9e572ca5 (patch) | |
tree | d79142b7d81b7a65e229f1adbddc43ba209bbce0 /fs/cramfs | |
parent | 842a859db26b707f06fc9fbbb9137a9b90910e49 (diff) |
cramfs: get rid of ->put_super()
failure exits are simpler that way
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/cramfs')
-rw-r--r-- | fs/cramfs/inode.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index e501ac3a49ff..508a7524fe38 100644 --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c | |||
@@ -219,10 +219,11 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i | |||
219 | return read_buffers[buffer] + offset; | 219 | return read_buffers[buffer] + offset; |
220 | } | 220 | } |
221 | 221 | ||
222 | static void cramfs_put_super(struct super_block *sb) | 222 | static void cramfs_kill_sb(struct super_block *sb) |
223 | { | 223 | { |
224 | kfree(sb->s_fs_info); | 224 | struct cramfs_sb_info *sbi = sb->s_fs_info; |
225 | sb->s_fs_info = NULL; | 225 | kill_block_super(sb); |
226 | kfree(sbi); | ||
226 | } | 227 | } |
227 | 228 | ||
228 | static int cramfs_remount(struct super_block *sb, int *flags, char *data) | 229 | static int cramfs_remount(struct super_block *sb, int *flags, char *data) |
@@ -261,7 +262,7 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent) | |||
261 | if (super.magic == CRAMFS_MAGIC_WEND) { | 262 | if (super.magic == CRAMFS_MAGIC_WEND) { |
262 | if (!silent) | 263 | if (!silent) |
263 | printk(KERN_ERR "cramfs: wrong endianness\n"); | 264 | printk(KERN_ERR "cramfs: wrong endianness\n"); |
264 | goto out; | 265 | return -EINVAL; |
265 | } | 266 | } |
266 | 267 | ||
267 | /* check at 512 byte offset */ | 268 | /* check at 512 byte offset */ |
@@ -273,20 +274,20 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent) | |||
273 | printk(KERN_ERR "cramfs: wrong endianness\n"); | 274 | printk(KERN_ERR "cramfs: wrong endianness\n"); |
274 | else if (!silent) | 275 | else if (!silent) |
275 | printk(KERN_ERR "cramfs: wrong magic\n"); | 276 | printk(KERN_ERR "cramfs: wrong magic\n"); |
276 | goto out; | 277 | return -EINVAL; |
277 | } | 278 | } |
278 | } | 279 | } |
279 | 280 | ||
280 | /* get feature flags first */ | 281 | /* get feature flags first */ |
281 | if (super.flags & ~CRAMFS_SUPPORTED_FLAGS) { | 282 | if (super.flags & ~CRAMFS_SUPPORTED_FLAGS) { |
282 | printk(KERN_ERR "cramfs: unsupported filesystem features\n"); | 283 | printk(KERN_ERR "cramfs: unsupported filesystem features\n"); |
283 | goto out; | 284 | return -EINVAL; |
284 | } | 285 | } |
285 | 286 | ||
286 | /* Check that the root inode is in a sane state */ | 287 | /* Check that the root inode is in a sane state */ |
287 | if (!S_ISDIR(super.root.mode)) { | 288 | if (!S_ISDIR(super.root.mode)) { |
288 | printk(KERN_ERR "cramfs: root is not a directory\n"); | 289 | printk(KERN_ERR "cramfs: root is not a directory\n"); |
289 | goto out; | 290 | return -EINVAL; |
290 | } | 291 | } |
291 | /* correct strange, hard-coded permissions of mkcramfs */ | 292 | /* correct strange, hard-coded permissions of mkcramfs */ |
292 | super.root.mode |= (S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); | 293 | super.root.mode |= (S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); |
@@ -310,22 +311,18 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent) | |||
310 | (root_offset != 512 + sizeof(struct cramfs_super)))) | 311 | (root_offset != 512 + sizeof(struct cramfs_super)))) |
311 | { | 312 | { |
312 | printk(KERN_ERR "cramfs: bad root offset %lu\n", root_offset); | 313 | printk(KERN_ERR "cramfs: bad root offset %lu\n", root_offset); |
313 | goto out; | 314 | return -EINVAL; |
314 | } | 315 | } |
315 | 316 | ||
316 | /* Set it all up.. */ | 317 | /* Set it all up.. */ |
317 | sb->s_op = &cramfs_ops; | 318 | sb->s_op = &cramfs_ops; |
318 | root = get_cramfs_inode(sb, &super.root, 0); | 319 | root = get_cramfs_inode(sb, &super.root, 0); |
319 | if (IS_ERR(root)) | 320 | if (IS_ERR(root)) |
320 | goto out; | 321 | return PTR_ERR(root); |
321 | sb->s_root = d_make_root(root); | 322 | sb->s_root = d_make_root(root); |
322 | if (!sb->s_root) | 323 | if (!sb->s_root) |
323 | goto out; | 324 | return -ENOMEM; |
324 | return 0; | 325 | return 0; |
325 | out: | ||
326 | kfree(sbi); | ||
327 | sb->s_fs_info = NULL; | ||
328 | return -EINVAL; | ||
329 | } | 326 | } |
330 | 327 | ||
331 | static int cramfs_statfs(struct dentry *dentry, struct kstatfs *buf) | 328 | static int cramfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
@@ -550,7 +547,6 @@ static const struct inode_operations cramfs_dir_inode_operations = { | |||
550 | }; | 547 | }; |
551 | 548 | ||
552 | static const struct super_operations cramfs_ops = { | 549 | static const struct super_operations cramfs_ops = { |
553 | .put_super = cramfs_put_super, | ||
554 | .remount_fs = cramfs_remount, | 550 | .remount_fs = cramfs_remount, |
555 | .statfs = cramfs_statfs, | 551 | .statfs = cramfs_statfs, |
556 | }; | 552 | }; |
@@ -565,7 +561,7 @@ static struct file_system_type cramfs_fs_type = { | |||
565 | .owner = THIS_MODULE, | 561 | .owner = THIS_MODULE, |
566 | .name = "cramfs", | 562 | .name = "cramfs", |
567 | .mount = cramfs_mount, | 563 | .mount = cramfs_mount, |
568 | .kill_sb = kill_block_super, | 564 | .kill_sb = cramfs_kill_sb, |
569 | .fs_flags = FS_REQUIRES_DEV, | 565 | .fs_flags = FS_REQUIRES_DEV, |
570 | }; | 566 | }; |
571 | MODULE_ALIAS_FS("cramfs"); | 567 | MODULE_ALIAS_FS("cramfs"); |