diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2010-03-02 11:04:06 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2010-03-06 15:02:08 -0500 |
commit | efc4bb4fdd09c11f5558446e584a494c6feb43c7 (patch) | |
tree | 2eacda55996d59bd5c3a44bf56001f3d94e9cacc /fs | |
parent | f013574014816c7a557b3c52233f3620463f0b9b (diff) |
nfsd4: allow setting grace period time
Allow explicit configuration of the grace period time as well as the
lease period time.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/nfs4state.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfsctl.c | 19 | ||||
-rw-r--r-- | fs/nfsd/nfsd.h | 1 |
3 files changed, 21 insertions, 1 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 4471046e19e0..6edfe23694e6 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | /* Globals */ | 46 | /* Globals */ |
47 | time_t nfsd4_lease = 90; /* default lease time */ | 47 | time_t nfsd4_lease = 90; /* default lease time */ |
48 | static time_t nfsd4_grace = 90; | 48 | time_t nfsd4_grace = 90; |
49 | static time_t boot_time; | 49 | static time_t boot_time; |
50 | static u32 current_ownerid = 1; | 50 | static u32 current_ownerid = 1; |
51 | static u32 current_fileid = 1; | 51 | static u32 current_fileid = 1; |
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 9c73caccffff..7ab70ff212d8 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -45,6 +45,7 @@ enum { | |||
45 | */ | 45 | */ |
46 | #ifdef CONFIG_NFSD_V4 | 46 | #ifdef CONFIG_NFSD_V4 |
47 | NFSD_Leasetime, | 47 | NFSD_Leasetime, |
48 | NFSD_Gracetime, | ||
48 | NFSD_RecoveryDir, | 49 | NFSD_RecoveryDir, |
49 | #endif | 50 | #endif |
50 | }; | 51 | }; |
@@ -69,6 +70,7 @@ static ssize_t write_ports(struct file *file, char *buf, size_t size); | |||
69 | static ssize_t write_maxblksize(struct file *file, char *buf, size_t size); | 70 | static ssize_t write_maxblksize(struct file *file, char *buf, size_t size); |
70 | #ifdef CONFIG_NFSD_V4 | 71 | #ifdef CONFIG_NFSD_V4 |
71 | static ssize_t write_leasetime(struct file *file, char *buf, size_t size); | 72 | static ssize_t write_leasetime(struct file *file, char *buf, size_t size); |
73 | static ssize_t write_gracetime(struct file *file, char *buf, size_t size); | ||
72 | static ssize_t write_recoverydir(struct file *file, char *buf, size_t size); | 74 | static ssize_t write_recoverydir(struct file *file, char *buf, size_t size); |
73 | #endif | 75 | #endif |
74 | 76 | ||
@@ -90,6 +92,7 @@ static ssize_t (*write_op[])(struct file *, char *, size_t) = { | |||
90 | [NFSD_MaxBlkSize] = write_maxblksize, | 92 | [NFSD_MaxBlkSize] = write_maxblksize, |
91 | #ifdef CONFIG_NFSD_V4 | 93 | #ifdef CONFIG_NFSD_V4 |
92 | [NFSD_Leasetime] = write_leasetime, | 94 | [NFSD_Leasetime] = write_leasetime, |
95 | [NFSD_Gracetime] = write_gracetime, | ||
93 | [NFSD_RecoveryDir] = write_recoverydir, | 96 | [NFSD_RecoveryDir] = write_recoverydir, |
94 | #endif | 97 | #endif |
95 | }; | 98 | }; |
@@ -1261,6 +1264,21 @@ static ssize_t write_leasetime(struct file *file, char *buf, size_t size) | |||
1261 | return nfsd4_write_time(file, buf, size, &nfsd4_lease); | 1264 | return nfsd4_write_time(file, buf, size, &nfsd4_lease); |
1262 | } | 1265 | } |
1263 | 1266 | ||
1267 | /** | ||
1268 | * write_gracetime - Set or report current NFSv4 grace period time | ||
1269 | * | ||
1270 | * As above, but sets the time of the NFSv4 grace period. | ||
1271 | * | ||
1272 | * Note this should never be set to less than the *previous* | ||
1273 | * lease-period time, but we don't try to enforce this. (In the common | ||
1274 | * case (a new boot), we don't know what the previous lease time was | ||
1275 | * anyway.) | ||
1276 | */ | ||
1277 | static ssize_t write_gracetime(struct file *file, char *buf, size_t size) | ||
1278 | { | ||
1279 | return nfsd4_write_time(file, buf, size, &nfsd4_grace); | ||
1280 | } | ||
1281 | |||
1264 | extern char *nfs4_recoverydir(void); | 1282 | extern char *nfs4_recoverydir(void); |
1265 | 1283 | ||
1266 | static ssize_t __write_recoverydir(struct file *file, char *buf, size_t size) | 1284 | static ssize_t __write_recoverydir(struct file *file, char *buf, size_t size) |
@@ -1352,6 +1370,7 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent) | |||
1352 | [NFSD_MaxBlkSize] = {"max_block_size", &transaction_ops, S_IWUSR|S_IRUGO}, | 1370 | [NFSD_MaxBlkSize] = {"max_block_size", &transaction_ops, S_IWUSR|S_IRUGO}, |
1353 | #ifdef CONFIG_NFSD_V4 | 1371 | #ifdef CONFIG_NFSD_V4 |
1354 | [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR}, | 1372 | [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR}, |
1373 | [NFSD_Gracetime] = {"nfsv4gracetime", &transaction_ops, S_IWUSR|S_IRUSR}, | ||
1355 | [NFSD_RecoveryDir] = {"nfsv4recoverydir", &transaction_ops, S_IWUSR|S_IRUSR}, | 1374 | [NFSD_RecoveryDir] = {"nfsv4recoverydir", &transaction_ops, S_IWUSR|S_IRUSR}, |
1356 | #endif | 1375 | #endif |
1357 | /* last one */ {""} | 1376 | /* last one */ {""} |
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h index b463093af255..72377761270e 100644 --- a/fs/nfsd/nfsd.h +++ b/fs/nfsd/nfsd.h | |||
@@ -228,6 +228,7 @@ extern struct timeval nfssvc_boot; | |||
228 | #ifdef CONFIG_NFSD_V4 | 228 | #ifdef CONFIG_NFSD_V4 |
229 | 229 | ||
230 | extern time_t nfsd4_lease; | 230 | extern time_t nfsd4_lease; |
231 | extern time_t nfsd4_grace; | ||
231 | 232 | ||
232 | /* before processing a COMPOUND operation, we have to check that there | 233 | /* before processing a COMPOUND operation, we have to check that there |
233 | * is enough space in the buffer for XDR encode to succeed. otherwise, | 234 | * is enough space in the buffer for XDR encode to succeed. otherwise, |