aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2008-06-10 08:40:36 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2008-06-23 13:02:49 -0400
commit3dd98a3bccb1bdd30b8a4a755e7bead1b64160ec (patch)
tree53b124bc44b33330102ef73f170fa91e785633bc /fs/nfsd/nfs4state.c
parentbedbdd8bada194a690d2901801bf8451965086b3 (diff)
knfsd: clean up nfsd filesystem interfaces
Several of the nfsd filesystem interfaces allow changes to parameters that don't have any effect on a running nfsd service. They are only ever checked when nfsd is started. This patch fixes it so that changes to those procfiles return -EBUSY if nfsd is already running to make it clear that changes on the fly don't work. The patch should also close some relatively harmless races between changing the info in those interfaces and starting nfsd, since these variables are being moved under the protection of the nfsd_mutex. Finally, the nfsv4recoverydir file always returns -EINVAL if read. This patch fixes it to return the recoverydir path as expected. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 5c97d47676ae..bf11d6879ab4 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3249,12 +3249,14 @@ nfs4_state_shutdown(void)
3249 nfs4_unlock_state(); 3249 nfs4_unlock_state();
3250} 3250}
3251 3251
3252/*
3253 * user_recovery_dirname is protected by the nfsd_mutex since it's only
3254 * accessed when nfsd is starting.
3255 */
3252static void 3256static void
3253nfs4_set_recdir(char *recdir) 3257nfs4_set_recdir(char *recdir)
3254{ 3258{
3255 nfs4_lock_state();
3256 strcpy(user_recovery_dirname, recdir); 3259 strcpy(user_recovery_dirname, recdir);
3257 nfs4_unlock_state();
3258} 3260}
3259 3261
3260/* 3262/*
@@ -3278,6 +3280,12 @@ nfs4_reset_recoverydir(char *recdir)
3278 return status; 3280 return status;
3279} 3281}
3280 3282
3283char *
3284nfs4_recoverydir(void)
3285{
3286 return user_recovery_dirname;
3287}
3288
3281/* 3289/*
3282 * Called when leasetime is changed. 3290 * Called when leasetime is changed.
3283 * 3291 *
@@ -3286,11 +3294,12 @@ nfs4_reset_recoverydir(char *recdir)
3286 * we start to register any changes in lease time. If the administrator 3294 * we start to register any changes in lease time. If the administrator
3287 * really wants to change the lease time *now*, they can go ahead and bring 3295 * really wants to change the lease time *now*, they can go ahead and bring
3288 * nfsd down and then back up again after changing the lease time. 3296 * nfsd down and then back up again after changing the lease time.
3297 *
3298 * user_lease_time is protected by nfsd_mutex since it's only really accessed
3299 * when nfsd is starting
3289 */ 3300 */
3290void 3301void
3291nfs4_reset_lease(time_t leasetime) 3302nfs4_reset_lease(time_t leasetime)
3292{ 3303{
3293 lock_kernel();
3294 user_lease_time = leasetime; 3304 user_lease_time = leasetime;
3295 unlock_kernel();
3296} 3305}