Il 21/05/2014 15:30, Bart Van Assche ha scritto:
+static bool scmd_being_handled_in_other_context(struct scsi_cmnd *scmd) +{ + struct Scsi_Host *shost = scmd->device->host; + struct scsi_cmnd *c; + unsigned long flags; + bool ret = false; + + if (!blk_rq_completed(scmd->request)) + return true; + + spin_lock_irqsave(shost->host_lock, flags); + list_for_each_entry(c, &shost->eh_cmd_q, eh_entry) { + if (c == scmd) { + ret = true; + break; + } + } + spin_unlock_irqrestore(shost->host_lock, flags); + + return ret; +} + /** * scmd_eh_abort_handler - Handle command aborts * @work: command to be aborted. @@ -120,6 +142,8 @@ scmd_eh_abort_handler(struct work_struct *work) struct scsi_device *sdev = scmd->device; int rtn; + WARN_ON_ONCE(scmd_being_handled_in_other_context(scmd));
What about a simpler, though less accuracte WARN_ON(!blk_rq_completed(scmd->request)); that doesn't need the host_lock? Paolo -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html