aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/netns.h2
-rw-r--r--fs/nfsd/nfs4callback.c8
-rw-r--r--fs/nfsd/nfs4state.c11
-rw-r--r--fs/nfsd/nfs4xdr.c4
-rw-r--r--fs/nfsd/nfsctl.c5
-rw-r--r--fs/nfsd/nfsd.h1
6 files changed, 19 insertions, 12 deletions
diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h
index 9047706b3e10..0c20be82cb01 100644
--- a/fs/nfsd/netns.h
+++ b/fs/nfsd/netns.h
@@ -87,6 +87,8 @@ struct nfsd_net {
87 87
88 struct file *rec_file; 88 struct file *rec_file;
89 bool in_grace; 89 bool in_grace;
90
91 time_t nfsd4_lease;
90}; 92};
91 93
92extern int nfsd_net_id; 94extern int nfsd_net_id;
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 826cc269c445..99bc85ff0217 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -36,6 +36,7 @@
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include "nfsd.h" 37#include "nfsd.h"
38#include "state.h" 38#include "state.h"
39#include "netns.h"
39 40
40#define NFSDDBG_FACILITY NFSDDBG_PROC 41#define NFSDDBG_FACILITY NFSDDBG_PROC
41 42
@@ -625,9 +626,10 @@ static const struct rpc_program cb_program = {
625 .pipe_dir_name = "nfsd4_cb", 626 .pipe_dir_name = "nfsd4_cb",
626}; 627};
627 628
628static int max_cb_time(void) 629static int max_cb_time(struct net *net)
629{ 630{
630 return max(nfsd4_lease/10, (time_t)1) * HZ; 631 struct nfsd_net *nn = net_generic(net, nfsd_net_id);
632 return max(nn->nfsd4_lease/10, (time_t)1) * HZ;
631} 633}
632 634
633static struct rpc_cred *callback_cred; 635static struct rpc_cred *callback_cred;
@@ -659,7 +661,7 @@ static struct rpc_cred *get_backchannel_cred(struct nfs4_client *clp, struct rpc
659static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *conn, struct nfsd4_session *ses) 661static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *conn, struct nfsd4_session *ses)
660{ 662{
661 struct rpc_timeout timeparms = { 663 struct rpc_timeout timeparms = {
662 .to_initval = max_cb_time(), 664 .to_initval = max_cb_time(clp->net),
663 .to_retries = 0, 665 .to_retries = 0,
664 }; 666 };
665 struct rpc_create_args args = { 667 struct rpc_create_args args = {
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index fb98f291aac2..932b2ca6f203 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -51,7 +51,6 @@
51#define NFSDDBG_FACILITY NFSDDBG_PROC 51#define NFSDDBG_FACILITY NFSDDBG_PROC
52 52
53/* Globals */ 53/* Globals */
54time_t nfsd4_lease = 90; /* default lease time */
55time_t nfsd4_grace = 90; 54time_t nfsd4_grace = 90;
56 55
57#define all_ones {{~0,~0},~0} 56#define all_ones {{~0,~0},~0}
@@ -3184,7 +3183,7 @@ nfsd4_end_grace(struct nfsd_net *nn)
3184 * to see the (possibly new, possibly shorter) lease time, we 3183 * to see the (possibly new, possibly shorter) lease time, we
3185 * can safely set the next grace time to the current lease time: 3184 * can safely set the next grace time to the current lease time:
3186 */ 3185 */
3187 nfsd4_grace = nfsd4_lease; 3186 nfsd4_grace = nn->nfsd4_lease;
3188} 3187}
3189 3188
3190static time_t 3189static time_t
@@ -3194,9 +3193,9 @@ nfs4_laundromat(struct nfsd_net *nn)
3194 struct nfs4_openowner *oo; 3193 struct nfs4_openowner *oo;
3195 struct nfs4_delegation *dp; 3194 struct nfs4_delegation *dp;
3196 struct list_head *pos, *next, reaplist; 3195 struct list_head *pos, *next, reaplist;
3197 time_t cutoff = get_seconds() - nfsd4_lease; 3196 time_t cutoff = get_seconds() - nn->nfsd4_lease;
3198 time_t t, clientid_val = nfsd4_lease; 3197 time_t t, clientid_val = nn->nfsd4_lease;
3199 time_t u, test_val = nfsd4_lease; 3198 time_t u, test_val = nn->nfsd4_lease;
3200 3199
3201 nfs4_lock_state(); 3200 nfs4_lock_state();
3202 3201
@@ -3245,7 +3244,7 @@ nfs4_laundromat(struct nfsd_net *nn)
3245 dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru); 3244 dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
3246 unhash_delegation(dp); 3245 unhash_delegation(dp);
3247 } 3246 }
3248 test_val = nfsd4_lease; 3247 test_val = nn->nfsd4_lease;
3249 list_for_each_safe(pos, next, &nn->close_lru) { 3248 list_for_each_safe(pos, next, &nn->close_lru) {
3250 oo = container_of(pos, struct nfs4_openowner, oo_close_lru); 3249 oo = container_of(pos, struct nfs4_openowner, oo_close_lru);
3251 if (time_after((unsigned long)oo->oo_time, (unsigned long)cutoff)) { 3250 if (time_after((unsigned long)oo->oo_time, (unsigned long)cutoff)) {
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 250171c5c311..b775366a0a68 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -53,6 +53,7 @@
53#include "vfs.h" 53#include "vfs.h"
54#include "state.h" 54#include "state.h"
55#include "cache.h" 55#include "cache.h"
56#include "netns.h"
56 57
57#define NFSDDBG_FACILITY NFSDDBG_XDR 58#define NFSDDBG_FACILITY NFSDDBG_XDR
58 59
@@ -2052,6 +2053,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
2052 .mnt = exp->ex_path.mnt, 2053 .mnt = exp->ex_path.mnt,
2053 .dentry = dentry, 2054 .dentry = dentry,
2054 }; 2055 };
2056 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
2055 2057
2056 BUG_ON(bmval1 & NFSD_WRITEONLY_ATTRS_WORD1); 2058 BUG_ON(bmval1 & NFSD_WRITEONLY_ATTRS_WORD1);
2057 BUG_ON(bmval0 & ~nfsd_suppattrs0(minorversion)); 2059 BUG_ON(bmval0 & ~nfsd_suppattrs0(minorversion));
@@ -2212,7 +2214,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
2212 if (bmval0 & FATTR4_WORD0_LEASE_TIME) { 2214 if (bmval0 & FATTR4_WORD0_LEASE_TIME) {
2213 if ((buflen -= 4) < 0) 2215 if ((buflen -= 4) < 0)
2214 goto out_resource; 2216 goto out_resource;
2215 WRITE32(nfsd4_lease); 2217 WRITE32(nn->nfsd4_lease);
2216 } 2218 }
2217 if (bmval0 & FATTR4_WORD0_RDATTR_ERROR) { 2219 if (bmval0 & FATTR4_WORD0_RDATTR_ERROR) {
2218 if ((buflen -= 4) < 0) 2220 if ((buflen -= 4) < 0)
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index f5ab74af6ce2..09d909a42ece 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -909,7 +909,8 @@ static ssize_t nfsd4_write_time(struct file *file, char *buf, size_t size, time_
909 */ 909 */
910static ssize_t write_leasetime(struct file *file, char *buf, size_t size) 910static ssize_t write_leasetime(struct file *file, char *buf, size_t size)
911{ 911{
912 return nfsd4_write_time(file, buf, size, &nfsd4_lease); 912 struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id);
913 return nfsd4_write_time(file, buf, size, &nn->nfsd4_lease);
913} 914}
914 915
915/** 916/**
@@ -1060,6 +1061,7 @@ int nfsd_net_id;
1060static __net_init int nfsd_init_net(struct net *net) 1061static __net_init int nfsd_init_net(struct net *net)
1061{ 1062{
1062 int retval; 1063 int retval;
1064 struct nfsd_net *nn = net_generic(net, nfsd_net_id);
1063 1065
1064 retval = nfsd_export_init(net); 1066 retval = nfsd_export_init(net);
1065 if (retval) 1067 if (retval)
@@ -1067,6 +1069,7 @@ static __net_init int nfsd_init_net(struct net *net)
1067 retval = nfsd_idmap_init(net); 1069 retval = nfsd_idmap_init(net);
1068 if (retval) 1070 if (retval)
1069 goto out_idmap_error; 1071 goto out_idmap_error;
1072 nn->nfsd4_lease = 90; /* default lease time */
1070 return 0; 1073 return 0;
1071 1074
1072out_idmap_error: 1075out_idmap_error:
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index d7b210b735e1..a8f7325a9124 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -276,7 +276,6 @@ extern struct timeval nfssvc_boot;
276 276
277#ifdef CONFIG_NFSD_V4 277#ifdef CONFIG_NFSD_V4
278 278
279extern time_t nfsd4_lease;
280extern time_t nfsd4_grace; 279extern time_t nfsd4_grace;
281 280
282/* before processing a COMPOUND operation, we have to check that there 281/* before processing a COMPOUND operation, we have to check that there