Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
"ufs driver plus two core fixes.

One core fix makes the unit attention counters atomic (just in case
multiple commands detect them) and the other is fixing a merge window
regression caused by changes in the block tree"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: core: Fix the unit attention counter implementation
scsi: ufs: core: Declare tx_lanes witout initialization
scsi: ufs: core: Initialize value of an attribute returned by uic cmd
scsi: ufs: core: Fix error handler host_sem issue
scsi: core: Fix a regression triggered by scsi_host_busy()

+26 -21
+3 -2
drivers/scsi/hosts.c
··· 611 611 { 612 612 int cnt = 0; 613 613 614 - blk_mq_tagset_busy_iter(&shost->tag_set, 615 - scsi_host_check_in_flight, &cnt); 614 + if (shost->tag_set.ops) 615 + blk_mq_tagset_busy_iter(&shost->tag_set, 616 + scsi_host_check_in_flight, &cnt); 616 617 return cnt; 617 618 } 618 619 EXPORT_SYMBOL(scsi_host_busy);
+2 -2
drivers/scsi/scsi_error.c
··· 554 554 * happened, even if someone else gets the sense data. 555 555 */ 556 556 if (sshdr.asc == 0x28) 557 - scmd->device->ua_new_media_ctr++; 557 + atomic_inc(&sdev->ua_new_media_ctr); 558 558 else if (sshdr.asc == 0x29) 559 - scmd->device->ua_por_ctr++; 559 + atomic_inc(&sdev->ua_por_ctr); 560 560 } 561 561 562 562 if (scsi_sense_is_deferred(&sshdr))
+17 -11
drivers/ufs/core/ufshcd.c
··· 4282 4282 get, UIC_GET_ATTR_ID(attr_sel), 4283 4283 UFS_UIC_COMMAND_RETRIES - retries); 4284 4284 4285 - if (mib_val && !ret) 4286 - *mib_val = uic_cmd.argument3; 4285 + if (mib_val) 4286 + *mib_val = ret == 0 ? uic_cmd.argument3 : 0; 4287 4287 4288 4288 if (peer && (hba->quirks & UFSHCD_QUIRK_DME_PEER_ACCESS_AUTO_MODE) 4289 4289 && pwr_mode_change) ··· 4999 4999 5000 5000 static int ufshcd_disable_tx_lcc(struct ufs_hba *hba, bool peer) 5001 5001 { 5002 - int tx_lanes = 0, i, err = 0; 5002 + int tx_lanes, i, err = 0; 5003 5003 5004 5004 if (!peer) 5005 5005 ufshcd_dme_get(hba, UIC_ARG_MIB(PA_CONNECTEDTXDATALANES), ··· 6673 6673 hba->saved_uic_err, hba->force_reset, 6674 6674 ufshcd_is_link_broken(hba) ? "; link is broken" : ""); 6675 6675 6676 + /* 6677 + * Use ufshcd_rpm_get_noresume() here to safely perform link recovery 6678 + * even if an error occurs during runtime suspend or runtime resume. 6679 + * This avoids potential deadlocks that could happen if we tried to 6680 + * resume the device while a PM operation is already in progress. 6681 + */ 6682 + ufshcd_rpm_get_noresume(hba); 6683 + if (hba->pm_op_in_progress) { 6684 + ufshcd_link_recovery(hba); 6685 + ufshcd_rpm_put(hba); 6686 + return; 6687 + } 6688 + ufshcd_rpm_put(hba); 6689 + 6676 6690 down(&hba->host_sem); 6677 6691 spin_lock_irqsave(hba->host->host_lock, flags); 6678 6692 if (ufshcd_err_handling_should_stop(hba)) { ··· 6697 6683 return; 6698 6684 } 6699 6685 spin_unlock_irqrestore(hba->host->host_lock, flags); 6700 - 6701 - ufshcd_rpm_get_noresume(hba); 6702 - if (hba->pm_op_in_progress) { 6703 - ufshcd_link_recovery(hba); 6704 - ufshcd_rpm_put(hba); 6705 - return; 6706 - } 6707 - ufshcd_rpm_put(hba); 6708 6686 6709 6687 ufshcd_err_handling_prepare(hba); 6710 6688
+4 -6
include/scsi/scsi_device.h
··· 252 252 unsigned int queue_stopped; /* request queue is quiesced */ 253 253 bool offline_already; /* Device offline message logged */ 254 254 255 - unsigned int ua_new_media_ctr; /* Counter for New Media UNIT ATTENTIONs */ 256 - unsigned int ua_por_ctr; /* Counter for Power On / Reset UAs */ 255 + atomic_t ua_new_media_ctr; /* Counter for New Media UNIT ATTENTIONs */ 256 + atomic_t ua_por_ctr; /* Counter for Power On / Reset UAs */ 257 257 258 258 atomic_t disk_events_disable_depth; /* disable depth for disk events */ 259 259 ··· 693 693 } 694 694 695 695 /* Macros to access the UNIT ATTENTION counters */ 696 - #define scsi_get_ua_new_media_ctr(sdev) \ 697 - ((const unsigned int)(sdev->ua_new_media_ctr)) 698 - #define scsi_get_ua_por_ctr(sdev) \ 699 - ((const unsigned int)(sdev->ua_por_ctr)) 696 + #define scsi_get_ua_new_media_ctr(sdev) atomic_read(&sdev->ua_new_media_ctr) 697 + #define scsi_get_ua_por_ctr(sdev) atomic_read(&sdev->ua_por_ctr) 700 698 701 699 #define MODULE_ALIAS_SCSI_DEVICE(type) \ 702 700 MODULE_ALIAS("scsi:t-" __stringify(type) "*")