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

nfsd: make close_lru list per net

This list holds nfs4 clients (open) stateowner queue for last close replay,
which are network namespace aware. So let's make this list per network
namespace too.
Signed-off-by: default avatarStanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 5ed58bb2
...@@ -71,8 +71,14 @@ struct nfsd_net { ...@@ -71,8 +71,14 @@ struct nfsd_net {
/* /*
* client_lru holds client queue ordered by nfs4_client.cl_time * client_lru holds client queue ordered by nfs4_client.cl_time
* for lease renewal. * for lease renewal.
*
* close_lru holds (open) stateowner queue ordered by nfs4_stateowner.so_time
* for last close replay.
*
* All of the above fields are protected by the client_mutex.
*/ */
struct list_head client_lru; struct list_head client_lru;
struct list_head close_lru;
}; };
extern int nfsd_net_id; extern int nfsd_net_id;
......
...@@ -401,14 +401,6 @@ static unsigned int clientstr_hashval(const char *name) ...@@ -401,14 +401,6 @@ static unsigned int clientstr_hashval(const char *name)
return opaque_hashval(name, 8) & CLIENT_HASH_MASK; return opaque_hashval(name, 8) & CLIENT_HASH_MASK;
} }
/*
* close_lru holds (open) stateowner queue ordered by nfs4_stateowner.so_time
* for last close replay.
*
* All of the above fields are protected by the client_mutex.
*/
static struct list_head close_lru;
/* /*
* We store the NONE, READ, WRITE, and BOTH bits separately in the * We store the NONE, READ, WRITE, and BOTH bits separately in the
* st_{access,deny}_bmap field of the stateid, in order to track not * st_{access,deny}_bmap field of the stateid, in order to track not
...@@ -2465,11 +2457,13 @@ static void init_open_stateid(struct nfs4_ol_stateid *stp, struct nfs4_file *fp, ...@@ -2465,11 +2457,13 @@ static void init_open_stateid(struct nfs4_ol_stateid *stp, struct nfs4_file *fp,
} }
static void static void
move_to_close_lru(struct nfs4_openowner *oo) move_to_close_lru(struct nfs4_openowner *oo, struct net *net)
{ {
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
dprintk("NFSD: move_to_close_lru nfs4_openowner %p\n", oo); dprintk("NFSD: move_to_close_lru nfs4_openowner %p\n", oo);
list_move_tail(&oo->oo_close_lru, &close_lru); list_move_tail(&oo->oo_close_lru, &nn->close_lru);
oo->oo_time = get_seconds(); oo->oo_time = get_seconds();
} }
...@@ -3242,7 +3236,7 @@ nfs4_laundromat(void) ...@@ -3242,7 +3236,7 @@ nfs4_laundromat(void)
unhash_delegation(dp); unhash_delegation(dp);
} }
test_val = nfsd4_lease; test_val = nfsd4_lease;
list_for_each_safe(pos, next, &close_lru) { list_for_each_safe(pos, next, &nn->close_lru) {
oo = container_of(pos, struct nfs4_openowner, oo_close_lru); oo = container_of(pos, struct nfs4_openowner, oo_close_lru);
if (time_after((unsigned long)oo->oo_time, (unsigned long)cutoff)) { if (time_after((unsigned long)oo->oo_time, (unsigned long)cutoff)) {
u = oo->oo_time - cutoff; u = oo->oo_time - cutoff;
...@@ -3820,7 +3814,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, ...@@ -3820,7 +3814,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
* little while to handle CLOSE replay. * little while to handle CLOSE replay.
*/ */
if (list_empty(&oo->oo_owner.so_stateids)) if (list_empty(&oo->oo_owner.so_stateids))
move_to_close_lru(oo); move_to_close_lru(oo, SVC_NET(rqstp));
} }
} }
out: out:
...@@ -4721,7 +4715,6 @@ nfs4_state_init(void) ...@@ -4721,7 +4715,6 @@ nfs4_state_init(void)
for (i = 0; i < FILE_HASH_SIZE; i++) { for (i = 0; i < FILE_HASH_SIZE; i++) {
INIT_LIST_HEAD(&file_hashtbl[i]); INIT_LIST_HEAD(&file_hashtbl[i]);
} }
INIT_LIST_HEAD(&close_lru);
INIT_LIST_HEAD(&del_recall_lru); INIT_LIST_HEAD(&del_recall_lru);
} }
...@@ -4785,6 +4778,7 @@ static int nfs4_state_start_net(struct net *net) ...@@ -4785,6 +4778,7 @@ static int nfs4_state_start_net(struct net *net)
nn->conf_name_tree = RB_ROOT; nn->conf_name_tree = RB_ROOT;
nn->unconf_name_tree = RB_ROOT; nn->unconf_name_tree = RB_ROOT;
INIT_LIST_HEAD(&nn->client_lru); INIT_LIST_HEAD(&nn->client_lru);
INIT_LIST_HEAD(&nn->close_lru);
return 0; return 0;
......
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