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 <h...@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();
+               }
                break;
        case TMR_TARGET_WARM_RESET:
                tmr->response = TMR_FUNCTION_REJECTED;
-- 
1.8.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to