Message ID | 1421684851-14561-1-git-send-email-dmilburn@redhat.com |
---|---|
State | Not Applicable |
Delegated to: | David Miller |
Headers | show |
On Mon, Jan 19, 2015 at 10:27:31AM -0600, David Milburn wrote: > void ata_sff_flush_pio_task(struct ata_port *ap) > { > + struct Scsi_Host *host = ap->scsi_host; > + unsigned long flags; > + > DPRINTK("ENTER\n"); > > cancel_delayed_work_sync(&ap->sff_pio_task); > + > + /* prevent racing with ISR's use of ap->hsm_task_state */ Can we have a more descriptive comment please? lock, assign, unlock sequence is pretty unusual, so let's give the full explanation here. > + spin_lock_irqsave(host->host_lock, flags); > ap->hsm_task_state = HSM_ST_IDLE; > + spin_unlock_irqrestore(host->host_lock, flags); Other than that, yeah, nice spotting. Thanks.
Hi Tejun, On 01/19/2015 11:41 AM, Tejun Heo wrote: > On Mon, Jan 19, 2015 at 10:27:31AM -0600, David Milburn wrote: >> void ata_sff_flush_pio_task(struct ata_port *ap) >> { >> + struct Scsi_Host *host = ap->scsi_host; >> + unsigned long flags; >> + >> DPRINTK("ENTER\n"); >> >> cancel_delayed_work_sync(&ap->sff_pio_task); >> + >> + /* prevent racing with ISR's use of ap->hsm_task_state */ > > Can we have a more descriptive comment please? lock, assign, unlock > sequence is pretty unusual, so let's give the full explanation here. > Ok, will do. Thanks, David -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index db90aa3..2bbfb5e 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c @@ -1330,10 +1330,18 @@ EXPORT_SYMBOL_GPL(ata_sff_queue_pio_task); void ata_sff_flush_pio_task(struct ata_port *ap) { + struct Scsi_Host *host = ap->scsi_host; + unsigned long flags; + DPRINTK("ENTER\n"); cancel_delayed_work_sync(&ap->sff_pio_task); + + /* prevent racing with ISR's use of ap->hsm_task_state */ + spin_lock_irqsave(host->host_lock, flags); ap->hsm_task_state = HSM_ST_IDLE; + spin_unlock_irqrestore(host->host_lock, flags); + ap->sff_pio_task_link = NULL; if (ata_msg_ctl(ap))