Commit cfbc0683af235106e7dabe92003870b82ad6f0ba
Committed by
Trond Myklebust
1 parent
bb6fbc4548
Exists in
master
and in
7 other branches
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>
Showing 1 changed file with 20 additions and 5 deletions Side-by-side Diff
fs/nfs/super.c
... | ... | @@ -2214,7 +2214,7 @@ |
2214 | 2214 | } else { |
2215 | 2215 | error = nfs_bdi_register(server); |
2216 | 2216 | if (error) |
2217 | - goto error_splat_super; | |
2217 | + goto error_splat_bdi; | |
2218 | 2218 | } |
2219 | 2219 | |
2220 | 2220 | if (!s->s_root) { |
... | ... | @@ -2256,6 +2256,9 @@ |
2256 | 2256 | error_splat_root: |
2257 | 2257 | dput(mntroot); |
2258 | 2258 | error_splat_super: |
2259 | + if (server && !s->s_root) | |
2260 | + bdi_unregister(&server->backing_dev_info); | |
2261 | +error_splat_bdi: | |
2259 | 2262 | deactivate_locked_super(s); |
2260 | 2263 | goto out; |
2261 | 2264 | } |
... | ... | @@ -2326,7 +2329,7 @@ |
2326 | 2329 | } else { |
2327 | 2330 | error = nfs_bdi_register(server); |
2328 | 2331 | if (error) |
2329 | - goto error_splat_super; | |
2332 | + goto error_splat_bdi; | |
2330 | 2333 | } |
2331 | 2334 | |
2332 | 2335 | if (!s->s_root) { |
... | ... | @@ -2363,6 +2366,9 @@ |
2363 | 2366 | return error; |
2364 | 2367 | |
2365 | 2368 | error_splat_super: |
2369 | + if (server && !s->s_root) | |
2370 | + bdi_unregister(&server->backing_dev_info); | |
2371 | +error_splat_bdi: | |
2366 | 2372 | deactivate_locked_super(s); |
2367 | 2373 | dprintk("<-- nfs_xdev_get_sb() = %d [splat]\n", error); |
2368 | 2374 | return error; |
... | ... | @@ -2578,7 +2584,7 @@ |
2578 | 2584 | } else { |
2579 | 2585 | error = nfs_bdi_register(server); |
2580 | 2586 | if (error) |
2581 | - goto error_splat_super; | |
2587 | + goto error_splat_bdi; | |
2582 | 2588 | } |
2583 | 2589 | |
2584 | 2590 | if (!s->s_root) { |
... | ... | @@ -2616,6 +2622,9 @@ |
2616 | 2622 | error_splat_root: |
2617 | 2623 | dput(mntroot); |
2618 | 2624 | error_splat_super: |
2625 | + if (server && !s->s_root) | |
2626 | + bdi_unregister(&server->backing_dev_info); | |
2627 | +error_splat_bdi: | |
2619 | 2628 | deactivate_locked_super(s); |
2620 | 2629 | goto out; |
2621 | 2630 | } |
... | ... | @@ -2811,7 +2820,7 @@ |
2811 | 2820 | } else { |
2812 | 2821 | error = nfs_bdi_register(server); |
2813 | 2822 | if (error) |
2814 | - goto error_splat_super; | |
2823 | + goto error_splat_bdi; | |
2815 | 2824 | } |
2816 | 2825 | |
2817 | 2826 | if (!s->s_root) { |
... | ... | @@ -2847,6 +2856,9 @@ |
2847 | 2856 | return error; |
2848 | 2857 | |
2849 | 2858 | error_splat_super: |
2859 | + if (server && !s->s_root) | |
2860 | + bdi_unregister(&server->backing_dev_info); | |
2861 | +error_splat_bdi: | |
2850 | 2862 | deactivate_locked_super(s); |
2851 | 2863 | dprintk("<-- nfs4_xdev_get_sb() = %d [splat]\n", error); |
2852 | 2864 | return error; |
... | ... | @@ -2893,7 +2905,7 @@ |
2893 | 2905 | } else { |
2894 | 2906 | error = nfs_bdi_register(server); |
2895 | 2907 | if (error) |
2896 | - goto error_splat_super; | |
2908 | + goto error_splat_bdi; | |
2897 | 2909 | } |
2898 | 2910 | |
2899 | 2911 | if (!s->s_root) { |
... | ... | @@ -2929,6 +2941,9 @@ |
2929 | 2941 | return error; |
2930 | 2942 | |
2931 | 2943 | error_splat_super: |
2944 | + if (server && !s->s_root) | |
2945 | + bdi_unregister(&server->backing_dev_info); | |
2946 | +error_splat_bdi: | |
2932 | 2947 | deactivate_locked_super(s); |
2933 | 2948 | dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error); |
2934 | 2949 | return error; |