All of lore.kernel.org
 help / color / mirror / Atom feed
* minor delegation cleanup & fixes
@ 2013-04-05 14:08 J. Bruce Fields
  2013-04-05 14:08 ` [PATCH 1/4] nfsd4: minor cb_recall simplification J. Bruce Fields
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: J. Bruce Fields @ 2013-04-05 14:08 UTC (permalink / raw)
  To: linux-nfs

This is cleanup of a little bit of delegation recall code, with a fix
for a small race.  For 3.10.

--b.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/4] nfsd4: minor cb_recall simplification
  2013-04-05 14:08 minor delegation cleanup & fixes J. Bruce Fields
@ 2013-04-05 14:08 ` J. Bruce Fields
  2013-04-05 14:08 ` [PATCH 2/4] nfsd4: shut down more of delegation earlier J. Bruce Fields
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: J. Bruce Fields @ 2013-04-05 14:08 UTC (permalink / raw)
  To: linux-nfs; +Cc: J. Bruce Fields

From: "J. Bruce Fields" <bfields@redhat.com>

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 fs/nfsd/nfs4callback.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 99bc85f..be3ff0f 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -817,8 +817,7 @@ static bool nfsd41_cb_get_slot(struct nfs4_client *clp, struct rpc_task *task)
 static void nfsd4_cb_prepare(struct rpc_task *task, void *calldata)
 {
 	struct nfsd4_callback *cb = calldata;
-	struct nfs4_delegation *dp = container_of(cb, struct nfs4_delegation, dl_recall);
-	struct nfs4_client *clp = dp->dl_stid.sc_client;
+	struct nfs4_client *clp = cb->cb_clp;
 	u32 minorversion = clp->cl_minorversion;
 
 	cb->cb_minorversion = minorversion;
@@ -839,8 +838,7 @@ static void nfsd4_cb_prepare(struct rpc_task *task, void *calldata)
 static void nfsd4_cb_done(struct rpc_task *task, void *calldata)
 {
 	struct nfsd4_callback *cb = calldata;
-	struct nfs4_delegation *dp = container_of(cb, struct nfs4_delegation, dl_recall);
-	struct nfs4_client *clp = dp->dl_stid.sc_client;
+	struct nfs4_client *clp = cb->cb_clp;
 
 	dprintk("%s: minorversion=%d\n", __func__,
 		clp->cl_minorversion);
@@ -863,7 +861,7 @@ static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata)
 {
 	struct nfsd4_callback *cb = calldata;
 	struct nfs4_delegation *dp = container_of(cb, struct nfs4_delegation, dl_recall);
-	struct nfs4_client *clp = dp->dl_stid.sc_client;
+	struct nfs4_client *clp = cb->cb_clp;
 	struct rpc_clnt *current_rpc_client = clp->cl_cb_client;
 
 	nfsd4_cb_done(task, calldata);
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/4] nfsd4: shut down more of delegation earlier
  2013-04-05 14:08 minor delegation cleanup & fixes J. Bruce Fields
  2013-04-05 14:08 ` [PATCH 1/4] nfsd4: minor cb_recall simplification J. Bruce Fields
@ 2013-04-05 14:08 ` J. Bruce Fields
  2013-04-05 14:08 ` [PATCH 3/4] nfsd4: make del_recall_lru per-network-namespace J. Bruce Fields
  2013-04-05 14:08 ` [PATCH 4/4] nfsd4: remove unused nfs4_check_deleg argument J. Bruce Fields
  3 siblings, 0 replies; 8+ messages in thread
From: J. Bruce Fields @ 2013-04-05 14:08 UTC (permalink / raw)
  To: linux-nfs; +Cc: J. Bruce Fields

From: "J. Bruce Fields" <bfields@redhat.com>

Once we've unhashed the delegation, it's only hanging around for the
benefit of an oustanding recall, which only needs the encoded
filehandle, stateid, and dl_retries counter.  No point keeping the file
around any longer, or keeping it hashed.

This also fixes a race: calls to idr_remove should really be serialized
by the caller, but the nfs4_put_delegation call from the callback code
isn't taking the state lock.

(Better might be to cancel the callback before destroying the
delegation, and remove any need for reference counting--but I don't see
an easy way to cancel an rpc call.)

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 fs/nfsd/nfs4state.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 7293e29..26a03fa 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -417,21 +417,18 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_ol_stateid *stp, struct sv
 	return dp;
 }
 
-static void free_stid(struct nfs4_stid *s, struct kmem_cache *slab)
+static void remove_stid(struct nfs4_stid *s)
 {
 	struct idr *stateids = &s->sc_client->cl_stateids;
 
 	idr_remove(stateids, s->sc_stateid.si_opaque.so_id);
-	kmem_cache_free(slab, s);
 }
 
 void
 nfs4_put_delegation(struct nfs4_delegation *dp)
 {
 	if (atomic_dec_and_test(&dp->dl_count)) {
-		dprintk("NFSD: freeing dp %p\n",dp);
-		put_nfs4_file(dp->dl_file);
-		free_stid(&dp->dl_stid, deleg_slab);
+		kmem_cache_free(deleg_slab, dp);
 		num_delegations--;
 	}
 }
@@ -462,6 +459,9 @@ unhash_delegation(struct nfs4_delegation *dp)
 	list_del_init(&dp->dl_recall_lru);
 	spin_unlock(&recall_lock);
 	nfs4_put_deleg_lease(dp->dl_file);
+	put_nfs4_file(dp->dl_file);
+	dp->dl_file = NULL;
+	remove_stid(&dp->dl_stid);
 	nfs4_put_delegation(dp);
 }
 
@@ -605,7 +605,8 @@ static void close_generic_stateid(struct nfs4_ol_stateid *stp)
 
 static void free_generic_stateid(struct nfs4_ol_stateid *stp)
 {
-	free_stid(&stp->st_stid, stateid_slab);
+	remove_stid(&stp->st_stid);
+	kmem_cache_free(stateid_slab, stp);
 }
 
 static void release_lock_stateid(struct nfs4_ol_stateid *stp)
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/4] nfsd4: make del_recall_lru per-network-namespace
  2013-04-05 14:08 minor delegation cleanup & fixes J. Bruce Fields
  2013-04-05 14:08 ` [PATCH 1/4] nfsd4: minor cb_recall simplification J. Bruce Fields
  2013-04-05 14:08 ` [PATCH 2/4] nfsd4: shut down more of delegation earlier J. Bruce Fields
@ 2013-04-05 14:08 ` J. Bruce Fields
  2013-04-05 14:09   ` J. Bruce Fields
  2013-04-05 14:08 ` [PATCH 4/4] nfsd4: remove unused nfs4_check_deleg argument J. Bruce Fields
  3 siblings, 1 reply; 8+ messages in thread
From: J. Bruce Fields @ 2013-04-05 14:08 UTC (permalink / raw)
  To: linux-nfs; +Cc: J. Bruce Fields

From: "J. Bruce Fields" <bfields@redhat.com>

If nothing else this simplifies the nfs4_state_shutdown_net logic a tad.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 fs/nfsd/netns.h     |  1 +
 fs/nfsd/nfs4state.c | 15 +++++++--------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h
index 1051beb..849a7c3 100644
--- a/fs/nfsd/netns.h
+++ b/fs/nfsd/netns.h
@@ -80,6 +80,7 @@ struct nfsd_net {
 	 */
 	struct list_head client_lru;
 	struct list_head close_lru;
+	struct list_head del_recall_lru;
 
 	struct delayed_work laundromat_work;
 
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 26a03fa..aae9304 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -225,8 +225,6 @@ opaque_hashval(const void *ptr, int nbytes)
 	return x;
 }
 
-static struct list_head del_recall_lru;
-
 static void nfsd4_free_file(struct nfs4_file *f)
 {
 	kmem_cache_free(file_slab, f);
@@ -2583,6 +2581,9 @@ out:
 
 static void nfsd_break_one_deleg(struct nfs4_delegation *dp)
 {
+	struct nfs4_client *clp = dp->dl_stid.sc_client;
+	struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
+
 	/* We're assuming the state code never drops its reference
 	 * without first removing the lease.  Since we're in this lease
 	 * callback (and since the lease code is serialized by the kernel
@@ -2590,7 +2591,7 @@ static void nfsd_break_one_deleg(struct nfs4_delegation *dp)
 	 * it's safe to take a reference: */
 	atomic_inc(&dp->dl_count);
 
-	list_add_tail(&dp->dl_recall_lru, &del_recall_lru);
+	list_add_tail(&dp->dl_recall_lru, &nn->del_recall_lru);
 
 	/* only place dl_time is set. protected by lock_flocks*/
 	dp->dl_time = get_seconds();
@@ -3254,7 +3255,7 @@ nfs4_laundromat(struct nfsd_net *nn)
 		expire_client(clp);
 	}
 	spin_lock(&recall_lock);
-	list_for_each_safe(pos, next, &del_recall_lru) {
+	list_for_each_safe(pos, next, &nn->del_recall_lru) {
 		dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
 		if (net_generic(dp->dl_stid.sc_client->net, nfsd_net_id) != nn)
 			continue;
@@ -4810,7 +4811,6 @@ struct nfs4_client *nfsd_find_client(struct sockaddr_storage *addr, size_t addr_
 void
 nfs4_state_init(void)
 {
-	INIT_LIST_HEAD(&del_recall_lru);
 }
 
 /*
@@ -4874,6 +4874,7 @@ static int nfs4_state_create_net(struct net *net)
 	nn->unconf_name_tree = RB_ROOT;
 	INIT_LIST_HEAD(&nn->client_lru);
 	INIT_LIST_HEAD(&nn->close_lru);
+	INIT_LIST_HEAD(&nn->del_recall_lru);
 	spin_lock_init(&nn->client_lock);
 
 	INIT_DELAYED_WORK(&nn->laundromat_work, laundromat_main);
@@ -4986,10 +4987,8 @@ nfs4_state_shutdown_net(struct net *net)
 
 	INIT_LIST_HEAD(&reaplist);
 	spin_lock(&recall_lock);
-	list_for_each_safe(pos, next, &del_recall_lru) {
+	list_for_each_safe(pos, next, &nn->del_recall_lru) {
 		dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
-		if (dp->dl_stid.sc_client->net != net)
-			continue;
 		list_move(&dp->dl_recall_lru, &reaplist);
 	}
 	spin_unlock(&recall_lock);
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/4] nfsd4: remove unused nfs4_check_deleg argument
  2013-04-05 14:08 minor delegation cleanup & fixes J. Bruce Fields
                   ` (2 preceding siblings ...)
  2013-04-05 14:08 ` [PATCH 3/4] nfsd4: make del_recall_lru per-network-namespace J. Bruce Fields
@ 2013-04-05 14:08 ` J. Bruce Fields
  3 siblings, 0 replies; 8+ messages in thread
From: J. Bruce Fields @ 2013-04-05 14:08 UTC (permalink / raw)
  To: linux-nfs; +Cc: J. Bruce Fields

From: "J. Bruce Fields" <bfields@redhat.com>

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 fs/nfsd/nfs4state.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index aae9304..795b24d 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2737,7 +2737,7 @@ static bool nfsd4_is_deleg_cur(struct nfsd4_open *open)
 }
 
 static __be32
-nfs4_check_deleg(struct nfs4_client *cl, struct nfs4_file *fp, struct nfsd4_open *open,
+nfs4_check_deleg(struct nfs4_client *cl, struct nfsd4_open *open,
 		struct nfs4_delegation **dp)
 {
 	int flags;
@@ -3062,7 +3062,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
 	if (fp) {
 		if ((status = nfs4_check_open(fp, open, &stp)))
 			goto out;
-		status = nfs4_check_deleg(cl, fp, open, &dp);
+		status = nfs4_check_deleg(cl, open, &dp);
 		if (status)
 			goto out;
 	} else {
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] nfsd4: make del_recall_lru per-network-namespace
  2013-04-05 14:08 ` [PATCH 3/4] nfsd4: make del_recall_lru per-network-namespace J. Bruce Fields
@ 2013-04-05 14:09   ` J. Bruce Fields
  2013-04-05 14:42     ` Stanislav Kinsbursky
  0 siblings, 1 reply; 8+ messages in thread
From: J. Bruce Fields @ 2013-04-05 14:09 UTC (permalink / raw)
  To: J. Bruce Fields, Stanislav Kinsbursky; +Cc: linux-nfs

On Fri, Apr 05, 2013 at 10:08:05AM -0400, J. Bruce Fields wrote:
> From: "J. Bruce Fields" <bfields@redhat.com>
> 
> If nothing else this simplifies the nfs4_state_shutdown_net logic a tad.

Stanislav, my one worry is that there was some reason you didn't do
this, that I've overlooked....

--b.

> 
> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> ---
>  fs/nfsd/netns.h     |  1 +
>  fs/nfsd/nfs4state.c | 15 +++++++--------
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h
> index 1051beb..849a7c3 100644
> --- a/fs/nfsd/netns.h
> +++ b/fs/nfsd/netns.h
> @@ -80,6 +80,7 @@ struct nfsd_net {
>  	 */
>  	struct list_head client_lru;
>  	struct list_head close_lru;
> +	struct list_head del_recall_lru;
>  
>  	struct delayed_work laundromat_work;
>  
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 26a03fa..aae9304 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -225,8 +225,6 @@ opaque_hashval(const void *ptr, int nbytes)
>  	return x;
>  }
>  
> -static struct list_head del_recall_lru;
> -
>  static void nfsd4_free_file(struct nfs4_file *f)
>  {
>  	kmem_cache_free(file_slab, f);
> @@ -2583,6 +2581,9 @@ out:
>  
>  static void nfsd_break_one_deleg(struct nfs4_delegation *dp)
>  {
> +	struct nfs4_client *clp = dp->dl_stid.sc_client;
> +	struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
> +
>  	/* We're assuming the state code never drops its reference
>  	 * without first removing the lease.  Since we're in this lease
>  	 * callback (and since the lease code is serialized by the kernel
> @@ -2590,7 +2591,7 @@ static void nfsd_break_one_deleg(struct nfs4_delegation *dp)
>  	 * it's safe to take a reference: */
>  	atomic_inc(&dp->dl_count);
>  
> -	list_add_tail(&dp->dl_recall_lru, &del_recall_lru);
> +	list_add_tail(&dp->dl_recall_lru, &nn->del_recall_lru);
>  
>  	/* only place dl_time is set. protected by lock_flocks*/
>  	dp->dl_time = get_seconds();
> @@ -3254,7 +3255,7 @@ nfs4_laundromat(struct nfsd_net *nn)
>  		expire_client(clp);
>  	}
>  	spin_lock(&recall_lock);
> -	list_for_each_safe(pos, next, &del_recall_lru) {
> +	list_for_each_safe(pos, next, &nn->del_recall_lru) {
>  		dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
>  		if (net_generic(dp->dl_stid.sc_client->net, nfsd_net_id) != nn)
>  			continue;
> @@ -4810,7 +4811,6 @@ struct nfs4_client *nfsd_find_client(struct sockaddr_storage *addr, size_t addr_
>  void
>  nfs4_state_init(void)
>  {
> -	INIT_LIST_HEAD(&del_recall_lru);
>  }
>  
>  /*
> @@ -4874,6 +4874,7 @@ static int nfs4_state_create_net(struct net *net)
>  	nn->unconf_name_tree = RB_ROOT;
>  	INIT_LIST_HEAD(&nn->client_lru);
>  	INIT_LIST_HEAD(&nn->close_lru);
> +	INIT_LIST_HEAD(&nn->del_recall_lru);
>  	spin_lock_init(&nn->client_lock);
>  
>  	INIT_DELAYED_WORK(&nn->laundromat_work, laundromat_main);
> @@ -4986,10 +4987,8 @@ nfs4_state_shutdown_net(struct net *net)
>  
>  	INIT_LIST_HEAD(&reaplist);
>  	spin_lock(&recall_lock);
> -	list_for_each_safe(pos, next, &del_recall_lru) {
> +	list_for_each_safe(pos, next, &nn->del_recall_lru) {
>  		dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
> -		if (dp->dl_stid.sc_client->net != net)
> -			continue;
>  		list_move(&dp->dl_recall_lru, &reaplist);
>  	}
>  	spin_unlock(&recall_lock);
> -- 
> 1.7.11.7
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] nfsd4: make del_recall_lru per-network-namespace
  2013-04-05 14:09   ` J. Bruce Fields
@ 2013-04-05 14:42     ` Stanislav Kinsbursky
  2013-04-05 21:17       ` J. Bruce Fields
  0 siblings, 1 reply; 8+ messages in thread
From: Stanislav Kinsbursky @ 2013-04-05 14:42 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: J. Bruce Fields, linux-nfs

05.04.2013 18:09, J. Bruce Fields пишет:
> On Fri, Apr 05, 2013 at 10:08:05AM -0400, J. Bruce Fields wrote:
>> From: "J. Bruce Fields" <bfields@redhat.com>
>>
>> If nothing else this simplifies the nfs4_state_shutdown_net logic a tad.
>
> Stanislav, my one worry is that there was some reason you didn't do
> this, that I've overlooked....
>

Hmm... Currently I can't remember a reason, why I didn't do that...
This looks reasonable. Thanks!

BTW, maybe recall_lock should be containerised as well?


> --b.
>
>>
>> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
>> ---
>>   fs/nfsd/netns.h     |  1 +
>>   fs/nfsd/nfs4state.c | 15 +++++++--------
>>   2 files changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h
>> index 1051beb..849a7c3 100644
>> --- a/fs/nfsd/netns.h
>> +++ b/fs/nfsd/netns.h
>> @@ -80,6 +80,7 @@ struct nfsd_net {
>>   	 */
>>   	struct list_head client_lru;
>>   	struct list_head close_lru;
>> +	struct list_head del_recall_lru;
>>
>>   	struct delayed_work laundromat_work;
>>
>> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
>> index 26a03fa..aae9304 100644
>> --- a/fs/nfsd/nfs4state.c
>> +++ b/fs/nfsd/nfs4state.c
>> @@ -225,8 +225,6 @@ opaque_hashval(const void *ptr, int nbytes)
>>   	return x;
>>   }
>>
>> -static struct list_head del_recall_lru;
>> -
>>   static void nfsd4_free_file(struct nfs4_file *f)
>>   {
>>   	kmem_cache_free(file_slab, f);
>> @@ -2583,6 +2581,9 @@ out:
>>
>>   static void nfsd_break_one_deleg(struct nfs4_delegation *dp)
>>   {
>> +	struct nfs4_client *clp = dp->dl_stid.sc_client;
>> +	struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
>> +
>>   	/* We're assuming the state code never drops its reference
>>   	 * without first removing the lease.  Since we're in this lease
>>   	 * callback (and since the lease code is serialized by the kernel
>> @@ -2590,7 +2591,7 @@ static void nfsd_break_one_deleg(struct nfs4_delegation *dp)
>>   	 * it's safe to take a reference: */
>>   	atomic_inc(&dp->dl_count);
>>
>> -	list_add_tail(&dp->dl_recall_lru, &del_recall_lru);
>> +	list_add_tail(&dp->dl_recall_lru, &nn->del_recall_lru);
>>
>>   	/* only place dl_time is set. protected by lock_flocks*/
>>   	dp->dl_time = get_seconds();
>> @@ -3254,7 +3255,7 @@ nfs4_laundromat(struct nfsd_net *nn)
>>   		expire_client(clp);
>>   	}
>>   	spin_lock(&recall_lock);
>> -	list_for_each_safe(pos, next, &del_recall_lru) {
>> +	list_for_each_safe(pos, next, &nn->del_recall_lru) {
>>   		dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
>>   		if (net_generic(dp->dl_stid.sc_client->net, nfsd_net_id) != nn)
>>   			continue;
>> @@ -4810,7 +4811,6 @@ struct nfs4_client *nfsd_find_client(struct sockaddr_storage *addr, size_t addr_
>>   void
>>   nfs4_state_init(void)
>>   {
>> -	INIT_LIST_HEAD(&del_recall_lru);
>>   }
>>
>>   /*
>> @@ -4874,6 +4874,7 @@ static int nfs4_state_create_net(struct net *net)
>>   	nn->unconf_name_tree = RB_ROOT;
>>   	INIT_LIST_HEAD(&nn->client_lru);
>>   	INIT_LIST_HEAD(&nn->close_lru);
>> +	INIT_LIST_HEAD(&nn->del_recall_lru);
>>   	spin_lock_init(&nn->client_lock);
>>
>>   	INIT_DELAYED_WORK(&nn->laundromat_work, laundromat_main);
>> @@ -4986,10 +4987,8 @@ nfs4_state_shutdown_net(struct net *net)
>>
>>   	INIT_LIST_HEAD(&reaplist);
>>   	spin_lock(&recall_lock);
>> -	list_for_each_safe(pos, next, &del_recall_lru) {
>> +	list_for_each_safe(pos, next, &nn->del_recall_lru) {
>>   		dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
>> -		if (dp->dl_stid.sc_client->net != net)
>> -			continue;
>>   		list_move(&dp->dl_recall_lru, &reaplist);
>>   	}
>>   	spin_unlock(&recall_lock);
>> --
>> 1.7.11.7
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Best regards,
Stanislav Kinsbursky

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] nfsd4: make del_recall_lru per-network-namespace
  2013-04-05 14:42     ` Stanislav Kinsbursky
@ 2013-04-05 21:17       ` J. Bruce Fields
  0 siblings, 0 replies; 8+ messages in thread
From: J. Bruce Fields @ 2013-04-05 21:17 UTC (permalink / raw)
  To: Stanislav Kinsbursky; +Cc: J. Bruce Fields, linux-nfs

On Fri, Apr 05, 2013 at 06:42:24PM +0400, Stanislav Kinsbursky wrote:
> 05.04.2013 18:09, J. Bruce Fields пишет:
> >On Fri, Apr 05, 2013 at 10:08:05AM -0400, J. Bruce Fields wrote:
> >>From: "J. Bruce Fields" <bfields@redhat.com>
> >>
> >>If nothing else this simplifies the nfs4_state_shutdown_net logic a tad.
> >
> >Stanislav, my one worry is that there was some reason you didn't do
> >this, that I've overlooked....
> >
> 
> Hmm... Currently I can't remember a reason, why I didn't do that...
> This looks reasonable. Thanks!
> 
> BTW, maybe recall_lock should be containerised as well?

Looks like that also covers manipulations of the global file_hashtbl, so
I'm leaving it alone for now.

--b.

> 
> 
> >--b.
> >
> >>
> >>Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> >>---
> >>  fs/nfsd/netns.h     |  1 +
> >>  fs/nfsd/nfs4state.c | 15 +++++++--------
> >>  2 files changed, 8 insertions(+), 8 deletions(-)
> >>
> >>diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h
> >>index 1051beb..849a7c3 100644
> >>--- a/fs/nfsd/netns.h
> >>+++ b/fs/nfsd/netns.h
> >>@@ -80,6 +80,7 @@ struct nfsd_net {
> >>  	 */
> >>  	struct list_head client_lru;
> >>  	struct list_head close_lru;
> >>+	struct list_head del_recall_lru;
> >>
> >>  	struct delayed_work laundromat_work;
> >>
> >>diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> >>index 26a03fa..aae9304 100644
> >>--- a/fs/nfsd/nfs4state.c
> >>+++ b/fs/nfsd/nfs4state.c
> >>@@ -225,8 +225,6 @@ opaque_hashval(const void *ptr, int nbytes)
> >>  	return x;
> >>  }
> >>
> >>-static struct list_head del_recall_lru;
> >>-
> >>  static void nfsd4_free_file(struct nfs4_file *f)
> >>  {
> >>  	kmem_cache_free(file_slab, f);
> >>@@ -2583,6 +2581,9 @@ out:
> >>
> >>  static void nfsd_break_one_deleg(struct nfs4_delegation *dp)
> >>  {
> >>+	struct nfs4_client *clp = dp->dl_stid.sc_client;
> >>+	struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
> >>+
> >>  	/* We're assuming the state code never drops its reference
> >>  	 * without first removing the lease.  Since we're in this lease
> >>  	 * callback (and since the lease code is serialized by the kernel
> >>@@ -2590,7 +2591,7 @@ static void nfsd_break_one_deleg(struct nfs4_delegation *dp)
> >>  	 * it's safe to take a reference: */
> >>  	atomic_inc(&dp->dl_count);
> >>
> >>-	list_add_tail(&dp->dl_recall_lru, &del_recall_lru);
> >>+	list_add_tail(&dp->dl_recall_lru, &nn->del_recall_lru);
> >>
> >>  	/* only place dl_time is set. protected by lock_flocks*/
> >>  	dp->dl_time = get_seconds();
> >>@@ -3254,7 +3255,7 @@ nfs4_laundromat(struct nfsd_net *nn)
> >>  		expire_client(clp);
> >>  	}
> >>  	spin_lock(&recall_lock);
> >>-	list_for_each_safe(pos, next, &del_recall_lru) {
> >>+	list_for_each_safe(pos, next, &nn->del_recall_lru) {
> >>  		dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
> >>  		if (net_generic(dp->dl_stid.sc_client->net, nfsd_net_id) != nn)
> >>  			continue;
> >>@@ -4810,7 +4811,6 @@ struct nfs4_client *nfsd_find_client(struct sockaddr_storage *addr, size_t addr_
> >>  void
> >>  nfs4_state_init(void)
> >>  {
> >>-	INIT_LIST_HEAD(&del_recall_lru);
> >>  }
> >>
> >>  /*
> >>@@ -4874,6 +4874,7 @@ static int nfs4_state_create_net(struct net *net)
> >>  	nn->unconf_name_tree = RB_ROOT;
> >>  	INIT_LIST_HEAD(&nn->client_lru);
> >>  	INIT_LIST_HEAD(&nn->close_lru);
> >>+	INIT_LIST_HEAD(&nn->del_recall_lru);
> >>  	spin_lock_init(&nn->client_lock);
> >>
> >>  	INIT_DELAYED_WORK(&nn->laundromat_work, laundromat_main);
> >>@@ -4986,10 +4987,8 @@ nfs4_state_shutdown_net(struct net *net)
> >>
> >>  	INIT_LIST_HEAD(&reaplist);
> >>  	spin_lock(&recall_lock);
> >>-	list_for_each_safe(pos, next, &del_recall_lru) {
> >>+	list_for_each_safe(pos, next, &nn->del_recall_lru) {
> >>  		dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
> >>-		if (dp->dl_stid.sc_client->net != net)
> >>-			continue;
> >>  		list_move(&dp->dl_recall_lru, &reaplist);
> >>  	}
> >>  	spin_unlock(&recall_lock);
> >>--
> >>1.7.11.7
> >>
> >>--
> >>To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> >>the body of a message to majordomo@vger.kernel.org
> >>More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> -- 
> Best regards,
> Stanislav Kinsbursky

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-04-05 21:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-05 14:08 minor delegation cleanup & fixes J. Bruce Fields
2013-04-05 14:08 ` [PATCH 1/4] nfsd4: minor cb_recall simplification J. Bruce Fields
2013-04-05 14:08 ` [PATCH 2/4] nfsd4: shut down more of delegation earlier J. Bruce Fields
2013-04-05 14:08 ` [PATCH 3/4] nfsd4: make del_recall_lru per-network-namespace J. Bruce Fields
2013-04-05 14:09   ` J. Bruce Fields
2013-04-05 14:42     ` Stanislav Kinsbursky
2013-04-05 21:17       ` J. Bruce Fields
2013-04-05 14:08 ` [PATCH 4/4] nfsd4: remove unused nfs4_check_deleg argument J. Bruce Fields

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.