aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@cse.unsw.edu.au>2005-06-24 01:04:32 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 03:06:36 -0400
commit0964a3d3f1aa96468091924f6b0c391a46dc6d0b (patch)
tree0a6b0587d1922d64ca7e4aa7f306ad869bccf452 /fs/nfsd/nfs4state.c
parentc7b9a45927e74c81d6562153f7fde9d32da00159 (diff)
[PATCH] knfsd: nfsd4 reboot dirname fix
Set the recovery directory via /proc/fs/nfsd/nfs4recoverydir. It may be changed any time, but is used only on startup. Signed-off-by: Andy Adamson <andros@citi.umich.edu> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 6cca358cd650..89e36526d7f2 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -48,6 +48,7 @@
48#include <linux/nfs4.h> 48#include <linux/nfs4.h>
49#include <linux/nfsd/state.h> 49#include <linux/nfsd/state.h>
50#include <linux/nfsd/xdr4.h> 50#include <linux/nfsd/xdr4.h>
51#include <linux/namei.h>
51 52
52#define NFSDDBG_FACILITY NFSDDBG_PROC 53#define NFSDDBG_FACILITY NFSDDBG_PROC
53 54
@@ -71,7 +72,8 @@ static stateid_t onestateid; /* bits all 1 */
71static struct nfs4_stateid * find_stateid(stateid_t *stid, int flags); 72static struct nfs4_stateid * find_stateid(stateid_t *stid, int flags);
72static struct nfs4_delegation * find_delegation_stateid(struct inode *ino, stateid_t *stid); 73static struct nfs4_delegation * find_delegation_stateid(struct inode *ino, stateid_t *stid);
73static void release_stateid_lockowners(struct nfs4_stateid *open_stp); 74static void release_stateid_lockowners(struct nfs4_stateid *open_stp);
74extern char recovery_dirname[]; 75static char user_recovery_dirname[PATH_MAX] = "/var/lib/nfs/v4recovery";
76static void nfs4_set_recdir(char *recdir);
75 77
76/* Locking: 78/* Locking:
77 * 79 *
@@ -3224,8 +3226,10 @@ nfsd4_load_reboot_recovery_data(void)
3224{ 3226{
3225 int status; 3227 int status;
3226 3228
3227 nfsd4_init_recdir(recovery_dirname); 3229 nfs4_lock_state();
3230 nfsd4_init_recdir(user_recovery_dirname);
3228 status = nfsd4_recdir_load(); 3231 status = nfsd4_recdir_load();
3232 nfs4_unlock_state();
3229 if (status) 3233 if (status)
3230 printk("NFSD: Failure reading reboot recovery data\n"); 3234 printk("NFSD: Failure reading reboot recovery data\n");
3231} 3235}
@@ -3329,6 +3333,35 @@ nfs4_state_shutdown(void)
3329 nfs4_unlock_state(); 3333 nfs4_unlock_state();
3330} 3334}
3331 3335
3336static void
3337nfs4_set_recdir(char *recdir)
3338{
3339 nfs4_lock_state();
3340 strcpy(user_recovery_dirname, recdir);
3341 nfs4_unlock_state();
3342}
3343
3344/*
3345 * Change the NFSv4 recovery directory to recdir.
3346 */
3347int
3348nfs4_reset_recoverydir(char *recdir)
3349{
3350 int status;
3351 struct nameidata nd;
3352
3353 status = path_lookup(recdir, LOOKUP_FOLLOW, &nd);
3354 if (status)
3355 return status;
3356 status = -ENOTDIR;
3357 if (S_ISDIR(nd.dentry->d_inode->i_mode)) {
3358 nfs4_set_recdir(recdir);
3359 status = 0;
3360 }
3361 path_release(&nd);
3362 return status;
3363}
3364
3332/* 3365/*
3333 * Called when leasetime is changed. 3366 * Called when leasetime is changed.
3334 * 3367 *