aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc/fc_fcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libfc/fc_fcp.c')
-rw-r--r--drivers/scsi/libfc/fc_fcp.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 54a6ec8e131d..071cf082d342 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -58,8 +58,7 @@ struct kmem_cache *scsi_pkt_cachep;
58#define FC_SRB_WRITE (1 << 0) 58#define FC_SRB_WRITE (1 << 0)
59 59
60/* 60/*
61 * The SCp.ptr should be tested and set under the host lock. NULL indicates 61 * The SCp.ptr should be tested and set under the scsi_pkt_queue lock
62 * that the command has been retruned to the scsi layer.
63 */ 62 */
64#define CMD_SP(Cmnd) ((struct fc_fcp_pkt *)(Cmnd)->SCp.ptr) 63#define CMD_SP(Cmnd) ((struct fc_fcp_pkt *)(Cmnd)->SCp.ptr)
65#define CMD_ENTRY_STATUS(Cmnd) ((Cmnd)->SCp.have_data_in) 64#define CMD_ENTRY_STATUS(Cmnd) ((Cmnd)->SCp.have_data_in)
@@ -1754,7 +1753,7 @@ static inline int fc_fcp_lport_queue_ready(struct fc_lport *lport)
1754 * This is the i/o strategy routine, called by the SCSI layer. This routine 1753 * This is the i/o strategy routine, called by the SCSI layer. This routine
1755 * is called with the host_lock held. 1754 * is called with the host_lock held.
1756 */ 1755 */
1757int fc_queuecommand(struct scsi_cmnd *sc_cmd, void (*done)(struct scsi_cmnd *)) 1756static int fc_queuecommand_lck(struct scsi_cmnd *sc_cmd, void (*done)(struct scsi_cmnd *))
1758{ 1757{
1759 struct fc_lport *lport; 1758 struct fc_lport *lport;
1760 struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device)); 1759 struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device));
@@ -1852,6 +1851,8 @@ out:
1852 spin_lock_irq(lport->host->host_lock); 1851 spin_lock_irq(lport->host->host_lock);
1853 return rc; 1852 return rc;
1854} 1853}
1854
1855DEF_SCSI_QCMD(fc_queuecommand)
1855EXPORT_SYMBOL(fc_queuecommand); 1856EXPORT_SYMBOL(fc_queuecommand);
1856 1857
1857/** 1858/**
@@ -1880,8 +1881,6 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
1880 1881
1881 lport = fsp->lp; 1882 lport = fsp->lp;
1882 si = fc_get_scsi_internal(lport); 1883 si = fc_get_scsi_internal(lport);
1883 if (!fsp->cmd)
1884 return;
1885 1884
1886 /* 1885 /*
1887 * if can_queue ramp down is done then try can_queue ramp up 1886 * if can_queue ramp down is done then try can_queue ramp up
@@ -1891,11 +1890,6 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
1891 fc_fcp_can_queue_ramp_up(lport); 1890 fc_fcp_can_queue_ramp_up(lport);
1892 1891
1893 sc_cmd = fsp->cmd; 1892 sc_cmd = fsp->cmd;
1894 fsp->cmd = NULL;
1895
1896 if (!sc_cmd->SCp.ptr)
1897 return;
1898
1899 CMD_SCSI_STATUS(sc_cmd) = fsp->cdb_status; 1893 CMD_SCSI_STATUS(sc_cmd) = fsp->cdb_status;
1900 switch (fsp->status_code) { 1894 switch (fsp->status_code) {
1901 case FC_COMPLETE: 1895 case FC_COMPLETE:
@@ -1971,15 +1965,13 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
1971 break; 1965 break;
1972 } 1966 }
1973 1967
1974 if (lport->state != LPORT_ST_READY && fsp->status_code != FC_COMPLETE) { 1968 if (lport->state != LPORT_ST_READY && fsp->status_code != FC_COMPLETE)
1975 sc_cmd->result = (DID_REQUEUE << 16); 1969 sc_cmd->result = (DID_TRANSPORT_DISRUPTED << 16);
1976 FC_FCP_DBG(fsp, "Returning DID_REQUEUE to scsi-ml\n");
1977 }
1978 1970
1979 spin_lock_irqsave(&si->scsi_queue_lock, flags); 1971 spin_lock_irqsave(&si->scsi_queue_lock, flags);
1980 list_del(&fsp->list); 1972 list_del(&fsp->list);
1981 spin_unlock_irqrestore(&si->scsi_queue_lock, flags);
1982 sc_cmd->SCp.ptr = NULL; 1973 sc_cmd->SCp.ptr = NULL;
1974 spin_unlock_irqrestore(&si->scsi_queue_lock, flags);
1983 sc_cmd->scsi_done(sc_cmd); 1975 sc_cmd->scsi_done(sc_cmd);
1984 1976
1985 /* release ref from initial allocation in queue command */ 1977 /* release ref from initial allocation in queue command */
@@ -1997,6 +1989,7 @@ int fc_eh_abort(struct scsi_cmnd *sc_cmd)
1997{ 1989{
1998 struct fc_fcp_pkt *fsp; 1990 struct fc_fcp_pkt *fsp;
1999 struct fc_lport *lport; 1991 struct fc_lport *lport;
1992 struct fc_fcp_internal *si;
2000 int rc = FAILED; 1993 int rc = FAILED;
2001 unsigned long flags; 1994 unsigned long flags;
2002 1995
@@ -2006,7 +1999,8 @@ int fc_eh_abort(struct scsi_cmnd *sc_cmd)
2006 else if (!lport->link_up) 1999 else if (!lport->link_up)
2007 return rc; 2000 return rc;
2008 2001
2009 spin_lock_irqsave(lport->host->host_lock, flags); 2002 si = fc_get_scsi_internal(lport);
2003 spin_lock_irqsave(&si->scsi_queue_lock, flags);
2010 fsp = CMD_SP(sc_cmd); 2004 fsp = CMD_SP(sc_cmd);
2011 if (!fsp) { 2005 if (!fsp) {
2012 /* command completed while scsi eh was setting up */ 2006 /* command completed while scsi eh was setting up */
@@ -2015,7 +2009,7 @@ int fc_eh_abort(struct scsi_cmnd *sc_cmd)
2015 } 2009 }
2016 /* grab a ref so the fsp and sc_cmd cannot be relased from under us */ 2010 /* grab a ref so the fsp and sc_cmd cannot be relased from under us */
2017 fc_fcp_pkt_hold(fsp); 2011 fc_fcp_pkt_hold(fsp);
2018 spin_unlock_irqrestore(lport->host->host_lock, flags); 2012 spin_unlock_irqrestore(&si->scsi_queue_lock, flags);
2019 2013
2020 if (fc_fcp_lock_pkt(fsp)) { 2014 if (fc_fcp_lock_pkt(fsp)) {
2021 /* completed while we were waiting for timer to be deleted */ 2015 /* completed while we were waiting for timer to be deleted */