nfsd: containerise NFSv4 recovery state
Subsystems (2)
cover nfsd: containerise NFSv4 recovery state
This patch set makes rec_file and in_grace global static variables allocated per network namespace.
Both of them are a part of client tracking engine, which is containerised already.
The following series implements...
---
Stanislav Kinsbursky (2):
nfsd: recovery - make rec_file per net
nfsd: recovery - make in_grace per net
fs/nfsd/netns.h | 3 ++ fs/nfsd/nfs4recover.c | 79 ++++++++++++++++++++++++------------------------- 2 files changed, 42 insertions(+), 40 deletions(-)
PATCH 1/2 nfsd: recovery - make rec_file per net
Opening and closing of this file is done in client tracking init and exit operations.
Client tracking is done in network namespace context already. So let's make this file opened and closed per network context - this will simlify it's management.
--- fs/nfsd/netns.h | 2 + fs/nfsd/nfs4recover.c | 70 +++++++++++++++++++++++++------------------------ 2 files changed, 37 insertions(+), 35 deletions(-)
fs/nfsd/netns.h +2 -0
@@ -84,6 +84,8 @@ struct nfsd_net {/* client_lock protects the client lru list and session hash table */ spinlock_t client_lock; + +struct file *rec_file; };extern int nfsd_net_id;
fs/nfsd/nfs4recover.c +35 -35
225 lines not on this page · raw message
PATCH 2/2 nfsd: recovery - make in_grace per net
In reply to Stanislav KinsburskyFlag in_grace is a part of client tracking state, which is network namesapce aware. So let'a replace global static variable with per-net one.
--- fs/nfsd/netns.h | 1 + fs/nfsd/nfs4recover.c | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-)
fs/nfsd/netns.h +1 -0
@@ -86,6 +86,7 @@ struct nfsd_net {spinlock_t client_lock;struct file *rec_file; +bool in_grace; };extern int nfsd_net_id;
fs/nfsd/nfs4recover.c +4 -5
@@ -64,7 +64,6 @@ struct nfsd4_client_tracking_ops {/* Globals */ static char user_recovery_dirname[PATH_MAX ] ="/var/lib/nfs/v4recovery" ;static struct nfsd4_client_tracking_ops *client_tracking_ops; -static bool in_grace;static int nfs4_save_creds (const struct cred **original_creds)
@@ -221,7 +220,7 @@ out_put: out_unlock:mutex_unlock (&dir->d_inode->i_mutex);if (status ==0 ) { -if (in_grace) { +if (nn->in_grace) { crp =nfs4_client_to_reclaim (dname, nn);if (crp) crp->cr_clp = clp;
@@ -358,7 +357,7 @@ nfsd4_remove_clid_dir(struct nfs4_client *clp)nfs4_reset_creds (original_cred);if (status ==0 ) {vfs_fsync (nn->rec_file,0 ); -if (in_grace) { +if (nn->in_grace) {/* remove reclaim record */ crp =nfsd4_find_reclaim_client (dname, nn);if (crp)
@@ -394,7 +393,7 @@ nfsd4_recdir_purge_old(struct nfsd_net *nn, time_t boot_time) {int status; - in_grace = false; + nn->in_grace = false;if (!nn->rec_file)return ; status =mnt_want_write_file (nn->rec_file);
@@ -473,7 +472,7 @@ nfsd4_init_recdir(struct net *net)nfs4_reset_creds (original_cred);if (!status) - in_grace = true; + nn->in_grace = true;return status; }
Quoted 4 lines · Stanislav Kinsbursky
This patch set makes
rec_fileandin_graceglobal static variables allocated per network namespace.
Both of them are a part of client tracking engine, which is containerised already.
Thanks, applying for 3.8.--b.
Quoted 14 lines
The following series implements...
---
Stanislav Kinsbursky (2):
nfsd: recovery - makerec_fileper net
nfsd: recovery - makein_graceper netfs/nfsd/netns.h | 3 ++ fs/nfsd/nfs4recover.c | 79 ++++++++++++++++++++++++------------------------- 2 files changed, 42 insertions(+), 40 deletions(-)