diff mbox

[2/2] iscsi target: wake up all session_wait_comp waiters

Message ID 1502577017-1236-2-git-send-email-mchristi@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mike Christie Aug. 12, 2017, 10:30 p.m. UTC
If userspace is disabling a tpg via the tpg enable configfs file
and the initiator or target decides to drop the iscsi session, then
we can end up where only one thread waiting on session_wait_comp will
be woken up. This can then lead to the app doing the disable to hang
if it was the one that did not get notified.

Signed-off-by: Mike Christie <mchristi@redhat.com>
---
 drivers/target/iscsi/iscsi_target.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mike Christie Aug. 13, 2017, 12:55 a.m. UTC | #1
On 08/12/2017 05:30 PM, Mike Christie wrote:
> If userspace is disabling a tpg via the tpg enable configfs file
> and the initiator or target decides to drop the iscsi session, then
> we can end up where only one thread waiting on session_wait_comp will
> be woken up. This can then lead to the app doing the disable to hang
> if it was the one that did not get notified.
> 
> Signed-off-by: Mike Christie <mchristi@redhat.com>
> ---
>  drivers/target/iscsi/iscsi_target.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
> index 5001261..e1e0e25 100644
> --- a/drivers/target/iscsi/iscsi_target.c
> +++ b/drivers/target/iscsi/iscsi_target.c
> @@ -4318,7 +4318,7 @@ int iscsit_close_connection(
>  		spin_unlock_bh(&sess->conn_lock);
>  
>  		if (atomic_read(&sess->sleep_on_sess_wait_comp))
> -			complete(&sess->session_wait_comp);
> +			complete_all(&sess->session_wait_comp);
>  
>  		return 0;
>  	} else {
> @@ -4332,7 +4332,7 @@ int iscsit_close_connection(
>  			spin_unlock_bh(&sess->conn_lock);
>  
>  		if (atomic_read(&sess->sleep_on_sess_wait_comp))
> -			complete(&sess->session_wait_comp);
> +			complete_all(&sess->session_wait_comp);
>  
>  		return 0;
>  	}
> 

Nick, ignore this patch for now. The bug might only be in a distro
kernel and is not needed upstream.
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 5001261..e1e0e25 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -4318,7 +4318,7 @@  int iscsit_close_connection(
 		spin_unlock_bh(&sess->conn_lock);
 
 		if (atomic_read(&sess->sleep_on_sess_wait_comp))
-			complete(&sess->session_wait_comp);
+			complete_all(&sess->session_wait_comp);
 
 		return 0;
 	} else {
@@ -4332,7 +4332,7 @@  int iscsit_close_connection(
 			spin_unlock_bh(&sess->conn_lock);
 
 		if (atomic_read(&sess->sleep_on_sess_wait_comp))
-			complete(&sess->session_wait_comp);
+			complete_all(&sess->session_wait_comp);
 
 		return 0;
 	}