diff mbox

[v4,19/37] target: Simplify session shutdown tests

Message ID 20170208222507.25715-20-bart.vanassche@sandisk.com (mailing list archive)
State Superseded
Headers show

Commit Message

Bart Van Assche Feb. 8, 2017, 10:24 p.m. UTC
If se_cmd->cmd_wait_set is set then sess->sess_tearing_down has
already been set. Hence change "sess->sess_tearing_down ||
cmd->cmd_wait_set" into "sess->sess_tearing_down".

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Andy Grover <agrover@redhat.com>
Cc: David Disseldorp <ddiss@suse.de>
---
 drivers/target/target_core_tmr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Nicholas A. Bellinger Feb. 9, 2017, 10:45 a.m. UTC | #1
On Wed, 2017-02-08 at 14:24 -0800, Bart Van Assche wrote:
> If se_cmd->cmd_wait_set is set then sess->sess_tearing_down has
> already been set. Hence change "sess->sess_tearing_down ||
> cmd->cmd_wait_set" into "sess->sess_tearing_down".
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Andy Grover <agrover@redhat.com>
> Cc: David Disseldorp <ddiss@suse.de>
> ---
>  drivers/target/target_core_tmr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c
> index 980d94277c8d..29d15eb5ebd5 100644
> --- a/drivers/target/target_core_tmr.c
> +++ b/drivers/target/target_core_tmr.c
> @@ -114,7 +114,7 @@ static bool __target_check_io_state(struct se_cmd *se_cmd,
>  		spin_unlock(&se_cmd->t_state_lock);
>  		return false;
>  	}
> -	if (sess->sess_tearing_down || se_cmd->cmd_wait_set) {
> +	if (sess->sess_tearing_down) {
>  		pr_debug("Attempted to abort io tag: %llu already shutdown,"
>  			" skipping\n", se_cmd->tag);
>  		spin_unlock(&se_cmd->t_state_lock);
> @@ -247,7 +247,7 @@ static void core_tmr_drain_tmr_list(
>  			spin_unlock(&sess->sess_cmd_lock);
>  			continue;
>  		}
> -		if (sess->sess_tearing_down || cmd->cmd_wait_set) {
> +		if (sess->sess_tearing_down) {
>  			spin_unlock(&cmd->t_state_lock);
>  			spin_unlock(&sess->sess_cmd_lock);
>  			continue;

No, iscsi-target doesn't set sess->sess_tearing_down because it uses
transport_generic_free_cmd() to perform shutdown of commands associated
with a connection.

--
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
Bart Van Assche Feb. 9, 2017, 7:31 p.m. UTC | #2
On Thu, 2017-02-09 at 02:45 -0800, Nicholas A. Bellinger wrote:
> On Wed, 2017-02-08 at 14:24 -0800, Bart Van Assche wrote:
> > If se_cmd->cmd_wait_set is set then sess->sess_tearing_down has
> > already been set. Hence change "sess->sess_tearing_down ||
> > cmd->cmd_wait_set" into "sess->sess_tearing_down".
> > 
> > Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> > Cc: Hannes Reinecke <hare@suse.com>
> > Cc: Christoph Hellwig <hch@lst.de>
> > Cc: Andy Grover <agrover@redhat.com>
> > Cc: David Disseldorp <ddiss@suse.de>
> > ---
> >  drivers/target/target_core_tmr.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c
> > index 980d94277c8d..29d15eb5ebd5 100644
> > --- a/drivers/target/target_core_tmr.c
> > +++ b/drivers/target/target_core_tmr.c
> > @@ -114,7 +114,7 @@ static bool __target_check_io_state(struct se_cmd *se_cmd,
> >  		spin_unlock(&se_cmd->t_state_lock);
> >  		return false;
> >  	}
> > -	if (sess->sess_tearing_down || se_cmd->cmd_wait_set) {
> > +	if (sess->sess_tearing_down) {
> >  		pr_debug("Attempted to abort io tag: %llu already shutdown,"
> >  			" skipping\n", se_cmd->tag);
> >  		spin_unlock(&se_cmd->t_state_lock);
> > @@ -247,7 +247,7 @@ static void core_tmr_drain_tmr_list(
> >  			spin_unlock(&sess->sess_cmd_lock);
> >  			continue;
> >  		}
> > -		if (sess->sess_tearing_down || cmd->cmd_wait_set) {
> > +		if (sess->sess_tearing_down) {
> >  			spin_unlock(&cmd->t_state_lock);
> >  			spin_unlock(&sess->sess_cmd_lock);
> >  			continue;
> 
> No, iscsi-target doesn't set sess->sess_tearing_down because it uses
> transport_generic_free_cmd() to perform shutdown of commands associated
> with a connection.

Please elaborate. The only function that sets 'sess_tearing_down' and
'cmd_wait_set' is target_sess_cmd_list_set_waiting(). The iSCSI target
driver does not call target_sess_cmd_list_set_waiting() and hence does
not set any of these structure members. So how could this patch affect
the iSCSI target driver?

Bart.--
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/target_core_tmr.c b/drivers/target/target_core_tmr.c
index 980d94277c8d..29d15eb5ebd5 100644
--- a/drivers/target/target_core_tmr.c
+++ b/drivers/target/target_core_tmr.c
@@ -114,7 +114,7 @@  static bool __target_check_io_state(struct se_cmd *se_cmd,
 		spin_unlock(&se_cmd->t_state_lock);
 		return false;
 	}
-	if (sess->sess_tearing_down || se_cmd->cmd_wait_set) {
+	if (sess->sess_tearing_down) {
 		pr_debug("Attempted to abort io tag: %llu already shutdown,"
 			" skipping\n", se_cmd->tag);
 		spin_unlock(&se_cmd->t_state_lock);
@@ -247,7 +247,7 @@  static void core_tmr_drain_tmr_list(
 			spin_unlock(&sess->sess_cmd_lock);
 			continue;
 		}
-		if (sess->sess_tearing_down || cmd->cmd_wait_set) {
+		if (sess->sess_tearing_down) {
 			spin_unlock(&cmd->t_state_lock);
 			spin_unlock(&sess->sess_cmd_lock);
 			continue;