Skip to content

Commit 1dfe225

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "A couple of error leg problems, one affecting scsi_debug and the other affecting pure SAS (i.e. not SATA) SCSI expanders" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: libsas: Fix exp-attached device scan after probe failure scanned in again after probe failed scsi: scsi_debug: Fix create target debugfs failure
2 parents 73e9315 + ab2068a commit 1dfe225

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

drivers/scsi/libsas/sas_internal.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,20 @@ static inline void sas_fail_probe(struct domain_device *dev, const char *func, i
145145
func, dev->parent ? "exp-attached" :
146146
"direct-attached",
147147
SAS_ADDR(dev->sas_addr), err);
148+
149+
/*
150+
* If the device probe failed, the expander phy attached address
151+
* needs to be reset so that the phy will not be treated as flutter
152+
* in the next revalidation
153+
*/
154+
if (dev->parent && !dev_is_expander(dev->dev_type)) {
155+
struct sas_phy *phy = dev->phy;
156+
struct domain_device *parent = dev->parent;
157+
struct ex_phy *ex_phy = &parent->ex_dev.ex_phy[phy->number];
158+
159+
memset(ex_phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
160+
}
161+
148162
sas_unregister_dev(dev->port, dev);
149163
}
150164

drivers/scsi/scsi_debug.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,7 @@ static const int device_qfull_result =
926926
static const int condition_met_result = SAM_STAT_CONDITION_MET;
927927

928928
static struct dentry *sdebug_debugfs_root;
929+
static ASYNC_DOMAIN_EXCLUSIVE(sdebug_async_domain);
929930

930931
static void sdebug_err_free(struct rcu_head *head)
931932
{
@@ -1148,6 +1149,8 @@ static int sdebug_target_alloc(struct scsi_target *starget)
11481149
if (!targetip)
11491150
return -ENOMEM;
11501151

1152+
async_synchronize_full_domain(&sdebug_async_domain);
1153+
11511154
targetip->debugfs_entry = debugfs_create_dir(dev_name(&starget->dev),
11521155
sdebug_debugfs_root);
11531156

@@ -1174,7 +1177,8 @@ static void sdebug_target_destroy(struct scsi_target *starget)
11741177
targetip = (struct sdebug_target_info *)starget->hostdata;
11751178
if (targetip) {
11761179
starget->hostdata = NULL;
1177-
async_schedule(sdebug_tartget_cleanup_async, targetip);
1180+
async_schedule_domain(sdebug_tartget_cleanup_async, targetip,
1181+
&sdebug_async_domain);
11781182
}
11791183
}
11801184

0 commit comments

Comments
 (0)