X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=kernel%2Fdrivers%2Fscsi%2Flibfc%2Ffc_fcp.c;fp=kernel%2Fdrivers%2Fscsi%2Flibfc%2Ffc_fcp.c;h=2d5909c4685ca63375f5041d960effada171f5fc;hb=fdb8b20906f3546ba6c2f9f0686d8a5189516ba3;hp=c6795941b45d98579cd6117cc5b72f8c5c4d0bf9;hpb=cc84a1f21026270463b580f2564f9d71912b20db;p=kvmfornfv.git diff --git a/kernel/drivers/scsi/libfc/fc_fcp.c b/kernel/drivers/scsi/libfc/fc_fcp.c index c6795941b..2d5909c46 100644 --- a/kernel/drivers/scsi/libfc/fc_fcp.c +++ b/kernel/drivers/scsi/libfc/fc_fcp.c @@ -1039,11 +1039,26 @@ restart: fc_fcp_pkt_hold(fsp); spin_unlock_irqrestore(&si->scsi_queue_lock, flags); - if (!fc_fcp_lock_pkt(fsp)) { + spin_lock_bh(&fsp->scsi_pkt_lock); + if (!(fsp->state & FC_SRB_COMPL)) { + fsp->state |= FC_SRB_COMPL; + /* + * TODO: dropping scsi_pkt_lock and then reacquiring + * again around fc_fcp_cleanup_cmd() is required, + * since fc_fcp_cleanup_cmd() calls into + * fc_seq_set_resp() and that func preempts cpu using + * schedule. May be schedule and related code should be + * removed instead of unlocking here to avoid scheduling + * while atomic bug. + */ + spin_unlock_bh(&fsp->scsi_pkt_lock); + fc_fcp_cleanup_cmd(fsp, error); + + spin_lock_bh(&fsp->scsi_pkt_lock); fc_io_compl(fsp); - fc_fcp_unlock_pkt(fsp); } + spin_unlock_bh(&fsp->scsi_pkt_lock); fc_fcp_pkt_release(fsp); spin_lock_irqsave(&si->scsi_queue_lock, flags);