diff mbox series

[07/34] lnet: lnet_peer_tables_cleanup: use an exclusive lock.

Message ID 153783763511.32103.5073326313518943569.stgit@noble (mailing list archive)
State New, archived
Headers show
Series lustre: remainder of multi-rail series. | expand

Commit Message

NeilBrown Sept. 25, 2018, 1:07 a.m. UTC
Why?? surely this will deadlock.

This is part of
    Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")
from upstream lustre, where it is marked:
    Signed-off-by: Amir Shehata <amir.shehata@intel.com>
    WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
    Reviewed-on: http://review.whamcloud.com/18293
    Reviewed-by: Olaf Weber <olaf@sgi.com>
    Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>

Signed-off-by: NeilBrown <neilb@suse.com>
---
 drivers/staging/lustre/lnet/lnet/peer.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

James Simmons Sept. 29, 2018, 10:53 p.m. UTC | #1
> Why?? surely this will deadlock.
> 
> This is part of
>     Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")
> from upstream lustre, where it is marked:
>     Signed-off-by: Amir Shehata <amir.shehata@intel.com>
>     WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
>     Reviewed-on: http://review.whamcloud.com/18293
>     Reviewed-by: Olaf Weber <olaf@sgi.com>
>     Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>

The code is right but the commit message needs a update. 
Olaf, Doug, or Amir can you fill  in the gaps.

Reviewed-by: James Simmons <jsimmons@infradead.org>

P.S
    Its strange that git is not sending message to the people in the 
Reviewed-by:. Maybe git can't handle the indent?
 
> Signed-off-by: NeilBrown <neilb@suse.com>
> ---
>  drivers/staging/lustre/lnet/lnet/peer.c |   12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lnet/lnet/peer.c b/drivers/staging/lustre/lnet/lnet/peer.c
> index 53b0ca0a2021..376e3459fa92 100644
> --- a/drivers/staging/lustre/lnet/lnet/peer.c
> +++ b/drivers/staging/lustre/lnet/lnet/peer.c
> @@ -185,9 +185,9 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni)
>  	 * peers are gateways for.
>  	 */
>  	cfs_percpt_for_each(ptable, i, the_lnet.ln_peer_tables) {
> -		lnet_net_lock(i);
> +		lnet_net_lock(LNET_LOCK_EX);
>  		lnet_peer_table_del_rtrs_locked(ni, ptable, i);
> -		lnet_net_unlock(i);
> +		lnet_net_unlock(LNET_LOCK_EX);
>  	}
>  
>  	/*
> @@ -195,17 +195,17 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni)
>  	 * deathrow.
>  	 */
>  	cfs_percpt_for_each(ptable, i, the_lnet.ln_peer_tables) {
> -		lnet_net_lock(i);
> +		lnet_net_lock(LNET_LOCK_EX);
>  		lnet_peer_table_cleanup_locked(ni, ptable);
> -		lnet_net_unlock(i);
> +		lnet_net_unlock(LNET_LOCK_EX);
>  	}
>  
>  	/* Cleanup all entries on deathrow. */
>  	cfs_percpt_for_each(ptable, i, the_lnet.ln_peer_tables) {
> -		lnet_net_lock(i);
> +		lnet_net_lock(LNET_LOCK_EX);
>  		lnet_peer_table_deathrow_wait_locked(ptable, i);
>  		list_splice_init(&ptable->pt_deathrow, &deathrow);
> -		lnet_net_unlock(i);
> +		lnet_net_unlock(LNET_LOCK_EX);
>  	}
>  
>  	while (!list_empty(&deathrow)) {
> 
> 
>
NeilBrown Oct. 2, 2018, 2:25 a.m. UTC | #2
On Sat, Sep 29 2018, James Simmons wrote:

>> Why?? surely this will deadlock.
>> 
>> This is part of
>>     Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")
>> from upstream lustre, where it is marked:
>>     Signed-off-by: Amir Shehata <amir.shehata@intel.com>
>>     WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
>>     Reviewed-on: http://review.whamcloud.com/18293
>>     Reviewed-by: Olaf Weber <olaf@sgi.com>
>>     Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
>
> The code is right but the commit message needs a update. 
> Olaf, Doug, or Amir can you fill  in the gaps.
>
> Reviewed-by: James Simmons <jsimmons@infradead.org>

thanks

>
> P.S
>     Its strange that git is not sending message to the people in the 
> Reviewed-by:. Maybe git can't handle the indent?

I wasn't asking it to - I was just sending it the list and Oleg,
Andreas, Doug, and you.  Maybe I should ...

Thanks,
NeilBrown

>  
>> Signed-off-by: NeilBrown <neilb@suse.com>
>> ---
>>  drivers/staging/lustre/lnet/lnet/peer.c |   12 ++++++------
>>  1 file changed, 6 insertions(+), 6 deletions(-)
>> 
>> diff --git a/drivers/staging/lustre/lnet/lnet/peer.c b/drivers/staging/lustre/lnet/lnet/peer.c
>> index 53b0ca0a2021..376e3459fa92 100644
>> --- a/drivers/staging/lustre/lnet/lnet/peer.c
>> +++ b/drivers/staging/lustre/lnet/lnet/peer.c
>> @@ -185,9 +185,9 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni)
>>  	 * peers are gateways for.
>>  	 */
>>  	cfs_percpt_for_each(ptable, i, the_lnet.ln_peer_tables) {
>> -		lnet_net_lock(i);
>> +		lnet_net_lock(LNET_LOCK_EX);
>>  		lnet_peer_table_del_rtrs_locked(ni, ptable, i);
>> -		lnet_net_unlock(i);
>> +		lnet_net_unlock(LNET_LOCK_EX);
>>  	}
>>  
>>  	/*
>> @@ -195,17 +195,17 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni)
>>  	 * deathrow.
>>  	 */
>>  	cfs_percpt_for_each(ptable, i, the_lnet.ln_peer_tables) {
>> -		lnet_net_lock(i);
>> +		lnet_net_lock(LNET_LOCK_EX);
>>  		lnet_peer_table_cleanup_locked(ni, ptable);
>> -		lnet_net_unlock(i);
>> +		lnet_net_unlock(LNET_LOCK_EX);
>>  	}
>>  
>>  	/* Cleanup all entries on deathrow. */
>>  	cfs_percpt_for_each(ptable, i, the_lnet.ln_peer_tables) {
>> -		lnet_net_lock(i);
>> +		lnet_net_lock(LNET_LOCK_EX);
>>  		lnet_peer_table_deathrow_wait_locked(ptable, i);
>>  		list_splice_init(&ptable->pt_deathrow, &deathrow);
>> -		lnet_net_unlock(i);
>> +		lnet_net_unlock(LNET_LOCK_EX);
>>  	}
>>  
>>  	while (!list_empty(&deathrow)) {
>> 
>> 
>>
diff mbox series

Patch

diff --git a/drivers/staging/lustre/lnet/lnet/peer.c b/drivers/staging/lustre/lnet/lnet/peer.c
index 53b0ca0a2021..376e3459fa92 100644
--- a/drivers/staging/lustre/lnet/lnet/peer.c
+++ b/drivers/staging/lustre/lnet/lnet/peer.c
@@ -185,9 +185,9 @@  lnet_peer_tables_cleanup(struct lnet_ni *ni)
 	 * peers are gateways for.
 	 */
 	cfs_percpt_for_each(ptable, i, the_lnet.ln_peer_tables) {
-		lnet_net_lock(i);
+		lnet_net_lock(LNET_LOCK_EX);
 		lnet_peer_table_del_rtrs_locked(ni, ptable, i);
-		lnet_net_unlock(i);
+		lnet_net_unlock(LNET_LOCK_EX);
 	}
 
 	/*
@@ -195,17 +195,17 @@  lnet_peer_tables_cleanup(struct lnet_ni *ni)
 	 * deathrow.
 	 */
 	cfs_percpt_for_each(ptable, i, the_lnet.ln_peer_tables) {
-		lnet_net_lock(i);
+		lnet_net_lock(LNET_LOCK_EX);
 		lnet_peer_table_cleanup_locked(ni, ptable);
-		lnet_net_unlock(i);
+		lnet_net_unlock(LNET_LOCK_EX);
 	}
 
 	/* Cleanup all entries on deathrow. */
 	cfs_percpt_for_each(ptable, i, the_lnet.ln_peer_tables) {
-		lnet_net_lock(i);
+		lnet_net_lock(LNET_LOCK_EX);
 		lnet_peer_table_deathrow_wait_locked(ptable, i);
 		list_splice_init(&ptable->pt_deathrow, &deathrow);
-		lnet_net_unlock(i);
+		lnet_net_unlock(LNET_LOCK_EX);
 	}
 
 	while (!list_empty(&deathrow)) {