Avoid that srp_claim_command() can claim a command while srp_queuecommand() is still busy queueing the same command. Found this via source reading.
Signed-off-by: Bart Van Assche <bvanass...@acm.org> Cc: Roland Dreier <rol...@purestorage.com> Cc: David Dillow <dillo...@ornl.gov> Cc: Vu Pham <v...@mellanox.com> Cc: Sebastian Riemer <sebastian.rie...@profitbricks.com> --- drivers/infiniband/ulp/srp/ib_srp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 368d160..9c638dd 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -1367,7 +1367,6 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd) req = list_first_entry(&target->free_reqs, struct srp_request, list); list_del(&req->list); - spin_unlock_irqrestore(&target->lock, flags); dev = target->srp_host->srp_dev->dev; ib_dma_sync_single_for_cpu(dev, iu->dma, target->max_iu_len, @@ -1401,6 +1400,7 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd) shost_printk(KERN_ERR, target->scsi_host, PFX "Send failed\n"); goto err_unmap; } + spin_unlock_irqrestore(&target->lock, flags); return 0; @@ -1409,8 +1409,6 @@ err_unmap: err_iu: srp_put_tx_iu(target, iu, SRP_IU_CMD); - - spin_lock_irqsave(&target->lock, flags); list_add(&req->list, &target->free_reqs); err_unlock: -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html