aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanislav Kinsbursky <skinsbursky@parallels.com>2012-11-27 06:11:49 -0500
committerJ. Bruce Fields <bfields@redhat.com>2012-11-28 10:39:47 -0500
commit5284b44e438580a50e8cc5189297a73a48a45ecb (patch)
tree6005ff239965eb1d2ba59d2f2a8028e4c2eee301
parent3d7337115d06f21970e23684f4d2e62e3a44c572 (diff)
nfsd: make NFSv4 grace time per net
Grace time is a part of NFSv4 state engine, which is constructed per network namespace. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--fs/nfsd/netns.h1
-rw-r--r--fs/nfsd/nfs4state.c9
-rw-r--r--fs/nfsd/nfsctl.c4
-rw-r--r--fs/nfsd/nfsd.h2
4 files changed, 7 insertions, 9 deletions
diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h
index 0c20be82cb01..2c4b2e2896dd 100644
--- a/fs/nfsd/netns.h
+++ b/fs/nfsd/netns.h
@@ -89,6 +89,7 @@ struct nfsd_net {
89 bool in_grace; 89 bool in_grace;
90 90
91 time_t nfsd4_lease; 91 time_t nfsd4_lease;
92 time_t nfsd4_grace;
92}; 93};
93 94
94extern int nfsd_net_id; 95extern int nfsd_net_id;
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 932b2ca6f203..3db7617e6d39 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -50,9 +50,6 @@
50 50
51#define NFSDDBG_FACILITY NFSDDBG_PROC 51#define NFSDDBG_FACILITY NFSDDBG_PROC
52 52
53/* Globals */
54time_t nfsd4_grace = 90;
55
56#define all_ones {{~0,~0},~0} 53#define all_ones {{~0,~0},~0}
57static const stateid_t one_stateid = { 54static const stateid_t one_stateid = {
58 .si_generation = ~0, 55 .si_generation = ~0,
@@ -3183,7 +3180,7 @@ nfsd4_end_grace(struct nfsd_net *nn)
3183 * to see the (possibly new, possibly shorter) lease time, we 3180 * to see the (possibly new, possibly shorter) lease time, we
3184 * can safely set the next grace time to the current lease time: 3181 * can safely set the next grace time to the current lease time:
3185 */ 3182 */
3186 nfsd4_grace = nn->nfsd4_lease; 3183 nn->nfsd4_grace = nn->nfsd4_lease;
3187} 3184}
3188 3185
3189static time_t 3186static time_t
@@ -4884,8 +4881,8 @@ nfs4_state_start_net(struct net *net)
4884 locks_start_grace(net, &nn->nfsd4_manager); 4881 locks_start_grace(net, &nn->nfsd4_manager);
4885 nn->grace_ended = false; 4882 nn->grace_ended = false;
4886 printk(KERN_INFO "NFSD: starting %ld-second grace period (net %p)\n", 4883 printk(KERN_INFO "NFSD: starting %ld-second grace period (net %p)\n",
4887 nfsd4_grace, net); 4884 nn->nfsd4_grace, net);
4888 queue_delayed_work(laundry_wq, &nn->laundromat_work, nfsd4_grace * HZ); 4885 queue_delayed_work(laundry_wq, &nn->laundromat_work, nn->nfsd4_grace * HZ);
4889 return 0; 4886 return 0;
4890} 4887}
4891 4888
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 09d909a42ece..d902f83681e7 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -925,7 +925,8 @@ static ssize_t write_leasetime(struct file *file, char *buf, size_t size)
925 */ 925 */
926static ssize_t write_gracetime(struct file *file, char *buf, size_t size) 926static ssize_t write_gracetime(struct file *file, char *buf, size_t size)
927{ 927{
928 return nfsd4_write_time(file, buf, size, &nfsd4_grace); 928 struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id);
929 return nfsd4_write_time(file, buf, size, &nn->nfsd4_grace);
929} 930}
930 931
931static ssize_t __write_recoverydir(struct file *file, char *buf, size_t size) 932static ssize_t __write_recoverydir(struct file *file, char *buf, size_t size)
@@ -1070,6 +1071,7 @@ static __net_init int nfsd_init_net(struct net *net)
1070 if (retval) 1071 if (retval)
1071 goto out_idmap_error; 1072 goto out_idmap_error;
1072 nn->nfsd4_lease = 90; /* default lease time */ 1073 nn->nfsd4_lease = 90; /* default lease time */
1074 nn->nfsd4_grace = 90;
1073 return 0; 1075 return 0;
1074 1076
1075out_idmap_error: 1077out_idmap_error:
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index a8f7325a9124..5eea0f5021fd 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -276,8 +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_grace;
280
281/* before processing a COMPOUND operation, we have to check that there 279/* before processing a COMPOUND operation, we have to check that there
282 * is enough space in the buffer for XDR encode to succeed. otherwise, 280 * is enough space in the buffer for XDR encode to succeed. otherwise,
283 * we might process an operation with side effects, and be unable to 281 * we might process an operation with side effects, and be unable to