mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
bb6fbc4548
commit
cfbc0683af
|
@ -2214,7 +2214,7 @@ static int nfs_get_sb(struct file_system_type *fs_type,
|
|||
} else {
|
||||
error = nfs_bdi_register(server);
|
||||
if (error)
|
||||
goto error_splat_super;
|
||||
goto error_splat_bdi;
|
||||
}
|
||||
|
||||
if (!s->s_root) {
|
||||
|
@ -2256,6 +2256,9 @@ static int nfs_get_sb(struct file_system_type *fs_type,
|
|||
error_splat_root:
|
||||
dput(mntroot);
|
||||
error_splat_super:
|
||||
if (server && !s->s_root)
|
||||
bdi_unregister(&server->backing_dev_info);
|
||||
error_splat_bdi:
|
||||
deactivate_locked_super(s);
|
||||
goto out;
|
||||
}
|
||||
|
@ -2326,7 +2329,7 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
|
|||
} else {
|
||||
error = nfs_bdi_register(server);
|
||||
if (error)
|
||||
goto error_splat_super;
|
||||
goto error_splat_bdi;
|
||||
}
|
||||
|
||||
if (!s->s_root) {
|
||||
|
@ -2363,6 +2366,9 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
|
|||
return error;
|
||||
|
||||
error_splat_super:
|
||||
if (server && !s->s_root)
|
||||
bdi_unregister(&server->backing_dev_info);
|
||||
error_splat_bdi:
|
||||
deactivate_locked_super(s);
|
||||
dprintk("<-- nfs_xdev_get_sb() = %d [splat]\n", error);
|
||||
return error;
|
||||
|
@ -2578,7 +2584,7 @@ static int nfs4_remote_get_sb(struct file_system_type *fs_type,
|
|||
} else {
|
||||
error = nfs_bdi_register(server);
|
||||
if (error)
|
||||
goto error_splat_super;
|
||||
goto error_splat_bdi;
|
||||
}
|
||||
|
||||
if (!s->s_root) {
|
||||
|
@ -2616,6 +2622,9 @@ static int nfs4_remote_get_sb(struct file_system_type *fs_type,
|
|||
error_splat_root:
|
||||
dput(mntroot);
|
||||
error_splat_super:
|
||||
if (server && !s->s_root)
|
||||
bdi_unregister(&server->backing_dev_info);
|
||||
error_splat_bdi:
|
||||
deactivate_locked_super(s);
|
||||
goto out;
|
||||
}
|
||||
|
@ -2811,7 +2820,7 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
|
|||
} else {
|
||||
error = nfs_bdi_register(server);
|
||||
if (error)
|
||||
goto error_splat_super;
|
||||
goto error_splat_bdi;
|
||||
}
|
||||
|
||||
if (!s->s_root) {
|
||||
|
@ -2847,6 +2856,9 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
|
|||
return error;
|
||||
|
||||
error_splat_super:
|
||||
if (server && !s->s_root)
|
||||
bdi_unregister(&server->backing_dev_info);
|
||||
error_splat_bdi:
|
||||
deactivate_locked_super(s);
|
||||
dprintk("<-- nfs4_xdev_get_sb() = %d [splat]\n", error);
|
||||
return error;
|
||||
|
@ -2893,7 +2905,7 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type,
|
|||
} else {
|
||||
error = nfs_bdi_register(server);
|
||||
if (error)
|
||||
goto error_splat_super;
|
||||
goto error_splat_bdi;
|
||||
}
|
||||
|
||||
if (!s->s_root) {
|
||||
|
@ -2929,6 +2941,9 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type,
|
|||
return error;
|
||||
|
||||
error_splat_super:
|
||||
if (server && !s->s_root)
|
||||
bdi_unregister(&server->backing_dev_info);
|
||||
error_splat_bdi:
|
||||
deactivate_locked_super(s);
|
||||
dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error);
|
||||
return error;
|
||||
|
|
Loading…
Reference in New Issue