aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-03-10 19:20:17 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-03-15 15:37:45 -0400
commitcfbc0683af235106e7dabe92003870b82ad6f0ba (patch)
tree6668f249999c9fde9d6f97e6307e414159bacfcf /fs/nfs
parentbb6fbc4548b9ae7ebbd06ef72f00229df259d217 (diff)
NFS: ensure bdi_unregister is called on mount failure.
bdi_unregister is called by nfs_put_super which is only called by generic_shutdown_super if ->s_root is not NULL. So if we error out in a circumstance where we called nfs_bdi_register (i.e. server != NULL) but have not set s_root, then we need to call bdi_unregister explicitly in nfs_get_sb and various other *_get_sb() functions. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/super.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index f1afee4eea77..6baf9a393466 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2214,7 +2214,7 @@ static int nfs_get_sb(struct file_system_type *fs_type,
2214 } else { 2214 } else {
2215 error = nfs_bdi_register(server); 2215 error = nfs_bdi_register(server);
2216 if (error) 2216 if (error)
2217 goto error_splat_super; 2217 goto error_splat_bdi;
2218 } 2218 }
2219 2219
2220 if (!s->s_root) { 2220 if (!s->s_root) {
@@ -2256,6 +2256,9 @@ out_err_nosb:
2256error_splat_root: 2256error_splat_root:
2257 dput(mntroot); 2257 dput(mntroot);
2258error_splat_super: 2258error_splat_super:
2259 if (server && !s->s_root)
2260 bdi_unregister(&server->backing_dev_info);
2261error_splat_bdi:
2259 deactivate_locked_super(s); 2262 deactivate_locked_super(s);
2260 goto out; 2263 goto out;
2261} 2264}
@@ -2326,7 +2329,7 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
2326 } else { 2329 } else {
2327 error = nfs_bdi_register(server); 2330 error = nfs_bdi_register(server);
2328 if (error) 2331 if (error)
2329 goto error_splat_super; 2332 goto error_splat_bdi;
2330 } 2333 }
2331 2334
2332 if (!s->s_root) { 2335 if (!s->s_root) {
@@ -2363,6 +2366,9 @@ out_err_noserver:
2363 return error; 2366 return error;
2364 2367
2365error_splat_super: 2368error_splat_super:
2369 if (server && !s->s_root)
2370 bdi_unregister(&server->backing_dev_info);
2371error_splat_bdi:
2366 deactivate_locked_super(s); 2372 deactivate_locked_super(s);
2367 dprintk("<-- nfs_xdev_get_sb() = %d [splat]\n", error); 2373 dprintk("<-- nfs_xdev_get_sb() = %d [splat]\n", error);
2368 return error; 2374 return error;
@@ -2578,7 +2584,7 @@ static int nfs4_remote_get_sb(struct file_system_type *fs_type,
2578 } else { 2584 } else {
2579 error = nfs_bdi_register(server); 2585 error = nfs_bdi_register(server);
2580 if (error) 2586 if (error)
2581 goto error_splat_super; 2587 goto error_splat_bdi;
2582 } 2588 }
2583 2589
2584 if (!s->s_root) { 2590 if (!s->s_root) {
@@ -2616,6 +2622,9 @@ out_free:
2616error_splat_root: 2622error_splat_root:
2617 dput(mntroot); 2623 dput(mntroot);
2618error_splat_super: 2624error_splat_super:
2625 if (server && !s->s_root)
2626 bdi_unregister(&server->backing_dev_info);
2627error_splat_bdi:
2619 deactivate_locked_super(s); 2628 deactivate_locked_super(s);
2620 goto out; 2629 goto out;
2621} 2630}
@@ -2811,7 +2820,7 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
2811 } else { 2820 } else {
2812 error = nfs_bdi_register(server); 2821 error = nfs_bdi_register(server);
2813 if (error) 2822 if (error)
2814 goto error_splat_super; 2823 goto error_splat_bdi;
2815 } 2824 }
2816 2825
2817 if (!s->s_root) { 2826 if (!s->s_root) {
@@ -2847,6 +2856,9 @@ out_err_noserver:
2847 return error; 2856 return error;
2848 2857
2849error_splat_super: 2858error_splat_super:
2859 if (server && !s->s_root)
2860 bdi_unregister(&server->backing_dev_info);
2861error_splat_bdi:
2850 deactivate_locked_super(s); 2862 deactivate_locked_super(s);
2851 dprintk("<-- nfs4_xdev_get_sb() = %d [splat]\n", error); 2863 dprintk("<-- nfs4_xdev_get_sb() = %d [splat]\n", error);
2852 return error; 2864 return error;
@@ -2893,7 +2905,7 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type,
2893 } else { 2905 } else {
2894 error = nfs_bdi_register(server); 2906 error = nfs_bdi_register(server);
2895 if (error) 2907 if (error)
2896 goto error_splat_super; 2908 goto error_splat_bdi;
2897 } 2909 }
2898 2910
2899 if (!s->s_root) { 2911 if (!s->s_root) {
@@ -2929,6 +2941,9 @@ out_err_noserver:
2929 return error; 2941 return error;
2930 2942
2931error_splat_super: 2943error_splat_super:
2944 if (server && !s->s_root)
2945 bdi_unregister(&server->backing_dev_info);
2946error_splat_bdi:
2932 deactivate_locked_super(s); 2947 deactivate_locked_super(s);
2933 dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error); 2948 dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error);
2934 return error; 2949 return error;