Skip to content

Commit

Permalink
nfsd4: allow nfs4 state startup to fail
Browse files Browse the repository at this point in the history
The failure here is pretty unlikely, but we should handle it anyway.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
  • Loading branch information
J. Bruce Fields committed Sep 16, 2009
1 parent 5d35175 commit 29ab23c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
17 changes: 12 additions & 5 deletions fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -4004,7 +4004,7 @@ set_max_delegations(void)

/* initialization to perform when the nfsd service is started: */

static void
static int
__nfs4_state_start(void)
{
unsigned long grace_time;
Expand All @@ -4016,19 +4016,26 @@ __nfs4_state_start(void)
printk(KERN_INFO "NFSD: starting %ld-second grace period\n",
grace_time/HZ);
laundry_wq = create_singlethread_workqueue("nfsd4");
if (laundry_wq == NULL)
return -ENOMEM;
queue_delayed_work(laundry_wq, &laundromat_work, grace_time);
set_max_delegations();
return 0;
}

void
int
nfs4_state_start(void)
{
int ret;

if (nfs4_init)
return;
return 0;
nfsd4_load_reboot_recovery_data();
__nfs4_state_start();
ret = __nfs4_state_start();
if (ret)
return ret;
nfs4_init = 1;
return;
return 0;
}

time_t
Expand Down
4 changes: 3 additions & 1 deletion fs/nfsd/nfssvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,9 @@ nfsd_svc(unsigned short port, int nrservs)
error = nfsd_racache_init(2*nrservs);
if (error<0)
goto out;
nfs4_state_start();
error = nfs4_state_start();
if (error)
goto out;

nfsd_reset_versions();

Expand Down
4 changes: 2 additions & 2 deletions include/linux/nfsd/nfsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,15 @@ extern int nfsd_max_blksize;
extern unsigned int max_delegations;
int nfs4_state_init(void);
void nfsd4_free_slabs(void);
void nfs4_state_start(void);
int nfs4_state_start(void);
void nfs4_state_shutdown(void);
time_t nfs4_lease_time(void);
void nfs4_reset_lease(time_t leasetime);
int nfs4_reset_recoverydir(char *recdir);
#else
static inline int nfs4_state_init(void) { return 0; }
static inline void nfsd4_free_slabs(void) { }
static inline void nfs4_state_start(void) { }
static inline int nfs4_state_start(void) { }
static inline void nfs4_state_shutdown(void) { }
static inline time_t nfs4_lease_time(void) { return 0; }
static inline void nfs4_reset_lease(time_t leasetime) { }
Expand Down

0 comments on commit 29ab23c

Please sign in to comment.