aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
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 *