diff mbox

[5/6] target: Send UA upon LUN RESET tmr completion

Message ID 1434009689-112909-6-git-send-email-hare@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

Hannes Reinecke June 11, 2015, 8:01 a.m. UTC
SAM mandates that an BUS DEVICE RESET FUNCTION OCCURRED
UA needs to be send after a LUN RESET tmr has completed.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/target/target_core_transport.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Christoph Hellwig June 19, 2015, 1:06 p.m. UTC | #1
On Thu, Jun 11, 2015 at 10:01:28AM +0200, Hannes Reinecke wrote:
> SAM mandates that an BUS DEVICE RESET FUNCTION OCCURRED
> UA needs to be send after a LUN RESET tmr has completed.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/target/target_core_transport.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
> index a0e0d3a..bb60c0c4 100644
> --- a/drivers/target/target_core_transport.c
> +++ b/drivers/target/target_core_transport.c
> @@ -3064,6 +3064,17 @@ static void target_tmr_work(struct work_struct *work)
>  		ret = core_tmr_lun_reset(dev, tmr, NULL, NULL);
>  		tmr->response = (!ret) ? TMR_FUNCTION_COMPLETE :
>  					 TMR_FUNCTION_REJECTED;
> +		if (tmr->response == TMR_FUNCTION_COMPLETE) {
> +			struct se_dev_entry *deve;
> +
> +			rcu_read_lock();
> +			deve = target_nacl_find_deve(cmd->se_sess->se_node_acl,
> +						     cmd->orig_fe_lun);
> +			if (deve)
> +				core_scsi3_ua_allocate(deve, 0x29,
> +					ASCQ_29H_BUS_DEVICE_RESET_FUNCTION_OCCURRED);
> +			rcu_read_unlock();

This should use the target_ua_allocate_lun helper.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
Hannes Reinecke June 19, 2015, 1:07 p.m. UTC | #2
On 06/19/2015 03:06 PM, Christoph Hellwig wrote:
> On Thu, Jun 11, 2015 at 10:01:28AM +0200, Hannes Reinecke wrote:
>> SAM mandates that an BUS DEVICE RESET FUNCTION OCCURRED
>> UA needs to be send after a LUN RESET tmr has completed.
>>
>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>> ---
>>  drivers/target/target_core_transport.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
>> index a0e0d3a..bb60c0c4 100644
>> --- a/drivers/target/target_core_transport.c
>> +++ b/drivers/target/target_core_transport.c
>> @@ -3064,6 +3064,17 @@ static void target_tmr_work(struct work_struct *work)
>>  		ret = core_tmr_lun_reset(dev, tmr, NULL, NULL);
>>  		tmr->response = (!ret) ? TMR_FUNCTION_COMPLETE :
>>  					 TMR_FUNCTION_REJECTED;
>> +		if (tmr->response == TMR_FUNCTION_COMPLETE) {
>> +			struct se_dev_entry *deve;
>> +
>> +			rcu_read_lock();
>> +			deve = target_nacl_find_deve(cmd->se_sess->se_node_acl,
>> +						     cmd->orig_fe_lun);
>> +			if (deve)
>> +				core_scsi3_ua_allocate(deve, 0x29,
>> +					ASCQ_29H_BUS_DEVICE_RESET_FUNCTION_OCCURRED);
>> +			rcu_read_unlock();
> 
> This should use the target_ua_allocate_lun helper.
> 
Yep, will be doing so.

Cheers,

Hannes
Nicholas A. Bellinger June 23, 2015, 7:54 a.m. UTC | #3
On Fri, 2015-06-19 at 15:06 +0200, Christoph Hellwig wrote:
> On Thu, Jun 11, 2015 at 10:01:28AM +0200, Hannes Reinecke wrote:
> > SAM mandates that an BUS DEVICE RESET FUNCTION OCCURRED
> > UA needs to be send after a LUN RESET tmr has completed.
> > 
> > Signed-off-by: Hannes Reinecke <hare@suse.de>
> > ---
> >  drivers/target/target_core_transport.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
> > index a0e0d3a..bb60c0c4 100644
> > --- a/drivers/target/target_core_transport.c
> > +++ b/drivers/target/target_core_transport.c
> > @@ -3064,6 +3064,17 @@ static void target_tmr_work(struct work_struct *work)
> >  		ret = core_tmr_lun_reset(dev, tmr, NULL, NULL);
> >  		tmr->response = (!ret) ? TMR_FUNCTION_COMPLETE :
> >  					 TMR_FUNCTION_REJECTED;
> > +		if (tmr->response == TMR_FUNCTION_COMPLETE) {
> > +			struct se_dev_entry *deve;
> > +
> > +			rcu_read_lock();
> > +			deve = target_nacl_find_deve(cmd->se_sess->se_node_acl,
> > +						     cmd->orig_fe_lun);
> > +			if (deve)
> > +				core_scsi3_ua_allocate(deve, 0x29,
> > +					ASCQ_29H_BUS_DEVICE_RESET_FUNCTION_OCCURRED);
> > +			rcu_read_unlock();
> 
> This should use the target_ua_allocate_lun helper.

Fixed.

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" 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_transport.c b/drivers/target/target_core_transport.c
index a0e0d3a..bb60c0c4 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -3064,6 +3064,17 @@  static void target_tmr_work(struct work_struct *work)
 		ret = core_tmr_lun_reset(dev, tmr, NULL, NULL);
 		tmr->response = (!ret) ? TMR_FUNCTION_COMPLETE :
 					 TMR_FUNCTION_REJECTED;
+		if (tmr->response == TMR_FUNCTION_COMPLETE) {
+			struct se_dev_entry *deve;
+
+			rcu_read_lock();
+			deve = target_nacl_find_deve(cmd->se_sess->se_node_acl,
+						     cmd->orig_fe_lun);
+			if (deve)
+				core_scsi3_ua_allocate(deve, 0x29,
+					ASCQ_29H_BUS_DEVICE_RESET_FUNCTION_OCCURRED);
+			rcu_read_unlock();
+		}
 		break;
 	case TMR_TARGET_WARM_RESET:
 		tmr->response = TMR_FUNCTION_REJECTED;