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 'ata-6.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata

Pull ata fixes from Damien Le Moal:
"Several libata generic code fixes for rc5:

- Add missing translation of the SYNCHRONIZE CACHE 16 scsi command as
this command is mandatory for host-managed ZBC drives.

The lack of support for it in libata-scsi was causing issues with
some passthrough applications using ZBC drives (from Shin'ichiro).

- Fix the error path of libata-transport host, port, link and device
attributes initialization (from Yingliang).

- Prevent issuing new commands to a drive that is in the NCQ error
state and undergoing recovery (From Niklas).

This bug went unnoticed for a long time as commands issued to a
drive in error state are aborted immediately and retried by the
scsi layer, hiding the useless abort-and-retry sequence"

* tag 'ata-6.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata:
ata: libata-core: do not issue non-internal commands once EH is pending
ata: libata-transport: fix error handling in ata_tdev_add()
ata: libata-transport: fix error handling in ata_tlink_add()
ata: libata-transport: fix error handling in ata_tport_add()
ata: libata-transport: fix double ata_host_put() in ata_tport_add()
ata: libata-scsi: fix SYNCHRONIZE CACHE (16) command failure

+28 -4
+13
drivers/ata/libata-scsi.c
··· 3264 3264 case REPORT_LUNS: 3265 3265 case REQUEST_SENSE: 3266 3266 case SYNCHRONIZE_CACHE: 3267 + case SYNCHRONIZE_CACHE_16: 3267 3268 case REZERO_UNIT: 3268 3269 case SEEK_6: 3269 3270 case SEEK_10: ··· 3923 3922 return ata_scsi_write_same_xlat; 3924 3923 3925 3924 case SYNCHRONIZE_CACHE: 3925 + case SYNCHRONIZE_CACHE_16: 3926 3926 if (ata_try_flush_cache(dev)) 3927 3927 return ata_scsi_flush_xlat; 3928 3928 break; ··· 3964 3962 3965 3963 int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, struct ata_device *dev) 3966 3964 { 3965 + struct ata_port *ap = dev->link->ap; 3967 3966 u8 scsi_op = scmd->cmnd[0]; 3968 3967 ata_xlat_func_t xlat_func; 3968 + 3969 + /* 3970 + * scsi_queue_rq() will defer commands if scsi_host_in_recovery(). 3971 + * However, this check is done without holding the ap->lock (a libata 3972 + * specific lock), so we can have received an error irq since then, 3973 + * therefore we must check if EH is pending, while holding ap->lock. 3974 + */ 3975 + if (ap->pflags & (ATA_PFLAG_EH_PENDING | ATA_PFLAG_EH_IN_PROGRESS)) 3976 + return SCSI_MLQUEUE_DEVICE_BUSY; 3969 3977 3970 3978 if (unlikely(!scmd->cmd_len)) 3971 3979 goto bad_cdb_len; ··· 4157 4145 * turning this into a no-op. 4158 4146 */ 4159 4147 case SYNCHRONIZE_CACHE: 4148 + case SYNCHRONIZE_CACHE_16: 4160 4149 fallthrough; 4161 4150 4162 4151 /* no-op's, complete with success */
+15 -4
drivers/ata/libata-transport.c
··· 301 301 pm_runtime_enable(dev); 302 302 pm_runtime_forbid(dev); 303 303 304 - transport_add_device(dev); 304 + error = transport_add_device(dev); 305 + if (error) 306 + goto tport_transport_add_err; 305 307 transport_configure_device(dev); 306 308 307 309 error = ata_tlink_add(&ap->link); ··· 314 312 315 313 tport_link_err: 316 314 transport_remove_device(dev); 315 + tport_transport_add_err: 317 316 device_del(dev); 318 317 319 318 tport_err: 320 319 transport_destroy_device(dev); 321 320 put_device(dev); 322 - ata_host_put(ap->host); 323 321 return error; 324 322 } 325 323 ··· 458 456 goto tlink_err; 459 457 } 460 458 461 - transport_add_device(dev); 459 + error = transport_add_device(dev); 460 + if (error) 461 + goto tlink_transport_err; 462 462 transport_configure_device(dev); 463 463 464 464 ata_for_each_dev(ata_dev, link, ALL) { ··· 475 471 ata_tdev_delete(ata_dev); 476 472 } 477 473 transport_remove_device(dev); 474 + tlink_transport_err: 478 475 device_del(dev); 479 476 tlink_err: 480 477 transport_destroy_device(dev); ··· 713 708 return error; 714 709 } 715 710 716 - transport_add_device(dev); 711 + error = transport_add_device(dev); 712 + if (error) { 713 + device_del(dev); 714 + ata_tdev_free(ata_dev); 715 + return error; 716 + } 717 + 717 718 transport_configure_device(dev); 718 719 return 0; 719 720 }