Hi Herton,

On Tue, 2012-06-19 at 15:28 -0300, Herton Ronaldo Krzesinski wrote:
> On Mon, Jun 18, 2012 at 09:50:03AM -0700, [email protected] wrote:
> > 
> > The patch below does not apply to the 3.4-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <[email protected]>.
> > 
> > thanks,
> > 
> > greg k-h
> 
> This fixed version for 3.2 applies also for 3.4:
> 
> >From 4d024961ae5aa9065f14c888860101d807ab9a74 Mon Sep 17 00:00:00 2001
> From: Ben Hutchings <[email protected]>
> Date: Sun, 17 Jun 2012 19:00:38 +0100
> Subject: [PATCH] target: Return error to initiator if SET TARGET PORT GROUPS
>  emulation fails
> 
> 3.2-stable review patch.  If anyone has any objections, please let me know.
> 

Thanks for pointing this out.

Greg-KH, would you be so kind to include Ben's version for v3.2
(4d024961a) into 3.4 + 3.3 stable..?

Otherwise please let me know if I need to respin a patch for this..

Thanks!

--nab

> ------------------
> 
> From: Roland Dreier <[email protected]>
> 
> commit 59e4f541baf728dbb426949bfa9f6862387ffd0e upstream.
> 
> The error paths in target_emulate_set_target_port_groups() are all
> essentially "rc = -EINVAL; goto out;" but the code at "out:" ignores
> rc and always returns success.  This means that even if eg explicit
> ALUA is turned off, the initiator will always see a good SCSI status
> for SET TARGET PORT GROUPS.
> 
> Fix this by returning rc as is intended.  It appears this bug was
> added by the following patch:
> 
> commit 05d1c7c0d0db4cc25548d9aadebb416888a82327
> Author: Andy Grover <[email protected]>
> Date:   Wed Jul 20 19:13:28 2011 +0000
> 
>     target: Make all control CDBs scatter-gather
> 
> Signed-off-by: Roland Dreier <[email protected]>
> Cc: Andy Grover <[email protected]>
> Signed-off-by: Nicholas Bellinger <[email protected]>
> [bwh: Backported to 3.2: we have transport_complete_task()
>  and not target_complete_cmd()]
> Signed-off-by: Ben Hutchings <[email protected]>
> ---
>  drivers/target/target_core_alua.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/target/target_core_alua.c 
> b/drivers/target/target_core_alua.c
> index 5b05744..0364ca2 100644
> --- a/drivers/target/target_core_alua.c
> +++ b/drivers/target/target_core_alua.c
> @@ -352,9 +352,11 @@ int target_emulate_set_target_port_groups(struct se_task 
> *task)
>  
>  out:
>       transport_kunmap_data_sg(cmd);
> -     task->task_scsi_status = GOOD;
> -     transport_complete_task(task, 1);
> -     return 0;
> +     if (!rc) {
> +             task->task_scsi_status = GOOD;
> +             transport_complete_task(task, 1);
> +     }
> +     return rc;
>  }
>  
>  static inline int core_alua_state_nonoptimized(
> -- 
> 1.7.9.5
> 
> 
> > 
> > ------------------ original commit in Linus's tree ------------------
> > 
> > From 59e4f541baf728dbb426949bfa9f6862387ffd0e Mon Sep 17 00:00:00 2001
> > From: Roland Dreier <[email protected]>
> > Date: Mon, 4 Jun 2012 23:24:51 -0700
> > Subject: [PATCH] target: Return error to initiator if SET TARGET PORT GROUPS
> >  emulation fails
> > 
> > The error paths in target_emulate_set_target_port_groups() are all
> > essentially "rc = -EINVAL; goto out;" but the code at "out:" ignores
> > rc and always returns success.  This means that even if eg explicit
> > ALUA is turned off, the initiator will always see a good SCSI status
> > for SET TARGET PORT GROUPS.
> > 
> > Fix this by returning rc as is intended.  It appears this bug was
> > added by the following patch:
> > 
> > commit 05d1c7c0d0db4cc25548d9aadebb416888a82327
> > Author: Andy Grover <[email protected]>
> > Date:   Wed Jul 20 19:13:28 2011 +0000
> > 
> >     target: Make all control CDBs scatter-gather
> > 
> > Signed-off-by: Roland Dreier <[email protected]>
> > Cc: Andy Grover <[email protected]>
> > Cc: <[email protected]>
> > Signed-off-by: Nicholas Bellinger <[email protected]>
> > 
> > diff --git a/drivers/target/target_core_alua.c 
> > b/drivers/target/target_core_alua.c
> > index e624b83..9179997 100644
> > --- a/drivers/target/target_core_alua.c
> > +++ b/drivers/target/target_core_alua.c
> > @@ -374,8 +374,9 @@ int target_emulate_set_target_port_groups(struct se_cmd 
> > *cmd)
> >  
> >  out:
> >     transport_kunmap_data_sg(cmd);
> > -   target_complete_cmd(cmd, GOOD);
> > -   return 0;
> > +   if (!rc)
> > +           target_complete_cmd(cmd, GOOD);
> > +   return rc;
> >  }
> >  
> >  static inline int core_alua_state_nonoptimized(
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe stable" in
> > the body of a message to [email protected]
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> 


--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to