Commit f141f79d authored by Stanislav Kinsbursky's avatar Stanislav Kinsbursky Committed by J. Bruce Fields

nfsd: recovery - make in_grace per net

Flag 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.
Signed-off-by: default avatarStanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 3a073369
...@@ -86,6 +86,7 @@ struct nfsd_net { ...@@ -86,6 +86,7 @@ struct nfsd_net {
spinlock_t client_lock; spinlock_t client_lock;
struct file *rec_file; struct file *rec_file;
bool in_grace;
}; };
extern int nfsd_net_id; extern int nfsd_net_id;
......
...@@ -64,7 +64,6 @@ struct nfsd4_client_tracking_ops { ...@@ -64,7 +64,6 @@ struct nfsd4_client_tracking_ops {
/* Globals */ /* Globals */
static char user_recovery_dirname[PATH_MAX] = "/var/lib/nfs/v4recovery"; static char user_recovery_dirname[PATH_MAX] = "/var/lib/nfs/v4recovery";
static struct nfsd4_client_tracking_ops *client_tracking_ops; static struct nfsd4_client_tracking_ops *client_tracking_ops;
static bool in_grace;
static int static int
nfs4_save_creds(const struct cred **original_creds) nfs4_save_creds(const struct cred **original_creds)
...@@ -221,7 +220,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp) ...@@ -221,7 +220,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
out_unlock: out_unlock:
mutex_unlock(&dir->d_inode->i_mutex); mutex_unlock(&dir->d_inode->i_mutex);
if (status == 0) { if (status == 0) {
if (in_grace) { if (nn->in_grace) {
crp = nfs4_client_to_reclaim(dname, nn); crp = nfs4_client_to_reclaim(dname, nn);
if (crp) if (crp)
crp->cr_clp = clp; crp->cr_clp = clp;
...@@ -358,7 +357,7 @@ nfsd4_remove_clid_dir(struct nfs4_client *clp) ...@@ -358,7 +357,7 @@ nfsd4_remove_clid_dir(struct nfs4_client *clp)
nfs4_reset_creds(original_cred); nfs4_reset_creds(original_cred);
if (status == 0) { if (status == 0) {
vfs_fsync(nn->rec_file, 0); vfs_fsync(nn->rec_file, 0);
if (in_grace) { if (nn->in_grace) {
/* remove reclaim record */ /* remove reclaim record */
crp = nfsd4_find_reclaim_client(dname, nn); crp = nfsd4_find_reclaim_client(dname, nn);
if (crp) if (crp)
...@@ -394,7 +393,7 @@ nfsd4_recdir_purge_old(struct nfsd_net *nn, time_t boot_time) ...@@ -394,7 +393,7 @@ nfsd4_recdir_purge_old(struct nfsd_net *nn, time_t boot_time)
{ {
int status; int status;
in_grace = false; nn->in_grace = false;
if (!nn->rec_file) if (!nn->rec_file)
return; return;
status = mnt_want_write_file(nn->rec_file); status = mnt_want_write_file(nn->rec_file);
...@@ -473,7 +472,7 @@ nfsd4_init_recdir(struct net *net) ...@@ -473,7 +472,7 @@ nfsd4_init_recdir(struct net *net)
nfs4_reset_creds(original_cred); nfs4_reset_creds(original_cred);
if (!status) if (!status)
in_grace = true; nn->in_grace = true;
return status; return status;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment