Skip to content

Commit 4de2ff2

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: "The most important is the libsas fix, which is a problem for DMA to a kmalloc'd structure too small causing cache line interference. The other fixes (all in drivers) are mostly for allocation length fixes, error leg unwinding, suspend races and a missing retry" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: ufs: core: Fix MCQ mode dev command timeout scsi: libsas: Align SMP request allocation to ARCH_DMA_MINALIGN scsi: sd: Unregister device if device_add_disk() failed in sd_probe() scsi: ufs: core: WLUN suspend dev/link state error recovery scsi: mylex: Fix sysfs buffer lengths
2 parents 84985eb + 2a26a11 commit 4de2ff2

File tree

5 files changed

+31
-26
lines changed

5 files changed

+31
-26
lines changed

drivers/scsi/libsas/sas_expander.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static int smp_execute_task(struct domain_device *dev, void *req, int req_size,
135135

136136
static inline void *alloc_smp_req(int size)
137137
{
138-
u8 *p = kzalloc(size, GFP_KERNEL);
138+
u8 *p = kzalloc(ALIGN(size, ARCH_DMA_MINALIGN), GFP_KERNEL);
139139
if (p)
140140
p[0] = SMP_REQUEST;
141141
return p;

drivers/scsi/myrb.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,9 +1775,9 @@ static ssize_t raid_state_show(struct device *dev,
17751775

17761776
name = myrb_devstate_name(ldev_info->state);
17771777
if (name)
1778-
ret = snprintf(buf, 32, "%s\n", name);
1778+
ret = snprintf(buf, 64, "%s\n", name);
17791779
else
1780-
ret = snprintf(buf, 32, "Invalid (%02X)\n",
1780+
ret = snprintf(buf, 64, "Invalid (%02X)\n",
17811781
ldev_info->state);
17821782
} else {
17831783
struct myrb_pdev_state *pdev_info = sdev->hostdata;
@@ -1796,9 +1796,9 @@ static ssize_t raid_state_show(struct device *dev,
17961796
else
17971797
name = myrb_devstate_name(pdev_info->state);
17981798
if (name)
1799-
ret = snprintf(buf, 32, "%s\n", name);
1799+
ret = snprintf(buf, 64, "%s\n", name);
18001800
else
1801-
ret = snprintf(buf, 32, "Invalid (%02X)\n",
1801+
ret = snprintf(buf, 64, "Invalid (%02X)\n",
18021802
pdev_info->state);
18031803
}
18041804
return ret;
@@ -1886,11 +1886,11 @@ static ssize_t raid_level_show(struct device *dev,
18861886

18871887
name = myrb_raidlevel_name(ldev_info->raid_level);
18881888
if (!name)
1889-
return snprintf(buf, 32, "Invalid (%02X)\n",
1889+
return snprintf(buf, 64, "Invalid (%02X)\n",
18901890
ldev_info->state);
1891-
return snprintf(buf, 32, "%s\n", name);
1891+
return snprintf(buf, 64, "%s\n", name);
18921892
}
1893-
return snprintf(buf, 32, "Physical Drive\n");
1893+
return snprintf(buf, 64, "Physical Drive\n");
18941894
}
18951895
static DEVICE_ATTR_RO(raid_level);
18961896

@@ -1903,15 +1903,15 @@ static ssize_t rebuild_show(struct device *dev,
19031903
unsigned char status;
19041904

19051905
if (sdev->channel < myrb_logical_channel(sdev->host))
1906-
return snprintf(buf, 32, "physical device - not rebuilding\n");
1906+
return snprintf(buf, 64, "physical device - not rebuilding\n");
19071907

19081908
status = myrb_get_rbld_progress(cb, &rbld_buf);
19091909

19101910
if (rbld_buf.ldev_num != sdev->id ||
19111911
status != MYRB_STATUS_SUCCESS)
1912-
return snprintf(buf, 32, "not rebuilding\n");
1912+
return snprintf(buf, 64, "not rebuilding\n");
19131913

1914-
return snprintf(buf, 32, "rebuilding block %u of %u\n",
1914+
return snprintf(buf, 64, "rebuilding block %u of %u\n",
19151915
rbld_buf.ldev_size - rbld_buf.blocks_left,
19161916
rbld_buf.ldev_size);
19171917
}

drivers/scsi/myrs.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -947,9 +947,9 @@ static ssize_t raid_state_show(struct device *dev,
947947

948948
name = myrs_devstate_name(ldev_info->dev_state);
949949
if (name)
950-
ret = snprintf(buf, 32, "%s\n", name);
950+
ret = snprintf(buf, 64, "%s\n", name);
951951
else
952-
ret = snprintf(buf, 32, "Invalid (%02X)\n",
952+
ret = snprintf(buf, 64, "Invalid (%02X)\n",
953953
ldev_info->dev_state);
954954
} else {
955955
struct myrs_pdev_info *pdev_info;
@@ -958,9 +958,9 @@ static ssize_t raid_state_show(struct device *dev,
958958
pdev_info = sdev->hostdata;
959959
name = myrs_devstate_name(pdev_info->dev_state);
960960
if (name)
961-
ret = snprintf(buf, 32, "%s\n", name);
961+
ret = snprintf(buf, 64, "%s\n", name);
962962
else
963-
ret = snprintf(buf, 32, "Invalid (%02X)\n",
963+
ret = snprintf(buf, 64, "Invalid (%02X)\n",
964964
pdev_info->dev_state);
965965
}
966966
return ret;
@@ -1066,13 +1066,13 @@ static ssize_t raid_level_show(struct device *dev,
10661066
ldev_info = sdev->hostdata;
10671067
name = myrs_raid_level_name(ldev_info->raid_level);
10681068
if (!name)
1069-
return snprintf(buf, 32, "Invalid (%02X)\n",
1069+
return snprintf(buf, 64, "Invalid (%02X)\n",
10701070
ldev_info->dev_state);
10711071

10721072
} else
10731073
name = myrs_raid_level_name(MYRS_RAID_PHYSICAL);
10741074

1075-
return snprintf(buf, 32, "%s\n", name);
1075+
return snprintf(buf, 64, "%s\n", name);
10761076
}
10771077
static DEVICE_ATTR_RO(raid_level);
10781078

@@ -1086,7 +1086,7 @@ static ssize_t rebuild_show(struct device *dev,
10861086
unsigned char status;
10871087

10881088
if (sdev->channel < cs->ctlr_info->physchan_present)
1089-
return snprintf(buf, 32, "physical device - not rebuilding\n");
1089+
return snprintf(buf, 64, "physical device - not rebuilding\n");
10901090

10911091
ldev_info = sdev->hostdata;
10921092
ldev_num = ldev_info->ldev_num;
@@ -1098,11 +1098,11 @@ static ssize_t rebuild_show(struct device *dev,
10981098
return -EIO;
10991099
}
11001100
if (ldev_info->rbld_active) {
1101-
return snprintf(buf, 32, "rebuilding block %zu of %zu\n",
1101+
return snprintf(buf, 64, "rebuilding block %zu of %zu\n",
11021102
(size_t)ldev_info->rbld_lba,
11031103
(size_t)ldev_info->cfg_devsize);
11041104
} else
1105-
return snprintf(buf, 32, "not rebuilding\n");
1105+
return snprintf(buf, 64, "not rebuilding\n");
11061106
}
11071107

11081108
static ssize_t rebuild_store(struct device *dev,
@@ -1190,19 +1190,19 @@ static ssize_t consistency_check_show(struct device *dev,
11901190
unsigned short ldev_num;
11911191

11921192
if (sdev->channel < cs->ctlr_info->physchan_present)
1193-
return snprintf(buf, 32, "physical device - not checking\n");
1193+
return snprintf(buf, 64, "physical device - not checking\n");
11941194

11951195
ldev_info = sdev->hostdata;
11961196
if (!ldev_info)
11971197
return -ENXIO;
11981198
ldev_num = ldev_info->ldev_num;
11991199
myrs_get_ldev_info(cs, ldev_num, ldev_info);
12001200
if (ldev_info->cc_active)
1201-
return snprintf(buf, 32, "checking block %zu of %zu\n",
1201+
return snprintf(buf, 64, "checking block %zu of %zu\n",
12021202
(size_t)ldev_info->cc_lba,
12031203
(size_t)ldev_info->cfg_devsize);
12041204
else
1205-
return snprintf(buf, 32, "not checking\n");
1205+
return snprintf(buf, 64, "not checking\n");
12061206
}
12071207

12081208
static ssize_t consistency_check_store(struct device *dev,

drivers/scsi/sd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3920,7 +3920,7 @@ static int sd_probe(struct device *dev)
39203920

39213921
error = device_add_disk(dev, gd, NULL);
39223922
if (error) {
3923-
put_device(&sdkp->disk_dev);
3923+
device_unregister(&sdkp->disk_dev);
39243924
put_disk(gd);
39253925
goto out;
39263926
}

drivers/ufs/core/ufshcd.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3217,7 +3217,9 @@ static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba,
32173217

32183218
/* MCQ mode */
32193219
if (is_mcq_enabled(hba)) {
3220-
err = ufshcd_clear_cmd(hba, lrbp->task_tag);
3220+
/* successfully cleared the command, retry if needed */
3221+
if (ufshcd_clear_cmd(hba, lrbp->task_tag) == 0)
3222+
err = -EAGAIN;
32213223
hba->dev_cmd.complete = NULL;
32223224
return err;
32233225
}
@@ -9791,7 +9793,10 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
97919793

97929794
/* UFS device & link must be active before we enter in this function */
97939795
if (!ufshcd_is_ufs_dev_active(hba) || !ufshcd_is_link_active(hba)) {
9794-
ret = -EINVAL;
9796+
/* Wait err handler finish or trigger err recovery */
9797+
if (!ufshcd_eh_in_progress(hba))
9798+
ufshcd_force_error_recovery(hba);
9799+
ret = -EBUSY;
97959800
goto enable_scaling;
97969801
}
97979802

0 commit comments

Comments
 (0)