diff options
| author | Jeff Layton <jlayton@redhat.com> | 2012-03-05 11:42:36 -0500 |
|---|---|---|
| committer | J. Bruce Fields <bfields@redhat.com> | 2012-03-06 18:13:25 -0500 |
| commit | a6d6b7811cad51b763566210fa98cc2786c7b7ee (patch) | |
| tree | 335140bf7d55149136fe4e52d37ef351aebd3388 /fs/nfsd/nfs4state.c | |
| parent | 393d8ed80f0e9b7edad737053a5fb375f0bf4849 (diff) | |
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>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
| -rw-r--r-- | fs/nfsd/nfs4state.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index c9c446d682ae..ffb46d60b4d6 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
| @@ -4677,21 +4677,26 @@ set_max_delegations(void) | |||
| 4677 | 4677 | ||
| 4678 | /* initialization to perform when the nfsd service is started: */ | 4678 | /* initialization to perform when the nfsd service is started: */ |
| 4679 | 4679 | ||
| 4680 | static int | 4680 | int |
| 4681 | __nfs4_state_start(void) | 4681 | nfs4_state_start(void) |
| 4682 | { | 4682 | { |
| 4683 | int ret; | 4683 | int ret; |
| 4684 | 4684 | ||
| 4685 | nfsd4_load_reboot_recovery_data(); | ||
| 4685 | boot_time = get_seconds(); | 4686 | boot_time = get_seconds(); |
| 4686 | locks_start_grace(&nfsd4_manager); | 4687 | locks_start_grace(&nfsd4_manager); |
| 4687 | printk(KERN_INFO "NFSD: starting %ld-second grace period\n", | 4688 | printk(KERN_INFO "NFSD: starting %ld-second grace period\n", |
| 4688 | nfsd4_grace); | 4689 | nfsd4_grace); |
| 4689 | ret = set_callback_cred(); | 4690 | ret = set_callback_cred(); |
| 4690 | if (ret) | 4691 | if (ret) { |
| 4691 | return -ENOMEM; | 4692 | ret = -ENOMEM; |
| 4693 | goto out_recovery; | ||
| 4694 | } | ||
| 4692 | laundry_wq = create_singlethread_workqueue("nfsd4"); | 4695 | laundry_wq = create_singlethread_workqueue("nfsd4"); |
| 4693 | if (laundry_wq == NULL) | 4696 | if (laundry_wq == NULL) { |
| 4694 | return -ENOMEM; | 4697 | ret = -ENOMEM; |
| 4698 | goto out_recovery; | ||
| 4699 | } | ||
| 4695 | ret = nfsd4_create_callback_queue(); | 4700 | ret = nfsd4_create_callback_queue(); |
| 4696 | if (ret) | 4701 | if (ret) |
| 4697 | goto out_free_laundry; | 4702 | goto out_free_laundry; |
| @@ -4700,16 +4705,11 @@ __nfs4_state_start(void) | |||
| 4700 | return 0; | 4705 | return 0; |
| 4701 | out_free_laundry: | 4706 | out_free_laundry: |
| 4702 | destroy_workqueue(laundry_wq); | 4707 | destroy_workqueue(laundry_wq); |
| 4708 | out_recovery: | ||
| 4709 | nfsd4_shutdown_recdir(); | ||
| 4703 | return ret; | 4710 | return ret; |
| 4704 | } | 4711 | } |
| 4705 | 4712 | ||
| 4706 | int | ||
| 4707 | nfs4_state_start(void) | ||
| 4708 | { | ||
| 4709 | nfsd4_load_reboot_recovery_data(); | ||
| 4710 | return __nfs4_state_start(); | ||
| 4711 | } | ||
| 4712 | |||
| 4713 | static void | 4713 | static void |
| 4714 | __nfs4_state_shutdown(void) | 4714 | __nfs4_state_shutdown(void) |
| 4715 | { | 4715 | { |
