Skip to content

Commit 6290e23

Browse files
logostmartinkpetersen
authored andcommitted
scsi: target: core: UA on all LUNs after reset
Allocate UNIT ATTENTION "BUS DEVICE RESET OCCURRED" on all LUNs on all target ports of the device upon reception of TMF LUN RESET. This change passes libiscsi test SCSI.MultipathIO.Reset. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Bogdanov <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 3e2deba commit 6290e23

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

drivers/target/target_core_device.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,25 @@ void target_pr_kref_release(struct kref *kref)
284284
complete(&deve->pr_comp);
285285
}
286286

287+
/*
288+
* Establish UA condition on SCSI device - all LUNs
289+
*/
290+
void target_dev_ua_allocate(struct se_device *dev, u8 asc, u8 ascq)
291+
{
292+
struct se_dev_entry *se_deve;
293+
struct se_lun *lun;
294+
295+
spin_lock(&dev->se_port_lock);
296+
list_for_each_entry(lun, &dev->dev_sep_list, lun_dev_link) {
297+
298+
spin_lock(&lun->lun_deve_lock);
299+
list_for_each_entry(se_deve, &lun->lun_deve_list, lun_link)
300+
core_scsi3_ua_allocate(se_deve, asc, ascq);
301+
spin_unlock(&lun->lun_deve_lock);
302+
}
303+
spin_unlock(&dev->se_port_lock);
304+
}
305+
287306
static void
288307
target_luns_data_has_changed(struct se_node_acl *nacl, struct se_dev_entry *new,
289308
bool skip_new)

drivers/target/target_core_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ int target_configure_device(struct se_device *dev);
8989
void target_free_device(struct se_device *);
9090
int target_for_each_device(int (*fn)(struct se_device *dev, void *data),
9191
void *data);
92+
void target_dev_ua_allocate(struct se_device *dev, u8 asc, u8 ascq);
9293

9394
/* target_core_configfs.c */
9495
extern struct configfs_item_operations target_core_dev_item_ops;

drivers/target/target_core_transport.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3531,8 +3531,7 @@ static void target_tmr_work(struct work_struct *work)
35313531
tmr->response = (!ret) ? TMR_FUNCTION_COMPLETE :
35323532
TMR_FUNCTION_REJECTED;
35333533
if (tmr->response == TMR_FUNCTION_COMPLETE) {
3534-
target_ua_allocate_lun(cmd->se_sess->se_node_acl,
3535-
cmd->orig_fe_lun, 0x29,
3534+
target_dev_ua_allocate(dev, 0x29,
35363535
ASCQ_29H_BUS_DEVICE_RESET_FUNCTION_OCCURRED);
35373536
}
35383537
break;

0 commit comments

Comments
 (0)