diff options
author | Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> | 2009-03-04 15:06:34 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-03-27 14:44:03 -0400 |
commit | a3ec947c85ec339884b30ef6a08133e9311fdae1 (patch) | |
tree | c3cc5859a6b6d8986547405b6c5bd11bc8916114 | |
parent | 585d3bc06f4ca57f975a5a1f698f65a45ea66225 (diff) |
vfs: simple_set_mnt() should return void
simple_set_mnt() is defined as returning 'int' but always returns 0.
Callers assume simple_set_mnt() never fails and don't properly cleanup if
it were to _ever_ fail. For instance, get_sb_single() and get_sb_nodev()
should:
up_write(sb->s_unmount);
deactivate_super(sb);
if simple_set_mnt() fails.
Since simple_set_mnt() never fails, would be cleaner if it did not
return anything.
[akpm@linux-foundation.org: fix build]
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | drivers/mtd/mtdsuper.c | 7 | ||||
-rw-r--r-- | fs/9p/vfs_super.c | 5 | ||||
-rw-r--r-- | fs/cifs/cifsfs.c | 3 | ||||
-rw-r--r-- | fs/devpts/inode.c | 3 | ||||
-rw-r--r-- | fs/libfs.c | 3 | ||||
-rw-r--r-- | fs/namespace.c | 3 | ||||
-rw-r--r-- | fs/proc/root.c | 3 | ||||
-rw-r--r-- | fs/super.c | 9 | ||||
-rw-r--r-- | fs/ubifs/super.c | 3 | ||||
-rw-r--r-- | include/linux/fs.h | 2 | ||||
-rw-r--r-- | kernel/cgroup.c | 3 |
11 files changed, 28 insertions, 16 deletions
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c index 00d46e137b2a..92285d0089c2 100644 --- a/drivers/mtd/mtdsuper.c +++ b/drivers/mtd/mtdsuper.c | |||
@@ -81,13 +81,16 @@ static int get_sb_mtd_aux(struct file_system_type *fs_type, int flags, | |||
81 | 81 | ||
82 | /* go */ | 82 | /* go */ |
83 | sb->s_flags |= MS_ACTIVE; | 83 | sb->s_flags |= MS_ACTIVE; |
84 | return simple_set_mnt(mnt, sb); | 84 | simple_set_mnt(mnt, sb); |
85 | |||
86 | return 0; | ||
85 | 87 | ||
86 | /* new mountpoint for an already mounted superblock */ | 88 | /* new mountpoint for an already mounted superblock */ |
87 | already_mounted: | 89 | already_mounted: |
88 | DEBUG(1, "MTDSB: Device %d (\"%s\") is already mounted\n", | 90 | DEBUG(1, "MTDSB: Device %d (\"%s\") is already mounted\n", |
89 | mtd->index, mtd->name); | 91 | mtd->index, mtd->name); |
90 | ret = simple_set_mnt(mnt, sb); | 92 | simple_set_mnt(mnt, sb); |
93 | ret = 0; | ||
91 | goto out_put; | 94 | goto out_put; |
92 | 95 | ||
93 | out_error: | 96 | out_error: |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 93212e40221a..5f8ab8adb5f5 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -168,8 +168,9 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, | |||
168 | p9stat_free(st); | 168 | p9stat_free(st); |
169 | kfree(st); | 169 | kfree(st); |
170 | 170 | ||
171 | P9_DPRINTK(P9_DEBUG_VFS, " return simple set mount\n"); | 171 | P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); |
172 | return simple_set_mnt(mnt, sb); | 172 | simple_set_mnt(mnt, sb); |
173 | return 0; | ||
173 | 174 | ||
174 | release_sb: | 175 | release_sb: |
175 | if (sb) { | 176 | if (sb) { |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 13ea53251dcf..38491fd3871d 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -606,7 +606,8 @@ cifs_get_sb(struct file_system_type *fs_type, | |||
606 | return rc; | 606 | return rc; |
607 | } | 607 | } |
608 | sb->s_flags |= MS_ACTIVE; | 608 | sb->s_flags |= MS_ACTIVE; |
609 | return simple_set_mnt(mnt, sb); | 609 | simple_set_mnt(mnt, sb); |
610 | return 0; | ||
610 | } | 611 | } |
611 | 612 | ||
612 | static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | 613 | static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, |
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 140b43144cd8..b0a76340a4cd 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c | |||
@@ -454,7 +454,8 @@ static int get_init_pts_sb(struct file_system_type *fs_type, int flags, | |||
454 | s->s_flags |= MS_ACTIVE; | 454 | s->s_flags |= MS_ACTIVE; |
455 | } | 455 | } |
456 | do_remount_sb(s, flags, data, 0); | 456 | do_remount_sb(s, flags, data, 0); |
457 | return simple_set_mnt(mnt, s); | 457 | simple_set_mnt(mnt, s); |
458 | return 0; | ||
458 | } | 459 | } |
459 | 460 | ||
460 | /* | 461 | /* |
diff --git a/fs/libfs.c b/fs/libfs.c index ec600bd33e75..4910a36f516e 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -242,7 +242,8 @@ int get_sb_pseudo(struct file_system_type *fs_type, char *name, | |||
242 | d_instantiate(dentry, root); | 242 | d_instantiate(dentry, root); |
243 | s->s_root = dentry; | 243 | s->s_root = dentry; |
244 | s->s_flags |= MS_ACTIVE; | 244 | s->s_flags |= MS_ACTIVE; |
245 | return simple_set_mnt(mnt, s); | 245 | simple_set_mnt(mnt, s); |
246 | return 0; | ||
246 | 247 | ||
247 | Enomem: | 248 | Enomem: |
248 | up_write(&s->s_umount); | 249 | up_write(&s->s_umount); |
diff --git a/fs/namespace.c b/fs/namespace.c index 06f8e63f6cb1..2432ca6bb223 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -397,11 +397,10 @@ static void __mnt_unmake_readonly(struct vfsmount *mnt) | |||
397 | spin_unlock(&vfsmount_lock); | 397 | spin_unlock(&vfsmount_lock); |
398 | } | 398 | } |
399 | 399 | ||
400 | int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb) | 400 | void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb) |
401 | { | 401 | { |
402 | mnt->mnt_sb = sb; | 402 | mnt->mnt_sb = sb; |
403 | mnt->mnt_root = dget(sb->s_root); | 403 | mnt->mnt_root = dget(sb->s_root); |
404 | return 0; | ||
405 | } | 404 | } |
406 | 405 | ||
407 | EXPORT_SYMBOL(simple_set_mnt); | 406 | EXPORT_SYMBOL(simple_set_mnt); |
diff --git a/fs/proc/root.c b/fs/proc/root.c index f6299a25594e..1e15a2b176e8 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
@@ -83,7 +83,8 @@ static int proc_get_sb(struct file_system_type *fs_type, | |||
83 | ns->proc_mnt = mnt; | 83 | ns->proc_mnt = mnt; |
84 | } | 84 | } |
85 | 85 | ||
86 | return simple_set_mnt(mnt, sb); | 86 | simple_set_mnt(mnt, sb); |
87 | return 0; | ||
87 | } | 88 | } |
88 | 89 | ||
89 | static void proc_kill_sb(struct super_block *sb) | 90 | static void proc_kill_sb(struct super_block *sb) |
diff --git a/fs/super.c b/fs/super.c index 6ce501447ada..e512fab64c93 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -831,7 +831,8 @@ int get_sb_bdev(struct file_system_type *fs_type, | |||
831 | bdev->bd_super = s; | 831 | bdev->bd_super = s; |
832 | } | 832 | } |
833 | 833 | ||
834 | return simple_set_mnt(mnt, s); | 834 | simple_set_mnt(mnt, s); |
835 | return 0; | ||
835 | 836 | ||
836 | error_s: | 837 | error_s: |
837 | error = PTR_ERR(s); | 838 | error = PTR_ERR(s); |
@@ -877,7 +878,8 @@ int get_sb_nodev(struct file_system_type *fs_type, | |||
877 | return error; | 878 | return error; |
878 | } | 879 | } |
879 | s->s_flags |= MS_ACTIVE; | 880 | s->s_flags |= MS_ACTIVE; |
880 | return simple_set_mnt(mnt, s); | 881 | simple_set_mnt(mnt, s); |
882 | return 0; | ||
881 | } | 883 | } |
882 | 884 | ||
883 | EXPORT_SYMBOL(get_sb_nodev); | 885 | EXPORT_SYMBOL(get_sb_nodev); |
@@ -909,7 +911,8 @@ int get_sb_single(struct file_system_type *fs_type, | |||
909 | s->s_flags |= MS_ACTIVE; | 911 | s->s_flags |= MS_ACTIVE; |
910 | } | 912 | } |
911 | do_remount_sb(s, flags, data, 0); | 913 | do_remount_sb(s, flags, data, 0); |
912 | return simple_set_mnt(mnt, s); | 914 | simple_set_mnt(mnt, s); |
915 | return 0; | ||
913 | } | 916 | } |
914 | 917 | ||
915 | EXPORT_SYMBOL(get_sb_single); | 918 | EXPORT_SYMBOL(get_sb_single); |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 1182b66a5491..c5c98355459a 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -2034,7 +2034,8 @@ static int ubifs_get_sb(struct file_system_type *fs_type, int flags, | |||
2034 | /* 'fill_super()' opens ubi again so we must close it here */ | 2034 | /* 'fill_super()' opens ubi again so we must close it here */ |
2035 | ubi_close_volume(ubi); | 2035 | ubi_close_volume(ubi); |
2036 | 2036 | ||
2037 | return simple_set_mnt(mnt, sb); | 2037 | simple_set_mnt(mnt, sb); |
2038 | return 0; | ||
2038 | 2039 | ||
2039 | out_deact: | 2040 | out_deact: |
2040 | up_write(&sb->s_umount); | 2041 | up_write(&sb->s_umount); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index c2c4454a268a..a7d73914a9f7 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1719,7 +1719,7 @@ struct super_block *sget(struct file_system_type *type, | |||
1719 | extern int get_sb_pseudo(struct file_system_type *, char *, | 1719 | extern int get_sb_pseudo(struct file_system_type *, char *, |
1720 | const struct super_operations *ops, unsigned long, | 1720 | const struct super_operations *ops, unsigned long, |
1721 | struct vfsmount *mnt); | 1721 | struct vfsmount *mnt); |
1722 | extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); | 1722 | extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); |
1723 | int __put_super_and_need_restart(struct super_block *sb); | 1723 | int __put_super_and_need_restart(struct super_block *sb); |
1724 | 1724 | ||
1725 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ | 1725 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index b01100ebd074..c500ca7239b2 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -1071,7 +1071,8 @@ static int cgroup_get_sb(struct file_system_type *fs_type, | |||
1071 | mutex_unlock(&cgroup_mutex); | 1071 | mutex_unlock(&cgroup_mutex); |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | return simple_set_mnt(mnt, sb); | 1074 | simple_set_mnt(mnt, sb); |
1075 | return 0; | ||
1075 | 1076 | ||
1076 | free_cg_links: | 1077 | free_cg_links: |
1077 | free_cg_links(&tmp_cg_links); | 1078 | free_cg_links(&tmp_cg_links); |