Commit cfbc0683 authored by NeilBrown's avatar NeilBrown Committed by Trond Myklebust

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: default avatarNeilBrown <neilb@suse.de>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent bb6fbc45
...@@ -2214,7 +2214,7 @@ static int nfs_get_sb(struct file_system_type *fs_type, ...@@ -2214,7 +2214,7 @@ static int nfs_get_sb(struct file_system_type *fs_type,
} else { } else {
error = nfs_bdi_register(server); error = nfs_bdi_register(server);
if (error) if (error)
goto error_splat_super; goto error_splat_bdi;
} }
if (!s->s_root) { if (!s->s_root) {
...@@ -2256,6 +2256,9 @@ static int nfs_get_sb(struct file_system_type *fs_type, ...@@ -2256,6 +2256,9 @@ static int nfs_get_sb(struct file_system_type *fs_type,
error_splat_root: error_splat_root:
dput(mntroot); dput(mntroot);
error_splat_super: error_splat_super:
if (server && !s->s_root)
bdi_unregister(&server->backing_dev_info);
error_splat_bdi:
deactivate_locked_super(s); deactivate_locked_super(s);
goto out; goto out;
} }
...@@ -2326,7 +2329,7 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags, ...@@ -2326,7 +2329,7 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
} else { } else {
error = nfs_bdi_register(server); error = nfs_bdi_register(server);
if (error) if (error)
goto error_splat_super; goto error_splat_bdi;
} }
if (!s->s_root) { if (!s->s_root) {
...@@ -2363,6 +2366,9 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags, ...@@ -2363,6 +2366,9 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
return error; return error;
error_splat_super: error_splat_super:
if (server && !s->s_root)
bdi_unregister(&server->backing_dev_info);
error_splat_bdi:
deactivate_locked_super(s); deactivate_locked_super(s);
dprintk("<-- nfs_xdev_get_sb() = %d [splat]\n", error); dprintk("<-- nfs_xdev_get_sb() = %d [splat]\n", error);
return error; return error;
...@@ -2578,7 +2584,7 @@ static int nfs4_remote_get_sb(struct file_system_type *fs_type, ...@@ -2578,7 +2584,7 @@ static int nfs4_remote_get_sb(struct file_system_type *fs_type,
} else { } else {
error = nfs_bdi_register(server); error = nfs_bdi_register(server);
if (error) if (error)
goto error_splat_super; goto error_splat_bdi;
} }
if (!s->s_root) { if (!s->s_root) {
...@@ -2616,6 +2622,9 @@ static int nfs4_remote_get_sb(struct file_system_type *fs_type, ...@@ -2616,6 +2622,9 @@ static int nfs4_remote_get_sb(struct file_system_type *fs_type,
error_splat_root: error_splat_root:
dput(mntroot); dput(mntroot);
error_splat_super: error_splat_super:
if (server && !s->s_root)
bdi_unregister(&server->backing_dev_info);
error_splat_bdi:
deactivate_locked_super(s); deactivate_locked_super(s);
goto out; goto out;
} }
...@@ -2811,7 +2820,7 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags, ...@@ -2811,7 +2820,7 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
} else { } else {
error = nfs_bdi_register(server); error = nfs_bdi_register(server);
if (error) if (error)
goto error_splat_super; goto error_splat_bdi;
} }
if (!s->s_root) { if (!s->s_root) {
...@@ -2847,6 +2856,9 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags, ...@@ -2847,6 +2856,9 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
return error; return error;
error_splat_super: error_splat_super:
if (server && !s->s_root)
bdi_unregister(&server->backing_dev_info);
error_splat_bdi:
deactivate_locked_super(s); deactivate_locked_super(s);
dprintk("<-- nfs4_xdev_get_sb() = %d [splat]\n", error); dprintk("<-- nfs4_xdev_get_sb() = %d [splat]\n", error);
return error; return error;
...@@ -2893,7 +2905,7 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type, ...@@ -2893,7 +2905,7 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type,
} else { } else {
error = nfs_bdi_register(server); error = nfs_bdi_register(server);
if (error) if (error)
goto error_splat_super; goto error_splat_bdi;
} }
if (!s->s_root) { if (!s->s_root) {
...@@ -2929,6 +2941,9 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type, ...@@ -2929,6 +2941,9 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type,
return error; return error;
error_splat_super: error_splat_super:
if (server && !s->s_root)
bdi_unregister(&server->backing_dev_info);
error_splat_bdi:
deactivate_locked_super(s); deactivate_locked_super(s);
dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error); dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error);
return error; return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment