nfsd4: fix recovery-dir leak on nfsd startup failure
The current code never calls nfsd4_shutdown_recdir if nfs4_state_start returns an error. Also, it's better to go ahead and consolidate these functions since one is just a trivial wrapper around the other. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
393d8ed80f
commit
a6d6b7811c
|
@ -4677,21 +4677,26 @@ set_max_delegations(void)
|
||||||
|
|
||||||
/* initialization to perform when the nfsd service is started: */
|
/* initialization to perform when the nfsd service is started: */
|
||||||
|
|
||||||
static int
|
int
|
||||||
__nfs4_state_start(void)
|
nfs4_state_start(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
nfsd4_load_reboot_recovery_data();
|
||||||
boot_time = get_seconds();
|
boot_time = get_seconds();
|
||||||
locks_start_grace(&nfsd4_manager);
|
locks_start_grace(&nfsd4_manager);
|
||||||
printk(KERN_INFO "NFSD: starting %ld-second grace period\n",
|
printk(KERN_INFO "NFSD: starting %ld-second grace period\n",
|
||||||
nfsd4_grace);
|
nfsd4_grace);
|
||||||
ret = set_callback_cred();
|
ret = set_callback_cred();
|
||||||
if (ret)
|
if (ret) {
|
||||||
return -ENOMEM;
|
ret = -ENOMEM;
|
||||||
|
goto out_recovery;
|
||||||
|
}
|
||||||
laundry_wq = create_singlethread_workqueue("nfsd4");
|
laundry_wq = create_singlethread_workqueue("nfsd4");
|
||||||
if (laundry_wq == NULL)
|
if (laundry_wq == NULL) {
|
||||||
return -ENOMEM;
|
ret = -ENOMEM;
|
||||||
|
goto out_recovery;
|
||||||
|
}
|
||||||
ret = nfsd4_create_callback_queue();
|
ret = nfsd4_create_callback_queue();
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out_free_laundry;
|
goto out_free_laundry;
|
||||||
|
@ -4700,16 +4705,11 @@ __nfs4_state_start(void)
|
||||||
return 0;
|
return 0;
|
||||||
out_free_laundry:
|
out_free_laundry:
|
||||||
destroy_workqueue(laundry_wq);
|
destroy_workqueue(laundry_wq);
|
||||||
|
out_recovery:
|
||||||
|
nfsd4_shutdown_recdir();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
nfs4_state_start(void)
|
|
||||||
{
|
|
||||||
nfsd4_load_reboot_recovery_data();
|
|
||||||
return __nfs4_state_start();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
__nfs4_state_shutdown(void)
|
__nfs4_state_shutdown(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue