Commit 4de2ff26 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 84985eb2 2a26a11e
...@@ -135,7 +135,7 @@ static int smp_execute_task(struct domain_device *dev, void *req, int req_size, ...@@ -135,7 +135,7 @@ static int smp_execute_task(struct domain_device *dev, void *req, int req_size,
static inline void *alloc_smp_req(int size) static inline void *alloc_smp_req(int size)
{ {
u8 *p = kzalloc(size, GFP_KERNEL); u8 *p = kzalloc(ALIGN(size, ARCH_DMA_MINALIGN), GFP_KERNEL);
if (p) if (p)
p[0] = SMP_REQUEST; p[0] = SMP_REQUEST;
return p; return p;
......
...@@ -1775,9 +1775,9 @@ static ssize_t raid_state_show(struct device *dev, ...@@ -1775,9 +1775,9 @@ static ssize_t raid_state_show(struct device *dev,
name = myrb_devstate_name(ldev_info->state); name = myrb_devstate_name(ldev_info->state);
if (name) if (name)
ret = snprintf(buf, 32, "%s\n", name); ret = snprintf(buf, 64, "%s\n", name);
else else
ret = snprintf(buf, 32, "Invalid (%02X)\n", ret = snprintf(buf, 64, "Invalid (%02X)\n",
ldev_info->state); ldev_info->state);
} else { } else {
struct myrb_pdev_state *pdev_info = sdev->hostdata; struct myrb_pdev_state *pdev_info = sdev->hostdata;
...@@ -1796,9 +1796,9 @@ static ssize_t raid_state_show(struct device *dev, ...@@ -1796,9 +1796,9 @@ static ssize_t raid_state_show(struct device *dev,
else else
name = myrb_devstate_name(pdev_info->state); name = myrb_devstate_name(pdev_info->state);
if (name) if (name)
ret = snprintf(buf, 32, "%s\n", name); ret = snprintf(buf, 64, "%s\n", name);
else else
ret = snprintf(buf, 32, "Invalid (%02X)\n", ret = snprintf(buf, 64, "Invalid (%02X)\n",
pdev_info->state); pdev_info->state);
} }
return ret; return ret;
...@@ -1886,11 +1886,11 @@ static ssize_t raid_level_show(struct device *dev, ...@@ -1886,11 +1886,11 @@ static ssize_t raid_level_show(struct device *dev,
name = myrb_raidlevel_name(ldev_info->raid_level); name = myrb_raidlevel_name(ldev_info->raid_level);
if (!name) if (!name)
return snprintf(buf, 32, "Invalid (%02X)\n", return snprintf(buf, 64, "Invalid (%02X)\n",
ldev_info->state); ldev_info->state);
return snprintf(buf, 32, "%s\n", name); return snprintf(buf, 64, "%s\n", name);
} }
return snprintf(buf, 32, "Physical Drive\n"); return snprintf(buf, 64, "Physical Drive\n");
} }
static DEVICE_ATTR_RO(raid_level); static DEVICE_ATTR_RO(raid_level);
...@@ -1903,15 +1903,15 @@ static ssize_t rebuild_show(struct device *dev, ...@@ -1903,15 +1903,15 @@ static ssize_t rebuild_show(struct device *dev,
unsigned char status; unsigned char status;
if (sdev->channel < myrb_logical_channel(sdev->host)) if (sdev->channel < myrb_logical_channel(sdev->host))
return snprintf(buf, 32, "physical device - not rebuilding\n"); return snprintf(buf, 64, "physical device - not rebuilding\n");
status = myrb_get_rbld_progress(cb, &rbld_buf); status = myrb_get_rbld_progress(cb, &rbld_buf);
if (rbld_buf.ldev_num != sdev->id || if (rbld_buf.ldev_num != sdev->id ||
status != MYRB_STATUS_SUCCESS) status != MYRB_STATUS_SUCCESS)
return snprintf(buf, 32, "not rebuilding\n"); return snprintf(buf, 64, "not rebuilding\n");
return snprintf(buf, 32, "rebuilding block %u of %u\n", return snprintf(buf, 64, "rebuilding block %u of %u\n",
rbld_buf.ldev_size - rbld_buf.blocks_left, rbld_buf.ldev_size - rbld_buf.blocks_left,
rbld_buf.ldev_size); rbld_buf.ldev_size);
} }
......
...@@ -947,9 +947,9 @@ static ssize_t raid_state_show(struct device *dev, ...@@ -947,9 +947,9 @@ static ssize_t raid_state_show(struct device *dev,
name = myrs_devstate_name(ldev_info->dev_state); name = myrs_devstate_name(ldev_info->dev_state);
if (name) if (name)
ret = snprintf(buf, 32, "%s\n", name); ret = snprintf(buf, 64, "%s\n", name);
else else
ret = snprintf(buf, 32, "Invalid (%02X)\n", ret = snprintf(buf, 64, "Invalid (%02X)\n",
ldev_info->dev_state); ldev_info->dev_state);
} else { } else {
struct myrs_pdev_info *pdev_info; struct myrs_pdev_info *pdev_info;
...@@ -958,9 +958,9 @@ static ssize_t raid_state_show(struct device *dev, ...@@ -958,9 +958,9 @@ static ssize_t raid_state_show(struct device *dev,
pdev_info = sdev->hostdata; pdev_info = sdev->hostdata;
name = myrs_devstate_name(pdev_info->dev_state); name = myrs_devstate_name(pdev_info->dev_state);
if (name) if (name)
ret = snprintf(buf, 32, "%s\n", name); ret = snprintf(buf, 64, "%s\n", name);
else else
ret = snprintf(buf, 32, "Invalid (%02X)\n", ret = snprintf(buf, 64, "Invalid (%02X)\n",
pdev_info->dev_state); pdev_info->dev_state);
} }
return ret; return ret;
...@@ -1066,13 +1066,13 @@ static ssize_t raid_level_show(struct device *dev, ...@@ -1066,13 +1066,13 @@ static ssize_t raid_level_show(struct device *dev,
ldev_info = sdev->hostdata; ldev_info = sdev->hostdata;
name = myrs_raid_level_name(ldev_info->raid_level); name = myrs_raid_level_name(ldev_info->raid_level);
if (!name) if (!name)
return snprintf(buf, 32, "Invalid (%02X)\n", return snprintf(buf, 64, "Invalid (%02X)\n",
ldev_info->dev_state); ldev_info->dev_state);
} else } else
name = myrs_raid_level_name(MYRS_RAID_PHYSICAL); name = myrs_raid_level_name(MYRS_RAID_PHYSICAL);
return snprintf(buf, 32, "%s\n", name); return snprintf(buf, 64, "%s\n", name);
} }
static DEVICE_ATTR_RO(raid_level); static DEVICE_ATTR_RO(raid_level);
...@@ -1086,7 +1086,7 @@ static ssize_t rebuild_show(struct device *dev, ...@@ -1086,7 +1086,7 @@ static ssize_t rebuild_show(struct device *dev,
unsigned char status; unsigned char status;
if (sdev->channel < cs->ctlr_info->physchan_present) if (sdev->channel < cs->ctlr_info->physchan_present)
return snprintf(buf, 32, "physical device - not rebuilding\n"); return snprintf(buf, 64, "physical device - not rebuilding\n");
ldev_info = sdev->hostdata; ldev_info = sdev->hostdata;
ldev_num = ldev_info->ldev_num; ldev_num = ldev_info->ldev_num;
...@@ -1098,11 +1098,11 @@ static ssize_t rebuild_show(struct device *dev, ...@@ -1098,11 +1098,11 @@ static ssize_t rebuild_show(struct device *dev,
return -EIO; return -EIO;
} }
if (ldev_info->rbld_active) { if (ldev_info->rbld_active) {
return snprintf(buf, 32, "rebuilding block %zu of %zu\n", return snprintf(buf, 64, "rebuilding block %zu of %zu\n",
(size_t)ldev_info->rbld_lba, (size_t)ldev_info->rbld_lba,
(size_t)ldev_info->cfg_devsize); (size_t)ldev_info->cfg_devsize);
} else } else
return snprintf(buf, 32, "not rebuilding\n"); return snprintf(buf, 64, "not rebuilding\n");
} }
static ssize_t rebuild_store(struct device *dev, static ssize_t rebuild_store(struct device *dev,
...@@ -1190,7 +1190,7 @@ static ssize_t consistency_check_show(struct device *dev, ...@@ -1190,7 +1190,7 @@ static ssize_t consistency_check_show(struct device *dev,
unsigned short ldev_num; unsigned short ldev_num;
if (sdev->channel < cs->ctlr_info->physchan_present) if (sdev->channel < cs->ctlr_info->physchan_present)
return snprintf(buf, 32, "physical device - not checking\n"); return snprintf(buf, 64, "physical device - not checking\n");
ldev_info = sdev->hostdata; ldev_info = sdev->hostdata;
if (!ldev_info) if (!ldev_info)
...@@ -1198,11 +1198,11 @@ static ssize_t consistency_check_show(struct device *dev, ...@@ -1198,11 +1198,11 @@ static ssize_t consistency_check_show(struct device *dev,
ldev_num = ldev_info->ldev_num; ldev_num = ldev_info->ldev_num;
myrs_get_ldev_info(cs, ldev_num, ldev_info); myrs_get_ldev_info(cs, ldev_num, ldev_info);
if (ldev_info->cc_active) if (ldev_info->cc_active)
return snprintf(buf, 32, "checking block %zu of %zu\n", return snprintf(buf, 64, "checking block %zu of %zu\n",
(size_t)ldev_info->cc_lba, (size_t)ldev_info->cc_lba,
(size_t)ldev_info->cfg_devsize); (size_t)ldev_info->cfg_devsize);
else else
return snprintf(buf, 32, "not checking\n"); return snprintf(buf, 64, "not checking\n");
} }
static ssize_t consistency_check_store(struct device *dev, static ssize_t consistency_check_store(struct device *dev,
......
...@@ -3920,7 +3920,7 @@ static int sd_probe(struct device *dev) ...@@ -3920,7 +3920,7 @@ static int sd_probe(struct device *dev)
error = device_add_disk(dev, gd, NULL); error = device_add_disk(dev, gd, NULL);
if (error) { if (error) {
put_device(&sdkp->disk_dev); device_unregister(&sdkp->disk_dev);
put_disk(gd); put_disk(gd);
goto out; goto out;
} }
......
...@@ -3217,7 +3217,9 @@ static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba, ...@@ -3217,7 +3217,9 @@ static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba,
/* MCQ mode */ /* MCQ mode */
if (is_mcq_enabled(hba)) { if (is_mcq_enabled(hba)) {
err = ufshcd_clear_cmd(hba, lrbp->task_tag); /* successfully cleared the command, retry if needed */
if (ufshcd_clear_cmd(hba, lrbp->task_tag) == 0)
err = -EAGAIN;
hba->dev_cmd.complete = NULL; hba->dev_cmd.complete = NULL;
return err; return err;
} }
...@@ -9791,7 +9793,10 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) ...@@ -9791,7 +9793,10 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
/* UFS device & link must be active before we enter in this function */ /* UFS device & link must be active before we enter in this function */
if (!ufshcd_is_ufs_dev_active(hba) || !ufshcd_is_link_active(hba)) { if (!ufshcd_is_ufs_dev_active(hba) || !ufshcd_is_link_active(hba)) {
ret = -EINVAL; /* Wait err handler finish or trigger err recovery */
if (!ufshcd_eh_in_progress(hba))
ufshcd_force_error_recovery(hba);
ret = -EBUSY;
goto enable_scaling; goto enable_scaling;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment