Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1499657 > unrolled thread
| Started by | Johannes Thumshirn <jthumshirn@suse.de> |
|---|---|
| First post | 2016-10-12 15:10 +0200 |
| Last post | 2016-10-13 18:30 +0200 |
| Articles | 17 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH v2 00/16] Convert FibreChannel bsg code to use bsg-lib Johannes Thumshirn <jthumshirn@suse.de> - 2016-10-12 15:10 +0200
[PATCH v2 11/16] scsi: fc: Use bsg_destroy_job Johannes Thumshirn <jthumshirn@suse.de> - 2016-10-12 15:20 +0200
[PATCH v2 03/16] scsi: fc: Export fc_bsg_jobdone and use it in FC drivers Johannes Thumshirn <jthumshirn@suse.de> - 2016-10-12 15:20 +0200
Re: [PATCH v2 03/16] scsi: fc: Export fc_bsg_jobdone and use it in FC drivers Hannes Reinecke <hare@suse.de> - 2016-10-13 13:30 +0200
[PATCH v2 08/16] scsi: fc: implement kref backed reference counting Johannes Thumshirn <jthumshirn@suse.de> - 2016-10-12 15:20 +0200
Re: [PATCH v2 08/16] scsi: fc: implement kref backed reference counting Hannes Reinecke <hare@suse.de> - 2016-10-13 13:50 +0200
Re: [PATCH v2 08/16] scsi: fc: implement kref backed reference counting Johannes Thumshirn <jthumshirn@suse.de> - 2016-10-13 16:50 +0200
[PATCH v2 04/16] scsi: Unify interfaces of fc_bsg_jobdone and bsg_job_done Johannes Thumshirn <jthumshirn@suse.de> - 2016-10-12 15:20 +0200
[PATCH v2 06/16] scsi: fc: provide fc_bsg_to_rport() helper Johannes Thumshirn <jthumshirn@suse.de> - 2016-10-12 15:20 +0200
[PATCH v2 09/16] block: add reference counting for struct bsg_job Johannes Thumshirn <jthumshirn@suse.de> - 2016-10-12 15:20 +0200
[PATCH v2 07/16] scsi: libfc: don't set FC_RQST_STATE_DONE before calling fc_bsg_jobdone() Johannes Thumshirn <jthumshirn@suse.de> - 2016-10-12 15:20 +0200
[PATCH v2 05/16] scsi: fc: provide fc_bsg_to_shost() helper Johannes Thumshirn <jthumshirn@suse.de> - 2016-10-12 15:20 +0200
Re: [PATCH v2 00/16] Convert FibreChannel bsg code to use bsg-lib Steffen Maier <maier@linux.vnet.ibm.com> - 2016-10-12 21:50 +0200
Re: [PATCH v2 00/16] Convert FibreChannel bsg code to use bsg-lib Johannes Thumshirn <jthumshirn@suse.de> - 2016-10-13 10:30 +0200
Re: [PATCH v2 02/16] scsi: don't use fc_bsg_job::request and fc_bsg_job::reply directly Hannes Reinecke <hare@suse.de> - 2016-10-13 13:30 +0200
Re: [PATCH v2 02/16] scsi: don't use fc_bsg_job::request and fc_bsg_job::reply directly Steffen Maier <maier@linux.vnet.ibm.com> - 2016-10-13 17:20 +0200
Re: [PATCH v2 02/16] scsi: don't use fc_bsg_job::request and fc_bsg_job::reply directly Johannes Thumshirn <jthumshirn@suse.de> - 2016-10-13 18:30 +0200
| From | Johannes Thumshirn <jthumshirn@suse.de> |
|---|---|
| Date | 2016-10-12 15:10 +0200 |
| Subject | [PATCH v2 00/16] Convert FibreChannel bsg code to use bsg-lib |
| Message-ID | <srrsd-4OM-17@gated-at.bofh.it> |
This series converts the current bsg usage in the FibreChannel drivers over
to use bsg-lib. SAS will follow once FC is in a good enough shape.
I did take some inspiration from a similar patchset from Mike Christie
dating back to 2011 but it's not a 1:1 copy. Patch 15/16 is heavily based
on his series and attribution is given to him in the commit message.
It is currently regression tested on FCoE using the 'fcns' and
'fcrls' utilities. I'm still trying to figure out how to test the other
LLDDs. So any pointer from the respective maintainers are appreciated
although the LLDD changes are purely mechanical. All they do is change from
'struct fc_bsg_job' to 'struct bsg_job' and corresponding changes in order
to get the series bisectable.
The idea for this change arose when discussing racy sysfs handling the FC
bsg code with Christoph and is a next step in moving all bsg clients to
bsg-lib to eventually clean up the in kernel bsg API.
Changes to v1:
* Reduce the number of individual patches (44 -> 16)
* Fix s390 build failure (forgotten to kill fc_bsg_job from zfcp_ext.h)
* Fix build failure on configs without CONFIG_BLK_DEV_BSGLIB
* Make bsg_job_get() call kref_get_unless_zero() and use it in scsi_transport_fc.c
Johannes Thumshirn (16):
scsi: Get rid of struct fc_bsg_buffer
scsi: don't use fc_bsg_job::request and fc_bsg_job::reply directly
scsi: fc: Export fc_bsg_jobdone and use it in FC drivers
scsi: Unify interfaces of fc_bsg_jobdone and bsg_job_done
scsi: fc: provide fc_bsg_to_shost() helper
scsi: fc: provide fc_bsg_to_rport() helper
scsi: libfc: don't set FC_RQST_STATE_DONE before calling
fc_bsg_jobdone()
scsi: fc: implement kref backed reference counting
block: add reference counting for struct bsg_job
scsi: change FC drivers to use 'struct bsg_job'
scsi: fc: Use bsg_destroy_job
scsi: fc: use bsg_softirq_done
scsi: fc: use bsg_job_done
block: add bsg_job_put() and bsg_job_get()
scsi: fc: move FC transport's bsg code to bsg-lib
block: unexport bsg_softirq_done() again
block/bsg-lib.c | 19 +-
drivers/s390/scsi/zfcp_ext.h | 4 +-
drivers/s390/scsi/zfcp_fc.c | 33 +--
drivers/scsi/Kconfig | 1 +
drivers/scsi/bfa/bfad_bsg.c | 62 +++---
drivers/scsi/bfa/bfad_im.h | 4 +-
drivers/scsi/ibmvscsi/ibmvfc.c | 40 ++--
drivers/scsi/libfc/fc_lport.c | 47 ++--
drivers/scsi/lpfc/lpfc_bsg.c | 375 +++++++++++++++++++-------------
drivers/scsi/lpfc/lpfc_crtn.h | 4 +-
drivers/scsi/qla2xxx/qla_bsg.c | 449 ++++++++++++++++++++++-----------------
drivers/scsi/qla2xxx/qla_def.h | 2 +-
drivers/scsi/qla2xxx/qla_gbl.h | 4 +-
drivers/scsi/qla2xxx/qla_iocb.c | 13 +-
drivers/scsi/qla2xxx/qla_isr.c | 52 +++--
drivers/scsi/qla2xxx/qla_mr.c | 15 +-
drivers/scsi/scsi_transport_fc.c | 409 ++++++-----------------------------
include/linux/bsg-lib.h | 4 +
include/scsi/libfc.h | 2 +-
include/scsi/scsi_transport_fc.h | 62 ++----
20 files changed, 745 insertions(+), 856 deletions(-)
--
1.8.5.6
[toc] | [next] | [standalone]
| From | Johannes Thumshirn <jthumshirn@suse.de> |
|---|---|
| Date | 2016-10-12 15:20 +0200 |
| Subject | [PATCH v2 11/16] scsi: fc: Use bsg_destroy_job |
| Message-ID | <srrBT-4SP-5@gated-at.bofh.it> |
| In reply to | #1499657 |
fc_destroy_bsgjob() and bsg_destroy_job() are now 1:1 copies, so use the
later.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
block/bsg-lib.c | 3 ++-
drivers/scsi/scsi_transport_fc.c | 20 ++------------------
include/linux/bsg-lib.h | 1 +
3 files changed, 5 insertions(+), 19 deletions(-)
diff --git a/block/bsg-lib.c b/block/bsg-lib.c
index 632fb40..6b99c7f 100644
--- a/block/bsg-lib.c
+++ b/block/bsg-lib.c
@@ -32,7 +32,7 @@
* bsg_destroy_job - routine to teardown/delete a bsg job
* @job: bsg_job that is to be torn down
*/
-static void bsg_destroy_job(struct kref *kref)
+void bsg_destroy_job(struct kref *kref)
{
struct bsg_job *job = container_of(kref, struct bsg_job, kref);
@@ -42,6 +42,7 @@ static void bsg_destroy_job(struct kref *kref)
kfree(job->reply_payload.sg_list);
kfree(job);
}
+EXPORT_SYMBOL_GPL(bsg_destroy_job);
/**
* bsg_job_done - completion routine for bsg requests
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index a0e150a..4b9324f 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -30,6 +30,7 @@
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/kernel.h>
+#include <linux/bsg-lib.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_transport.h>
@@ -3554,23 +3555,6 @@ fc_vport_sched_delete(struct work_struct *work)
* BSG support
*/
-
-/**
- * fc_destroy_bsgjob - routine to teardown/delete a fc bsg job
- * @job: fc_bsg_job that is to be torn down
- */
-static void
-fc_destroy_bsgjob(struct kref *kref)
-{
- struct bsg_job *job = container_of(kref, struct bsg_job, kref);
-
- put_device(job->dev); /* release reference for the request */
-
- kfree(job->request_payload.sg_list);
- kfree(job->reply_payload.sg_list);
- kfree(job);
-}
-
/**
* fc_bsg_jobdone - completion routine for bsg requests that the LLD has
* completed
@@ -3640,7 +3624,7 @@ fc_bsg_job_timeout(struct request *req)
/* call LLDD to abort the i/o as it has timed out */
err = i->f->bsg_timeout(job);
if (err == -EAGAIN) {
- kref_put(&job->kref, fc_destroy_bsgjob);
+ kref_put(&job->kref, bsg_destroy_job);
return BLK_EH_RESET_TIMER;
} else if (err)
printk(KERN_ERR "ERROR: FC BSG request timeout - LLD "
diff --git a/include/linux/bsg-lib.h b/include/linux/bsg-lib.h
index 58e0717..67f7de6 100644
--- a/include/linux/bsg-lib.h
+++ b/include/linux/bsg-lib.h
@@ -69,5 +69,6 @@ void bsg_job_done(struct bsg_job *job, int result,
int bsg_setup_queue(struct device *dev, struct request_queue *q, char *name,
bsg_job_fn *job_fn, int dd_job_size);
void bsg_request_fn(struct request_queue *q);
+void bsg_destroy_job(struct kref *kref);
#endif
--
1.8.5.6
[toc] | [prev] | [next] | [standalone]
| From | Johannes Thumshirn <jthumshirn@suse.de> |
|---|---|
| Date | 2016-10-12 15:20 +0200 |
| Subject | [PATCH v2 03/16] scsi: fc: Export fc_bsg_jobdone and use it in FC drivers |
| Message-ID | <srrBT-4SP-13@gated-at.bofh.it> |
| In reply to | #1499657 |
Export fc_bsg_jobdone so drivers can use it directly instead of doing
the round-trip via struct fc_bsg_job::job_done() and use it in the LLDDs.
As we've converted all LLDDs over to use fc_bsg_jobdone() directly,
we can remove the function pointer from struct fc_bsg_job as well.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
drivers/s390/scsi/zfcp_fc.c | 2 +-
drivers/scsi/bfa/bfad_bsg.c | 4 ++--
drivers/scsi/ibmvscsi/ibmvfc.c | 2 +-
drivers/scsi/libfc/fc_lport.c | 4 ++--
drivers/scsi/lpfc/lpfc_bsg.c | 38 +++++++++++++++++-----------------
drivers/scsi/qla2xxx/qla_bsg.c | 44 ++++++++++++++++++++--------------------
drivers/scsi/scsi_transport_fc.c | 5 ++---
include/scsi/scsi_transport_fc.h | 2 +-
8 files changed, 50 insertions(+), 51 deletions(-)
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index 4c4023f..40d8f06 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -892,7 +892,7 @@ static void zfcp_fc_ct_els_job_handler(void *data)
jr->reply_payload_rcv_len = job->reply_payload.payload_len;
jr->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK;
jr->result = zfcp_ct_els->status ? -EIO : 0;
- job->job_done(job);
+ fc_bsg_jobdone(job);
}
static struct zfcp_fc_wka_port *zfcp_fc_job_wka_port(struct fc_bsg_job *job)
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c
index 48366d8..25889b9 100644
--- a/drivers/scsi/bfa/bfad_bsg.c
+++ b/drivers/scsi/bfa/bfad_bsg.c
@@ -3180,7 +3180,7 @@ bfad_im_bsg_vendor_request(struct fc_bsg_job *job)
bsg_reply->reply_payload_rcv_len = job->reply_payload.payload_len;
bsg_reply->result = rc;
- job->job_done(job);
+ fc_bsg_jobdone(job);
return rc;
error:
/* free the command buffer */
@@ -3556,7 +3556,7 @@ out:
bsg_reply->result = rc;
if (rc == BFA_STATUS_OK)
- job->job_done(job);
+ fc_bsg_jobdone(job);
return rc;
}
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 8b55279..21c9d28 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -1939,7 +1939,7 @@ static int ibmvfc_bsg_request(struct fc_bsg_job *job)
ibmvfc_free_event(evt);
spin_unlock_irqrestore(vhost->host->host_lock, flags);
bsg_reply->result = rc;
- job->job_done(job);
+ fc_bsg_jobdone(job);
rc = 0;
out:
dma_unmap_sg(vhost->dev, job->request_payload.sg_list,
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index a1c12e7..8811fe0 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -1912,7 +1912,7 @@ static void fc_lport_bsg_resp(struct fc_seq *sp, struct fc_frame *fp,
-ECONNABORTED : -ETIMEDOUT;
job->reply_len = sizeof(uint32_t);
job->state_flags |= FC_RQST_STATE_DONE;
- job->job_done(job);
+ fc_bsg_jobdone(job);
kfree(info);
return;
}
@@ -1947,7 +1947,7 @@ static void fc_lport_bsg_resp(struct fc_seq *sp, struct fc_frame *fp,
job->reply_payload.payload_len;
bsg_reply->result = 0;
job->state_flags |= FC_RQST_STATE_DONE;
- job->job_done(job);
+ fc_bsg_jobdone(job);
kfree(info);
}
fc_frame_free(fp);
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index 27b5930..1db9cca 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -371,7 +371,7 @@ lpfc_bsg_send_mgmt_cmd_cmp(struct lpfc_hba *phba,
if (job) {
bsg_reply->result = rc;
- job->job_done(job);
+ fc_bsg_jobdone(job);
}
return;
}
@@ -644,7 +644,7 @@ lpfc_bsg_rport_els_cmp(struct lpfc_hba *phba,
if (job) {
bsg_reply->result = rc;
- job->job_done(job);
+ fc_bsg_jobdone(job);
}
return;
}
@@ -1136,7 +1136,7 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
job->dd_data = NULL;
/* complete the job back to userspace */
spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
- job->job_done(job);
+ fc_bsg_jobdone(job);
spin_lock_irqsave(&phba->ct_ev_lock, flags);
}
}
@@ -1361,7 +1361,7 @@ lpfc_bsg_hba_get_event(struct fc_bsg_job *job)
spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
job->dd_data = NULL;
bsg_reply->result = 0;
- job->job_done(job);
+ fc_bsg_jobdone(job);
return 0;
job_error:
@@ -1458,7 +1458,7 @@ lpfc_issue_ct_rsp_cmp(struct lpfc_hba *phba,
if (job) {
bsg_reply->result = rc;
- job->job_done(job);
+ fc_bsg_jobdone(job);
}
return;
}
@@ -1886,7 +1886,7 @@ job_error:
bsg_reply->result = rc;
/* complete the job back to userspace if no error */
if (rc == 0)
- job->job_done(job);
+ fc_bsg_jobdone(job);
return rc;
}
@@ -2175,7 +2175,7 @@ job_error:
bsg_reply->result = rc;
/* complete the job back to userspace if no error */
if (rc == 0)
- job->job_done(job);
+ fc_bsg_jobdone(job);
return rc;
}
@@ -2289,7 +2289,7 @@ loopback_mode_end_exit:
bsg_reply->result = rc;
/* complete the job back to userspace if no error */
if (rc == 0)
- job->job_done(job);
+ fc_bsg_jobdone(job);
return rc;
}
@@ -2441,7 +2441,7 @@ job_error:
bsg_reply->result = rc;
/* complete the job back to userspace if no error */
if (rc == 0)
- job->job_done(job);
+ fc_bsg_jobdone(job);
return rc;
}
@@ -3301,7 +3301,7 @@ loopback_test_exit:
job->dd_data = NULL;
/* complete the job back to userspace if no error */
if (rc == IOCB_SUCCESS)
- job->job_done(job);
+ fc_bsg_jobdone(job);
return rc;
}
@@ -3344,7 +3344,7 @@ lpfc_bsg_get_dfc_rev(struct fc_bsg_job *job)
job_error:
bsg_reply->result = rc;
if (rc == 0)
- job->job_done(job);
+ fc_bsg_jobdone(job);
return rc;
}
@@ -3409,7 +3409,7 @@ lpfc_bsg_issue_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
if (job) {
bsg_reply->result = 0;
- job->job_done(job);
+ fc_bsg_jobdone(job);
}
return;
}
@@ -3655,7 +3655,7 @@ lpfc_bsg_issue_read_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
/* if the job is still active, call job done */
if (job)
- job->job_done(job);
+ fc_bsg_jobdone(job);
return;
}
@@ -3690,7 +3690,7 @@ lpfc_bsg_issue_write_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
/* if the job is still active, call job done */
if (job)
- job->job_done(job);
+ fc_bsg_jobdone(job);
return;
}
@@ -4131,7 +4131,7 @@ lpfc_bsg_sli_cfg_write_cmd_ext(struct lpfc_hba *phba, struct fc_bsg_job *job,
/* wait for additoinal external buffers */
bsg_reply->result = 0;
- job->job_done(job);
+ fc_bsg_jobdone(job);
return SLI_CONFIG_HANDLED;
job_error:
@@ -4357,7 +4357,7 @@ lpfc_bsg_read_ebuf_get(struct lpfc_hba *phba, struct fc_bsg_job *job)
}
bsg_reply->result = 0;
- job->job_done(job);
+ fc_bsg_jobdone(job);
return SLI_CONFIG_HANDLED;
}
@@ -4473,7 +4473,7 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct fc_bsg_job *job,
/* wait for additoinal external buffers */
bsg_reply->result = 0;
- job->job_done(job);
+ fc_bsg_jobdone(job);
return SLI_CONFIG_HANDLED;
job_error:
@@ -4941,7 +4941,7 @@ lpfc_bsg_mbox_cmd(struct fc_bsg_job *job)
/* job done */
bsg_reply->result = 0;
job->dd_data = NULL;
- job->job_done(job);
+ fc_bsg_jobdone(job);
} else if (rc == 1)
/* job submitted, will complete later*/
rc = 0; /* return zero, no error */
@@ -5051,7 +5051,7 @@ lpfc_bsg_menlo_cmd_cmp(struct lpfc_hba *phba,
if (job) {
bsg_reply->result = rc;
- job->job_done(job);
+ fc_bsg_jobdone(job);
}
return;
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 40f7c10..1bca77b 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -20,7 +20,7 @@ qla2x00_bsg_job_done(void *data, void *ptr, int res)
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
bsg_reply->result = res;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
sp->free(vha, sp);
}
@@ -242,7 +242,7 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job)
}
exit_fcp_prio_cfg:
if (!ret)
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
return ret;
}
@@ -939,7 +939,7 @@ done_unmap_req_sg:
bsg_job->request_payload.sg_list,
bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
if (!rval)
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
return rval;
}
@@ -972,7 +972,7 @@ qla84xx_reset(struct fc_bsg_job *bsg_job)
ql_dbg(ql_dbg_user, vha, 0x7031,
"Vendor request 84xx reset completed.\n");
bsg_reply->result = DID_OK;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
}
return rval;
@@ -1085,7 +1085,7 @@ done_unmap_sg:
bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
if (!rval)
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
return rval;
}
@@ -1282,7 +1282,7 @@ exit_mgmt:
dma_pool_free(ha->s_dma_pool, mn, mn_dma);
if (!rval)
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
return rval;
}
@@ -1368,7 +1368,7 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)
}
bsg_reply->result = DID_OK;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
}
return rval;
@@ -1476,7 +1476,7 @@ qla2x00_read_optrom(struct fc_bsg_job *bsg_job)
ha->optrom_buffer = NULL;
ha->optrom_state = QLA_SWAITING;
mutex_unlock(&ha->optrom_mutex);
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
return rval;
}
@@ -1511,7 +1511,7 @@ qla2x00_update_optrom(struct fc_bsg_job *bsg_job)
ha->optrom_buffer = NULL;
ha->optrom_state = QLA_SWAITING;
mutex_unlock(&ha->optrom_mutex);
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
return rval;
}
@@ -1561,7 +1561,7 @@ dealloc:
done:
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
return 0;
}
@@ -1610,7 +1610,7 @@ done:
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->reply_payload_rcv_len = sizeof(*sr);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
return 0;
}
@@ -1655,7 +1655,7 @@ dealloc:
done:
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
return 0;
}
@@ -1699,7 +1699,7 @@ dealloc:
done:
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
return 0;
}
@@ -1747,7 +1747,7 @@ done:
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->reply_payload_rcv_len = sizeof(*i2c);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
return 0;
}
@@ -1925,7 +1925,7 @@ done:
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->reply_payload_rcv_len = 0;
bsg_reply->result = (DID_OK) << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
/* Always return success, vendor rsp carries correct status */
return 0;
}
@@ -2090,7 +2090,7 @@ qla26xx_serdes_op(struct fc_bsg_job *bsg_job)
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
return 0;
}
@@ -2131,7 +2131,7 @@ qla8044_serdes_op(struct fc_bsg_job *bsg_job)
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
return 0;
}
@@ -2162,7 +2162,7 @@ qla27xx_get_flash_upd_cap(struct fc_bsg_job *bsg_job)
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
return 0;
}
@@ -2207,7 +2207,7 @@ qla27xx_set_flash_upd_cap(struct fc_bsg_job *bsg_job)
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
return 0;
}
@@ -2265,7 +2265,7 @@ done:
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
return 0;
}
@@ -2321,7 +2321,7 @@ qla2x00_get_priv_stats(struct fc_bsg_job *bsg_job)
bsg_job->reply_len = sizeof(*bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
dma_free_coherent(&ha->pdev->dev, sizeof(*stats),
stats, stats_dma);
@@ -2364,7 +2364,7 @@ qla2x00_do_dport_diagnostics(struct fc_bsg_job *bsg_job)
bsg_job->reply_len = sizeof(*bsg_reply);
bsg_reply->result = DID_OK << 16;
- bsg_job->job_done(bsg_job);
+ fc_bsg_jobdone(bsg_job);
kfree(dd);
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index eafc7555..4149dac 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -3583,8 +3583,7 @@ fc_destroy_bsgjob(struct fc_bsg_job *job)
* completed
* @job: fc_bsg_job that is complete
*/
-static void
-fc_bsg_jobdone(struct fc_bsg_job *job)
+void fc_bsg_jobdone(struct fc_bsg_job *job)
{
struct request *req = job->req;
struct request *rsp = req->next_rq;
@@ -3611,6 +3610,7 @@ fc_bsg_jobdone(struct fc_bsg_job *job)
}
blk_complete_request(req);
}
+EXPORT_SYMBOL_GPL(fc_bsg_jobdone);
/**
* fc_bsg_softirq_done - softirq done routine for destroying the bsg requests
@@ -3744,7 +3744,6 @@ fc_req_to_bsgjob(struct Scsi_Host *shost, struct fc_rport *rport,
if (ret)
goto failjob_rls_rqst_payload;
}
- job->job_done = fc_bsg_jobdone;
if (rport)
job->dev = &rport->dev;
else
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 921b097..9ef583f 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -637,7 +637,6 @@ struct fc_bsg_job {
spinlock_t job_lock;
unsigned int state_flags;
unsigned int ref_cnt;
- void (*job_done)(struct fc_bsg_job *);
struct fc_bsg_request *request;
struct fc_bsg_reply *reply;
@@ -842,5 +841,6 @@ struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
struct fc_vport_identifiers *);
int fc_vport_terminate(struct fc_vport *vport);
int fc_block_scsi_eh(struct scsi_cmnd *cmnd);
+void fc_bsg_jobdone(struct fc_bsg_job *job);
#endif /* SCSI_TRANSPORT_FC_H */
--
1.8.5.6
[toc] | [prev] | [next] | [standalone]
| From | Hannes Reinecke <hare@suse.de> |
|---|---|
| Date | 2016-10-13 13:30 +0200 |
| Subject | Re: [PATCH v2 03/16] scsi: fc: Export fc_bsg_jobdone and use it in FC drivers |
| Message-ID | <srMn0-2Ty-7@gated-at.bofh.it> |
| In reply to | #1499664 |
On 10/12/2016 03:06 PM, Johannes Thumshirn wrote: > Export fc_bsg_jobdone so drivers can use it directly instead of doing > the round-trip via struct fc_bsg_job::job_done() and use it in the LLDDs. > > As we've converted all LLDDs over to use fc_bsg_jobdone() directly, > we can remove the function pointer from struct fc_bsg_job as well. > > Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> > --- > drivers/s390/scsi/zfcp_fc.c | 2 +- > drivers/scsi/bfa/bfad_bsg.c | 4 ++-- > drivers/scsi/ibmvscsi/ibmvfc.c | 2 +- > drivers/scsi/libfc/fc_lport.c | 4 ++-- > drivers/scsi/lpfc/lpfc_bsg.c | 38 +++++++++++++++++----------------- > drivers/scsi/qla2xxx/qla_bsg.c | 44 ++++++++++++++++++++-------------------- > drivers/scsi/scsi_transport_fc.c | 5 ++--- > include/scsi/scsi_transport_fc.h | 2 +- > 8 files changed, 50 insertions(+), 51 deletions(-) > Reviewed-by: Hannes Reinecke <hare@suse.com> Cheers, Hannes -- Dr. Hannes Reinecke Teamlead Storage & Networking hare@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
[toc] | [prev] | [next] | [standalone]
| From | Johannes Thumshirn <jthumshirn@suse.de> |
|---|---|
| Date | 2016-10-12 15:20 +0200 |
| Subject | [PATCH v2 08/16] scsi: fc: implement kref backed reference counting |
| Message-ID | <srrBT-4SP-19@gated-at.bofh.it> |
| In reply to | #1499657 |
Implement kref backed reference counting instead of rolling our own. This
elimnates the need of the following fields in 'struct fc_bsg_job':
* ref_cnt
* state_flags
* job_lock
bringing us close to unification of 'struct fc_bsg_job' and 'struct bsg_job'.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
drivers/scsi/scsi_transport_fc.c | 38 +++++++++-----------------------------
include/scsi/scsi_transport_fc.h | 4 +---
2 files changed, 10 insertions(+), 32 deletions(-)
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 96b3a2e..b0e28af 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -3560,16 +3560,9 @@ fc_vport_sched_delete(struct work_struct *work)
* @job: fc_bsg_job that is to be torn down
*/
static void
-fc_destroy_bsgjob(struct fc_bsg_job *job)
+fc_destroy_bsgjob(struct kref *kref)
{
- unsigned long flags;
-
- spin_lock_irqsave(&job->job_lock, flags);
- if (job->ref_cnt) {
- spin_unlock_irqrestore(&job->job_lock, flags);
- return;
- }
- spin_unlock_irqrestore(&job->job_lock, flags);
+ struct fc_bsg_job *job = container_of(kref, struct fc_bsg_job, kref);
put_device(job->dev); /* release reference for the request */
@@ -3620,15 +3613,9 @@ EXPORT_SYMBOL_GPL(fc_bsg_jobdone);
static void fc_bsg_softirq_done(struct request *rq)
{
struct fc_bsg_job *job = rq->special;
- unsigned long flags;
-
- spin_lock_irqsave(&job->job_lock, flags);
- job->state_flags |= FC_RQST_STATE_DONE;
- job->ref_cnt--;
- spin_unlock_irqrestore(&job->job_lock, flags);
blk_end_request_all(rq, rq->errors);
- fc_destroy_bsgjob(job);
+ kref_put(&job->kref, fc_destroy_bsgjob);
}
/**
@@ -3642,24 +3629,18 @@ fc_bsg_job_timeout(struct request *req)
struct Scsi_Host *shost = fc_bsg_to_shost(job);
struct fc_rport *rport = fc_bsg_to_rport(job);
struct fc_internal *i = to_fc_internal(shost->transportt);
- unsigned long flags;
- int err = 0, done = 0;
+ int err = 0, inflight = 0;
if (rport && rport->port_state == FC_PORTSTATE_BLOCKED)
return BLK_EH_RESET_TIMER;
- spin_lock_irqsave(&job->job_lock, flags);
- if (job->state_flags & FC_RQST_STATE_DONE)
- done = 1;
- else
- job->ref_cnt++;
- spin_unlock_irqrestore(&job->job_lock, flags);
+ inflight = kref_get_unless_zero(&job->kref);
- if (!done && i->f->bsg_timeout) {
+ if (inflight && i->f->bsg_timeout) {
/* call LLDD to abort the i/o as it has timed out */
err = i->f->bsg_timeout(job);
if (err == -EAGAIN) {
- job->ref_cnt--;
+ kref_put(&job->kref, fc_destroy_bsgjob);
return BLK_EH_RESET_TIMER;
} else if (err)
printk(KERN_ERR "ERROR: FC BSG request timeout - LLD "
@@ -3667,7 +3648,7 @@ fc_bsg_job_timeout(struct request *req)
}
/* the blk_end_sync_io() doesn't check the error */
- if (done)
+ if (!inflight)
return BLK_EH_NOT_HANDLED;
else
return BLK_EH_HANDLED;
@@ -3730,7 +3711,6 @@ fc_req_to_bsgjob(struct Scsi_Host *shost, struct fc_rport *rport,
job->req = req;
if (i->f->dd_bsg_size)
job->dd_data = (void *)&job[1];
- spin_lock_init(&job->job_lock);
bsg_request = (struct fc_bsg_request *)req->cmd;
job->request_len = req->cmd_len;
bsg_reply = req->sense;
@@ -3752,7 +3732,7 @@ fc_req_to_bsgjob(struct Scsi_Host *shost, struct fc_rport *rport,
job->dev = &shost->shost_gendev;
get_device(job->dev); /* take a reference for the request */
- job->ref_cnt = 1;
+ kref_init(&job->kref);
return 0;
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 9f53fe3..8ae5680 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -634,9 +634,7 @@ struct fc_bsg_job {
struct fc_rport *rport;
struct device *dev;
struct request *req;
- spinlock_t job_lock;
- unsigned int state_flags;
- unsigned int ref_cnt;
+ struct kref kref;
struct fc_bsg_request *request;
struct fc_bsg_reply *reply;
--
1.8.5.6
[toc] | [prev] | [next] | [standalone]
| From | Hannes Reinecke <hare@suse.de> |
|---|---|
| Date | 2016-10-13 13:50 +0200 |
| Subject | Re: [PATCH v2 08/16] scsi: fc: implement kref backed reference counting |
| Message-ID | <srMGm-30B-15@gated-at.bofh.it> |
| In reply to | #1499666 |
On 10/12/2016 03:06 PM, Johannes Thumshirn wrote:
> Implement kref backed reference counting instead of rolling our own. This
> elimnates the need of the following fields in 'struct fc_bsg_job':
> * ref_cnt
> * state_flags
> * job_lock
> bringing us close to unification of 'struct fc_bsg_job' and 'struct bsg_job'.
>
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
> drivers/scsi/scsi_transport_fc.c | 38 +++++++++-----------------------------
> include/scsi/scsi_transport_fc.h | 4 +---
> 2 files changed, 10 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
> index 96b3a2e..b0e28af 100644
> --- a/drivers/scsi/scsi_transport_fc.c
> +++ b/drivers/scsi/scsi_transport_fc.c
> @@ -3560,16 +3560,9 @@ fc_vport_sched_delete(struct work_struct *work)
> * @job: fc_bsg_job that is to be torn down
> */
> static void
> -fc_destroy_bsgjob(struct fc_bsg_job *job)
> +fc_destroy_bsgjob(struct kref *kref)
> {
> - unsigned long flags;
> -
> - spin_lock_irqsave(&job->job_lock, flags);
> - if (job->ref_cnt) {
> - spin_unlock_irqrestore(&job->job_lock, flags);
> - return;
> - }
> - spin_unlock_irqrestore(&job->job_lock, flags);
> + struct fc_bsg_job *job = container_of(kref, struct fc_bsg_job, kref);
>
> put_device(job->dev); /* release reference for the request */
>
> @@ -3620,15 +3613,9 @@ EXPORT_SYMBOL_GPL(fc_bsg_jobdone);
> static void fc_bsg_softirq_done(struct request *rq)
> {
> struct fc_bsg_job *job = rq->special;
> - unsigned long flags;
> -
> - spin_lock_irqsave(&job->job_lock, flags);
> - job->state_flags |= FC_RQST_STATE_DONE;
> - job->ref_cnt--;
> - spin_unlock_irqrestore(&job->job_lock, flags);
>
> blk_end_request_all(rq, rq->errors);
> - fc_destroy_bsgjob(job);
> + kref_put(&job->kref, fc_destroy_bsgjob);
> }
>
> /**
Hmm. blk_end_request_all() (potentially) triggers a recursion into all
.end_io callbacks, which might end up doing god-knows-what.
With some delays in doing so
During that time we have no idea that bsg_softirq_done() is actually
running, and we might clash with eg. timeouts or somesuch.
Maybe it's an idea to move blk_end_request_all into the kref destroy
callback; that way we're guaranteed to call it only once and would avoid
this situation.
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
[toc] | [prev] | [next] | [standalone]
| From | Johannes Thumshirn <jthumshirn@suse.de> |
|---|---|
| Date | 2016-10-13 16:50 +0200 |
| Subject | Re: [PATCH v2 08/16] scsi: fc: implement kref backed reference counting |
| Message-ID | <srPux-4ML-15@gated-at.bofh.it> |
| In reply to | #1500209 |
On Thu, Oct 13, 2016 at 01:42:06PM +0200, Hannes Reinecke wrote:
> On 10/12/2016 03:06 PM, Johannes Thumshirn wrote:
> > Implement kref backed reference counting instead of rolling our own. This
> > elimnates the need of the following fields in 'struct fc_bsg_job':
> > * ref_cnt
> > * state_flags
> > * job_lock
> > bringing us close to unification of 'struct fc_bsg_job' and 'struct bsg_job'.
> >
> > Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> > ---
> > drivers/scsi/scsi_transport_fc.c | 38 +++++++++-----------------------------
> > include/scsi/scsi_transport_fc.h | 4 +---
> > 2 files changed, 10 insertions(+), 32 deletions(-)
> >
> > diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
> > index 96b3a2e..b0e28af 100644
> > --- a/drivers/scsi/scsi_transport_fc.c
> > +++ b/drivers/scsi/scsi_transport_fc.c
> > @@ -3560,16 +3560,9 @@ fc_vport_sched_delete(struct work_struct *work)
> > * @job: fc_bsg_job that is to be torn down
> > */
> > static void
> > -fc_destroy_bsgjob(struct fc_bsg_job *job)
> > +fc_destroy_bsgjob(struct kref *kref)
> > {
> > - unsigned long flags;
> > -
> > - spin_lock_irqsave(&job->job_lock, flags);
> > - if (job->ref_cnt) {
> > - spin_unlock_irqrestore(&job->job_lock, flags);
> > - return;
> > - }
> > - spin_unlock_irqrestore(&job->job_lock, flags);
> > + struct fc_bsg_job *job = container_of(kref, struct fc_bsg_job, kref);
> >
> > put_device(job->dev); /* release reference for the request */
> >
> > @@ -3620,15 +3613,9 @@ EXPORT_SYMBOL_GPL(fc_bsg_jobdone);
> > static void fc_bsg_softirq_done(struct request *rq)
> > {
> > struct fc_bsg_job *job = rq->special;
> > - unsigned long flags;
> > -
> > - spin_lock_irqsave(&job->job_lock, flags);
> > - job->state_flags |= FC_RQST_STATE_DONE;
> > - job->ref_cnt--;
> > - spin_unlock_irqrestore(&job->job_lock, flags);
> >
> > blk_end_request_all(rq, rq->errors);
> > - fc_destroy_bsgjob(job);
> > + kref_put(&job->kref, fc_destroy_bsgjob);
> > }
> >
> > /**
> Hmm. blk_end_request_all() (potentially) triggers a recursion into all
> .end_io callbacks, which might end up doing god-knows-what.
> With some delays in doing so
> During that time we have no idea that bsg_softirq_done() is actually
> running, and we might clash with eg. timeouts or somesuch.
>
> Maybe it's an idea to move blk_end_request_all into the kref destroy
> callback; that way we're guaranteed to call it only once and would avoid
> this situation.
This _could_ explain the panic with zfcp. Fixed that for v3.
--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
[toc] | [prev] | [next] | [standalone]
| From | Johannes Thumshirn <jthumshirn@suse.de> |
|---|---|
| Date | 2016-10-12 15:20 +0200 |
| Subject | [PATCH v2 04/16] scsi: Unify interfaces of fc_bsg_jobdone and bsg_job_done |
| Message-ID | <srrBT-4SP-7@gated-at.bofh.it> |
| In reply to | #1499657 |
Unify the interfaces of fc_bsg_jobdone and bsg_job_done. This will reduce the
diff when moving from 'struct fc_bsg_job' to a plain 'struct bsg_job' later
on.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
drivers/s390/scsi/zfcp_fc.c | 2 +-
drivers/scsi/bfa/bfad_bsg.c | 6 ++--
drivers/scsi/ibmvscsi/ibmvfc.c | 3 +-
drivers/scsi/libfc/fc_lport.c | 6 ++--
drivers/scsi/lpfc/lpfc_bsg.c | 68 +++++++++++++++++++++++++++-------------
drivers/scsi/qla2xxx/qla_bsg.c | 66 +++++++++++++++++++++++++-------------
drivers/scsi/scsi_transport_fc.c | 22 +++++++------
include/scsi/scsi_transport_fc.h | 3 +-
8 files changed, 116 insertions(+), 60 deletions(-)
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index 40d8f06..87f6330 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -892,7 +892,7 @@ static void zfcp_fc_ct_els_job_handler(void *data)
jr->reply_payload_rcv_len = job->reply_payload.payload_len;
jr->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK;
jr->result = zfcp_ct_els->status ? -EIO : 0;
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, jr->result, jr->reply_payload_rcv_len);
}
static struct zfcp_fc_wka_port *zfcp_fc_job_wka_port(struct fc_bsg_job *job)
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c
index 25889b9..e49a6c8 100644
--- a/drivers/scsi/bfa/bfad_bsg.c
+++ b/drivers/scsi/bfa/bfad_bsg.c
@@ -3180,7 +3180,8 @@ bfad_im_bsg_vendor_request(struct fc_bsg_job *job)
bsg_reply->reply_payload_rcv_len = job->reply_payload.payload_len;
bsg_reply->result = rc;
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rc;
error:
/* free the command buffer */
@@ -3556,7 +3557,8 @@ out:
bsg_reply->result = rc;
if (rc == BFA_STATUS_OK)
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rc;
}
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 21c9d28..1001d4a 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -1939,7 +1939,8 @@ static int ibmvfc_bsg_request(struct fc_bsg_job *job)
ibmvfc_free_event(evt);
spin_unlock_irqrestore(vhost->host->host_lock, flags);
bsg_reply->result = rc;
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
rc = 0;
out:
dma_unmap_sg(vhost->dev, job->request_payload.sg_list,
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 8811fe0..4bed7ec 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -1912,7 +1912,8 @@ static void fc_lport_bsg_resp(struct fc_seq *sp, struct fc_frame *fp,
-ECONNABORTED : -ETIMEDOUT;
job->reply_len = sizeof(uint32_t);
job->state_flags |= FC_RQST_STATE_DONE;
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
kfree(info);
return;
}
@@ -1947,7 +1948,8 @@ static void fc_lport_bsg_resp(struct fc_seq *sp, struct fc_frame *fp,
job->reply_payload.payload_len;
bsg_reply->result = 0;
job->state_flags |= FC_RQST_STATE_DONE;
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
kfree(info);
}
fc_frame_free(fp);
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index 1db9cca..447a7af 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -371,7 +371,8 @@ lpfc_bsg_send_mgmt_cmd_cmp(struct lpfc_hba *phba,
if (job) {
bsg_reply->result = rc;
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
}
return;
}
@@ -644,7 +645,8 @@ lpfc_bsg_rport_els_cmp(struct lpfc_hba *phba,
if (job) {
bsg_reply->result = rc;
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
}
return;
}
@@ -1136,7 +1138,8 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
job->dd_data = NULL;
/* complete the job back to userspace */
spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
spin_lock_irqsave(&phba->ct_ev_lock, flags);
}
}
@@ -1361,7 +1364,8 @@ lpfc_bsg_hba_get_event(struct fc_bsg_job *job)
spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
job->dd_data = NULL;
bsg_reply->result = 0;
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
job_error:
@@ -1458,7 +1462,8 @@ lpfc_issue_ct_rsp_cmp(struct lpfc_hba *phba,
if (job) {
bsg_reply->result = rc;
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
}
return;
}
@@ -1886,7 +1891,8 @@ job_error:
bsg_reply->result = rc;
/* complete the job back to userspace if no error */
if (rc == 0)
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rc;
}
@@ -2175,7 +2181,8 @@ job_error:
bsg_reply->result = rc;
/* complete the job back to userspace if no error */
if (rc == 0)
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rc;
}
@@ -2289,7 +2296,8 @@ loopback_mode_end_exit:
bsg_reply->result = rc;
/* complete the job back to userspace if no error */
if (rc == 0)
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rc;
}
@@ -2441,7 +2449,8 @@ job_error:
bsg_reply->result = rc;
/* complete the job back to userspace if no error */
if (rc == 0)
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rc;
}
@@ -3301,7 +3310,8 @@ loopback_test_exit:
job->dd_data = NULL;
/* complete the job back to userspace if no error */
if (rc == IOCB_SUCCESS)
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rc;
}
@@ -3344,7 +3354,8 @@ lpfc_bsg_get_dfc_rev(struct fc_bsg_job *job)
job_error:
bsg_reply->result = rc;
if (rc == 0)
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rc;
}
@@ -3409,7 +3420,8 @@ lpfc_bsg_issue_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
if (job) {
bsg_reply->result = 0;
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
}
return;
}
@@ -3635,6 +3647,7 @@ static void
lpfc_bsg_issue_read_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
{
struct fc_bsg_job *job;
+ struct fc_bsg_reply *bsg_reply;
job = lpfc_bsg_issue_mbox_ext_handle_job(phba, pmboxq);
@@ -3654,9 +3667,11 @@ lpfc_bsg_issue_read_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
mempool_free(pmboxq, phba->mbox_mem_pool);
/* if the job is still active, call job done */
- if (job)
- fc_bsg_jobdone(job);
-
+ if (job) {
+ bsg_reply = job->reply;
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
+ }
return;
}
@@ -3672,6 +3687,7 @@ static void
lpfc_bsg_issue_write_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
{
struct fc_bsg_job *job;
+ struct fc_bsg_reply *bsg_reply;
job = lpfc_bsg_issue_mbox_ext_handle_job(phba, pmboxq);
@@ -3689,8 +3705,11 @@ lpfc_bsg_issue_write_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
lpfc_bsg_mbox_ext_session_reset(phba);
/* if the job is still active, call job done */
- if (job)
- fc_bsg_jobdone(job);
+ if (job) {
+ bsg_reply = job->reply;
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
+ }
return;
}
@@ -4131,7 +4150,8 @@ lpfc_bsg_sli_cfg_write_cmd_ext(struct lpfc_hba *phba, struct fc_bsg_job *job,
/* wait for additoinal external buffers */
bsg_reply->result = 0;
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return SLI_CONFIG_HANDLED;
job_error:
@@ -4357,7 +4377,8 @@ lpfc_bsg_read_ebuf_get(struct lpfc_hba *phba, struct fc_bsg_job *job)
}
bsg_reply->result = 0;
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return SLI_CONFIG_HANDLED;
}
@@ -4473,7 +4494,8 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct fc_bsg_job *job,
/* wait for additoinal external buffers */
bsg_reply->result = 0;
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return SLI_CONFIG_HANDLED;
job_error:
@@ -4941,7 +4963,8 @@ lpfc_bsg_mbox_cmd(struct fc_bsg_job *job)
/* job done */
bsg_reply->result = 0;
job->dd_data = NULL;
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
} else if (rc == 1)
/* job submitted, will complete later*/
rc = 0; /* return zero, no error */
@@ -5051,7 +5074,8 @@ lpfc_bsg_menlo_cmd_cmp(struct lpfc_hba *phba,
if (job) {
bsg_reply->result = rc;
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
}
return;
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 1bca77b..9293d5a 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -20,7 +20,8 @@ qla2x00_bsg_job_done(void *data, void *ptr, int res)
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
bsg_reply->result = res;
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
sp->free(vha, sp);
}
@@ -242,7 +243,8 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job)
}
exit_fcp_prio_cfg:
if (!ret)
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return ret;
}
@@ -939,7 +941,8 @@ done_unmap_req_sg:
bsg_job->request_payload.sg_list,
bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
if (!rval)
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rval;
}
@@ -972,7 +975,8 @@ qla84xx_reset(struct fc_bsg_job *bsg_job)
ql_dbg(ql_dbg_user, vha, 0x7031,
"Vendor request 84xx reset completed.\n");
bsg_reply->result = DID_OK;
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
}
return rval;
@@ -1085,7 +1089,8 @@ done_unmap_sg:
bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
if (!rval)
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rval;
}
@@ -1282,7 +1287,8 @@ exit_mgmt:
dma_pool_free(ha->s_dma_pool, mn, mn_dma);
if (!rval)
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rval;
}
@@ -1368,7 +1374,8 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)
}
bsg_reply->result = DID_OK;
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
}
return rval;
@@ -1476,7 +1483,8 @@ qla2x00_read_optrom(struct fc_bsg_job *bsg_job)
ha->optrom_buffer = NULL;
ha->optrom_state = QLA_SWAITING;
mutex_unlock(&ha->optrom_mutex);
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rval;
}
@@ -1511,7 +1519,8 @@ qla2x00_update_optrom(struct fc_bsg_job *bsg_job)
ha->optrom_buffer = NULL;
ha->optrom_state = QLA_SWAITING;
mutex_unlock(&ha->optrom_mutex);
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return rval;
}
@@ -1561,7 +1570,8 @@ dealloc:
done:
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
@@ -1610,7 +1620,8 @@ done:
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->reply_payload_rcv_len = sizeof(*sr);
bsg_reply->result = DID_OK << 16;
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
@@ -1655,7 +1666,8 @@ dealloc:
done:
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
@@ -1699,7 +1711,8 @@ dealloc:
done:
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
@@ -1747,7 +1760,8 @@ done:
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->reply_payload_rcv_len = sizeof(*i2c);
bsg_reply->result = DID_OK << 16;
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
@@ -1925,7 +1939,8 @@ done:
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->reply_payload_rcv_len = 0;
bsg_reply->result = (DID_OK) << 16;
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
/* Always return success, vendor rsp carries correct status */
return 0;
}
@@ -2090,7 +2105,8 @@ qla26xx_serdes_op(struct fc_bsg_job *bsg_job)
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
@@ -2131,7 +2147,8 @@ qla8044_serdes_op(struct fc_bsg_job *bsg_job)
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
@@ -2162,7 +2179,8 @@ qla27xx_get_flash_upd_cap(struct fc_bsg_job *bsg_job)
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
@@ -2207,7 +2225,8 @@ qla27xx_set_flash_upd_cap(struct fc_bsg_job *bsg_job)
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
@@ -2265,7 +2284,8 @@ done:
bsg_job->reply_len = sizeof(struct fc_bsg_reply);
bsg_reply->result = DID_OK << 16;
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return 0;
}
@@ -2321,7 +2341,8 @@ qla2x00_get_priv_stats(struct fc_bsg_job *bsg_job)
bsg_job->reply_len = sizeof(*bsg_reply);
bsg_reply->result = DID_OK << 16;
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
dma_free_coherent(&ha->pdev->dev, sizeof(*stats),
stats, stats_dma);
@@ -2364,7 +2385,8 @@ qla2x00_do_dport_diagnostics(struct fc_bsg_job *bsg_job)
bsg_job->reply_len = sizeof(*bsg_reply);
bsg_reply->result = DID_OK << 16;
- fc_bsg_jobdone(bsg_job);
+ fc_bsg_jobdone(bsg_job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
kfree(dd);
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 4149dac..9744476 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -3582,15 +3582,17 @@ fc_destroy_bsgjob(struct fc_bsg_job *job)
* fc_bsg_jobdone - completion routine for bsg requests that the LLD has
* completed
* @job: fc_bsg_job that is complete
+ * @result: job reply result
+ * @reply_payload_rcv_len: length of payload received
*/
-void fc_bsg_jobdone(struct fc_bsg_job *job)
+void fc_bsg_jobdone(struct fc_bsg_job *job, int result,
+ unsigned int reply_payload_rcv_len)
{
struct request *req = job->req;
struct request *rsp = req->next_rq;
- struct fc_bsg_reply *bsg_reply = job->reply;
int err;
- err = job->req->errors = bsg_reply->result;
+ err = job->req->errors = result;
if (err < 0)
/* we're only returning the result field in the reply */
@@ -3602,11 +3604,10 @@ void fc_bsg_jobdone(struct fc_bsg_job *job)
req->resid_len = 0;
if (rsp) {
- WARN_ON(bsg_reply->reply_payload_rcv_len > rsp->resid_len);
+ WARN_ON(reply_payload_rcv_len > rsp->resid_len);
/* set reply (bidi) residual */
- rsp->resid_len -= min(bsg_reply->reply_payload_rcv_len,
- rsp->resid_len);
+ rsp->resid_len -= min(reply_payload_rcv_len, rsp->resid_len);
}
blk_complete_request(req);
}
@@ -3847,7 +3848,8 @@ fail_host_msg:
bsg_reply->reply_payload_rcv_len = 0;
bsg_reply->result = ret;
job->reply_len = sizeof(uint32_t);
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return FC_DISPATCH_UNLOCKED;
}
@@ -3924,7 +3926,8 @@ fail_rport_msg:
bsg_reply->reply_payload_rcv_len = 0;
bsg_reply->result = ret;
job->reply_len = sizeof(uint32_t);
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
return FC_DISPATCH_UNLOCKED;
}
@@ -3984,7 +3987,8 @@ fc_bsg_request_handler(struct request_queue *q, struct Scsi_Host *shost,
bsg_reply->reply_payload_rcv_len = 0;
bsg_reply->result = -ENOMSG;
job->reply_len = sizeof(uint32_t);
- fc_bsg_jobdone(job);
+ fc_bsg_jobdone(job, bsg_reply->result,
+ bsg_reply->reply_payload_rcv_len);
spin_lock_irq(q->queue_lock);
continue;
}
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 9ef583f..eca8ed7 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -841,6 +841,7 @@ struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
struct fc_vport_identifiers *);
int fc_vport_terminate(struct fc_vport *vport);
int fc_block_scsi_eh(struct scsi_cmnd *cmnd);
-void fc_bsg_jobdone(struct fc_bsg_job *job);
+void fc_bsg_jobdone(struct fc_bsg_job *job, int result,
+ unsigned int reply_payload_rcv_len);
#endif /* SCSI_TRANSPORT_FC_H */
--
1.8.5.6
[toc] | [prev] | [next] | [standalone]
| From | Johannes Thumshirn <jthumshirn@suse.de> |
|---|---|
| Date | 2016-10-12 15:20 +0200 |
| Subject | [PATCH v2 06/16] scsi: fc: provide fc_bsg_to_rport() helper |
| Message-ID | <srrBT-4SP-27@gated-at.bofh.it> |
| In reply to | #1499657 |
Provide fc_bsg_to_rport() helper that will become handy when we're moving
from struct fc_bsg_job to a plain struct bsg_job. Also move all LLDDs to use
the new helper.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
drivers/s390/scsi/zfcp_fc.c | 5 +++--
drivers/scsi/ibmvscsi/ibmvfc.c | 2 +-
drivers/scsi/libfc/fc_lport.c | 4 ++--
drivers/scsi/lpfc/lpfc_bsg.c | 4 ++--
drivers/scsi/qla2xxx/qla_bsg.c | 4 ++--
drivers/scsi/scsi_transport_fc.c | 3 ++-
include/scsi/scsi_transport_fc.h | 5 +++++
7 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index 813c286..1977a66 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -938,7 +938,7 @@ static int zfcp_fc_exec_els_job(struct fc_bsg_job *job,
struct zfcp_adapter *adapter)
{
struct zfcp_fsf_ct_els *els = job->dd_data;
- struct fc_rport *rport = job->rport;
+ struct fc_rport *rport = fc_bsg_to_rport(job);
struct fc_bsg_request *bsg_request = job->request;
struct zfcp_port *port;
u32 d_id;
@@ -986,8 +986,9 @@ int zfcp_fc_exec_bsg_job(struct fc_bsg_job *job)
struct zfcp_adapter *adapter;
struct zfcp_fsf_ct_els *ct_els = job->dd_data;
struct fc_bsg_request *bsg_request = job->request;
+ struct fc_rport *rport = fc_bsg_to_rport(job);
- shost = job->rport ? rport_to_shost(job->rport) : fc_bsg_to_shost(job);
+ shost = rport ? rport_to_shost(rport) : fc_bsg_to_shost(job);
adapter = (struct zfcp_adapter *)shost->hostdata[0];
if (!(atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_OPEN))
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index f7b50af..35114d9 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -1816,7 +1816,7 @@ unlock_out:
static int ibmvfc_bsg_request(struct fc_bsg_job *job)
{
struct ibmvfc_host *vhost = shost_priv(fc_bsg_to_shost(job));
- struct fc_rport *rport = job->rport;
+ struct fc_rport *rport = fc_bsg_to_rport(job);
struct ibmvfc_passthru_mad *mad;
struct ibmvfc_event *evt;
union ibmvfc_iu rsp_iu;
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index c60fdb9..156708a 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -2102,7 +2102,7 @@ int fc_lport_bsg_request(struct fc_bsg_job *job)
switch (bsg_request->msgcode) {
case FC_BSG_RPT_ELS:
- rport = job->rport;
+ rport = fc_bsg_to_rport(job);
if (!rport)
break;
@@ -2112,7 +2112,7 @@ int fc_lport_bsg_request(struct fc_bsg_job *job)
break;
case FC_BSG_RPT_CT:
- rport = job->rport;
+ rport = fc_bsg_to_rport(job);
if (!rport)
break;
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index bfcc37d..dae7cc3 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -386,7 +386,7 @@ lpfc_bsg_send_mgmt_cmd(struct fc_bsg_job *job)
{
struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct lpfc_hba *phba = vport->phba;
- struct lpfc_rport_data *rdata = job->rport->dd_data;
+ struct lpfc_rport_data *rdata = fc_bsg_to_rport(job)->dd_data;
struct lpfc_nodelist *ndlp = rdata->pnode;
struct fc_bsg_reply *bsg_reply = job->reply;
struct ulp_bde64 *bpl = NULL;
@@ -660,7 +660,7 @@ lpfc_bsg_rport_els(struct fc_bsg_job *job)
{
struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct lpfc_hba *phba = vport->phba;
- struct lpfc_rport_data *rdata = job->rport->dd_data;
+ struct lpfc_rport_data *rdata = fc_bsg_to_rport(job)->dd_data;
struct lpfc_nodelist *ndlp = rdata->pnode;
struct fc_bsg_request *bsg_request = job->request;
struct fc_bsg_reply *bsg_reply = job->reply;
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 109b852..917eafe 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -264,7 +264,7 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job)
uint16_t nextlid = 0;
if (bsg_request->msgcode == FC_BSG_RPT_ELS) {
- rport = bsg_job->rport;
+ rport = fc_bsg_to_rport(bsg_job);
fcport = *(fc_port_t **) rport->dd_data;
host = rport_to_shost(rport);
vha = shost_priv(host);
@@ -2485,7 +2485,7 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job)
bsg_reply->reply_payload_rcv_len = 0;
if (bsg_request->msgcode == FC_BSG_RPT_ELS) {
- rport = bsg_job->rport;
+ rport = fc_bsg_to_rport(bsg_job);
host = rport_to_shost(rport);
vha = shost_priv(host);
} else {
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index d6d18ce..96b3a2e 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -3640,11 +3640,12 @@ fc_bsg_job_timeout(struct request *req)
{
struct fc_bsg_job *job = (void *) req->special;
struct Scsi_Host *shost = fc_bsg_to_shost(job);
+ struct fc_rport *rport = fc_bsg_to_rport(job);
struct fc_internal *i = to_fc_internal(shost->transportt);
unsigned long flags;
int err = 0, done = 0;
- if (job->rport && job->rport->port_state == FC_PORTSTATE_BLOCKED)
+ if (rport && rport->port_state == FC_PORTSTATE_BLOCKED)
return BLK_EH_RESET_TIMER;
spin_lock_irqsave(&job->job_lock, flags);
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index efb9488..9f53fe3 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -824,6 +824,11 @@ static inline struct Scsi_Host *fc_bsg_to_shost(struct fc_bsg_job *job)
return job->shost;
}
+static inline struct fc_rport *fc_bsg_to_rport(struct fc_bsg_job *job)
+{
+ return job->rport;
+}
+
struct scsi_transport_template *fc_attach_transport(
struct fc_function_template *);
void fc_release_transport(struct scsi_transport_template *);
--
1.8.5.6
[toc] | [prev] | [next] | [standalone]
| From | Johannes Thumshirn <jthumshirn@suse.de> |
|---|---|
| Date | 2016-10-12 15:20 +0200 |
| Subject | [PATCH v2 09/16] block: add reference counting for struct bsg_job |
| Message-ID | <srrBU-4SP-41@gated-at.bofh.it> |
| In reply to | #1499657 |
Add reference counting to 'struct bsg_job' so we can implement a reuqest
timeout handler for bsg_jobs, which is needed for Fibre Channel.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
block/bsg-lib.c | 7 +++++--
include/linux/bsg-lib.h | 2 ++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/block/bsg-lib.c b/block/bsg-lib.c
index 650f427..632fb40 100644
--- a/block/bsg-lib.c
+++ b/block/bsg-lib.c
@@ -32,8 +32,10 @@
* bsg_destroy_job - routine to teardown/delete a bsg job
* @job: bsg_job that is to be torn down
*/
-static void bsg_destroy_job(struct bsg_job *job)
+static void bsg_destroy_job(struct kref *kref)
{
+ struct bsg_job *job = container_of(kref, struct bsg_job, kref);
+
put_device(job->dev); /* release reference for the request */
kfree(job->request_payload.sg_list);
@@ -84,7 +86,7 @@ static void bsg_softirq_done(struct request *rq)
struct bsg_job *job = rq->special;
blk_end_request_all(rq, rq->errors);
- bsg_destroy_job(job);
+ kref_put(&job->kref, bsg_destroy_job);
}
static int bsg_map_buffer(struct bsg_buffer *buf, struct request *req)
@@ -142,6 +144,7 @@ static int bsg_create_job(struct device *dev, struct request *req)
job->dev = dev;
/* take a reference for the request */
get_device(job->dev);
+ kref_init(&job->kref);
return 0;
failjob_rls_rqst_payload:
diff --git a/include/linux/bsg-lib.h b/include/linux/bsg-lib.h
index a226652..58e0717 100644
--- a/include/linux/bsg-lib.h
+++ b/include/linux/bsg-lib.h
@@ -40,6 +40,8 @@ struct bsg_job {
struct device *dev;
struct request *req;
+ struct kref kref;
+
/* Transport/driver specific request/reply structs */
void *request;
void *reply;
--
1.8.5.6
[toc] | [prev] | [next] | [standalone]
| From | Johannes Thumshirn <jthumshirn@suse.de> |
|---|---|
| Date | 2016-10-12 15:20 +0200 |
| Subject | [PATCH v2 07/16] scsi: libfc: don't set FC_RQST_STATE_DONE before calling fc_bsg_jobdone() |
| Message-ID | <srrBT-4SP-29@gated-at.bofh.it> |
| In reply to | #1499657 |
Don't set FC_RQST_STATE_DONE before calling fc_bsg_jobdone() as fc_bsg_jobdone() calls blk_complete_requeust() which raises a soft-IRQ that ends up in fc_bsg_sofirq_done() and fc_bsg_softirq_done() sets the FC_RQST_STATE_DONE flag. Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> --- drivers/scsi/libfc/fc_lport.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index 156708a..53d13721 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c @@ -1911,7 +1911,6 @@ static void fc_lport_bsg_resp(struct fc_seq *sp, struct fc_frame *fp, bsg_reply->result = (PTR_ERR(fp) == -FC_EX_CLOSED) ? -ECONNABORTED : -ETIMEDOUT; job->reply_len = sizeof(uint32_t); - job->state_flags |= FC_RQST_STATE_DONE; fc_bsg_jobdone(job, bsg_reply->result, bsg_reply->reply_payload_rcv_len); kfree(info); @@ -1947,7 +1946,6 @@ static void fc_lport_bsg_resp(struct fc_seq *sp, struct fc_frame *fp, bsg_reply->reply_payload_rcv_len = job->reply_payload.payload_len; bsg_reply->result = 0; - job->state_flags |= FC_RQST_STATE_DONE; fc_bsg_jobdone(job, bsg_reply->result, bsg_reply->reply_payload_rcv_len); kfree(info); -- 1.8.5.6
[toc] | [prev] | [next] | [standalone]
| From | Johannes Thumshirn <jthumshirn@suse.de> |
|---|---|
| Date | 2016-10-12 15:20 +0200 |
| Subject | [PATCH v2 05/16] scsi: fc: provide fc_bsg_to_shost() helper |
| Message-ID | <srrBT-4SP-31@gated-at.bofh.it> |
| In reply to | #1499657 |
Provide fc_bsg_to_shost() helper that will become handy when we're moving from
struct fc_bsg_job to a plain struct bsg_job. Also use this little helper in
the LLDDs.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
drivers/s390/scsi/zfcp_fc.c | 4 +--
drivers/scsi/bfa/bfad_bsg.c | 6 ++---
drivers/scsi/ibmvscsi/ibmvfc.c | 4 +--
drivers/scsi/libfc/fc_lport.c | 2 +-
drivers/scsi/lpfc/lpfc_bsg.c | 32 ++++++++++++------------
drivers/scsi/qla2xxx/qla_bsg.c | 54 ++++++++++++++++++++--------------------
drivers/scsi/scsi_transport_fc.c | 2 +-
include/scsi/scsi_transport_fc.h | 5 ++++
8 files changed, 56 insertions(+), 53 deletions(-)
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index 87f6330..813c286 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -905,7 +905,7 @@ static struct zfcp_fc_wka_port *zfcp_fc_job_wka_port(struct fc_bsg_job *job)
preamble_word1 = bsg_request->rqst_data.r_ct.preamble_word1;
gs_type = (preamble_word1 & 0xff000000) >> 24;
- adapter = (struct zfcp_adapter *) job->shost->hostdata[0];
+ adapter = shost_priv(fc_bsg_to_shost(job));
switch (gs_type) {
case FC_FST_ALIAS:
@@ -987,7 +987,7 @@ int zfcp_fc_exec_bsg_job(struct fc_bsg_job *job)
struct zfcp_fsf_ct_els *ct_els = job->dd_data;
struct fc_bsg_request *bsg_request = job->request;
- shost = job->rport ? rport_to_shost(job->rport) : job->shost;
+ shost = job->rport ? rport_to_shost(job->rport) : fc_bsg_to_shost(job);
adapter = (struct zfcp_adapter *)shost->hostdata[0];
if (!(atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_OPEN))
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c
index e49a6c8..d3094270 100644
--- a/drivers/scsi/bfa/bfad_bsg.c
+++ b/drivers/scsi/bfa/bfad_bsg.c
@@ -3135,8 +3135,7 @@ bfad_im_bsg_vendor_request(struct fc_bsg_job *job)
struct fc_bsg_request *bsg_request = job->request;
struct fc_bsg_reply *bsg_reply = job->reply;
uint32_t vendor_cmd = bsg_request->rqst_data.h_vendor.vendor_cmd[0];
- struct bfad_im_port_s *im_port =
- (struct bfad_im_port_s *) job->shost->hostdata[0];
+ struct bfad_im_port_s *im_port = shost_priv(fc_bsg_to_shost(job));
struct bfad_s *bfad = im_port->bfad;
struct request_queue *request_q = job->req->q;
void *payload_kbuf;
@@ -3358,8 +3357,7 @@ int
bfad_im_bsg_els_ct_request(struct fc_bsg_job *job)
{
struct bfa_bsg_data *bsg_data;
- struct bfad_im_port_s *im_port =
- (struct bfad_im_port_s *) job->shost->hostdata[0];
+ struct bfad_im_port_s *im_port = shost_priv(fc_bsg_to_shost(job));
struct bfad_s *bfad = im_port->bfad;
bfa_bsg_fcpt_t *bsg_fcpt;
struct bfad_fcxp *drv_fcxp;
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 1001d4a..f7b50af 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -1702,7 +1702,7 @@ static void ibmvfc_bsg_timeout_done(struct ibmvfc_event *evt)
**/
static int ibmvfc_bsg_timeout(struct fc_bsg_job *job)
{
- struct ibmvfc_host *vhost = shost_priv(job->shost);
+ struct ibmvfc_host *vhost = shost_priv(fc_bsg_to_shost(job));
unsigned long port_id = (unsigned long)job->dd_data;
struct ibmvfc_event *evt;
struct ibmvfc_tmf *tmf;
@@ -1815,7 +1815,7 @@ unlock_out:
**/
static int ibmvfc_bsg_request(struct fc_bsg_job *job)
{
- struct ibmvfc_host *vhost = shost_priv(job->shost);
+ struct ibmvfc_host *vhost = shost_priv(fc_bsg_to_shost(job));
struct fc_rport *rport = job->rport;
struct ibmvfc_passthru_mad *mad;
struct ibmvfc_event *evt;
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 4bed7ec..c60fdb9 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -2087,7 +2087,7 @@ int fc_lport_bsg_request(struct fc_bsg_job *job)
struct fc_bsg_request *bsg_request = job->request;
struct fc_bsg_reply *bsg_reply = job->reply;
struct request *rsp = job->req->next_rq;
- struct Scsi_Host *shost = job->shost;
+ struct Scsi_Host *shost = fc_bsg_to_shost(job);
struct fc_lport *lport = shost_priv(shost);
struct fc_rport *rport;
struct fc_rport_priv *rdata;
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index 447a7af..bfcc37d 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -384,7 +384,7 @@ lpfc_bsg_send_mgmt_cmd_cmp(struct lpfc_hba *phba,
static int
lpfc_bsg_send_mgmt_cmd(struct fc_bsg_job *job)
{
- struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
+ struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct lpfc_hba *phba = vport->phba;
struct lpfc_rport_data *rdata = job->rport->dd_data;
struct lpfc_nodelist *ndlp = rdata->pnode;
@@ -658,7 +658,7 @@ lpfc_bsg_rport_els_cmp(struct lpfc_hba *phba,
static int
lpfc_bsg_rport_els(struct fc_bsg_job *job)
{
- struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
+ struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct lpfc_hba *phba = vport->phba;
struct lpfc_rport_data *rdata = job->rport->dd_data;
struct lpfc_nodelist *ndlp = rdata->pnode;
@@ -1202,7 +1202,7 @@ lpfc_bsg_ct_unsol_abort(struct lpfc_hba *phba, struct hbq_dmabuf *dmabuf)
static int
lpfc_bsg_hba_set_event(struct fc_bsg_job *job)
{
- struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
+ struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct lpfc_hba *phba = vport->phba;
struct fc_bsg_request *bsg_request = job->request;
struct set_ct_event *event_req;
@@ -1287,7 +1287,7 @@ job_error:
static int
lpfc_bsg_hba_get_event(struct fc_bsg_job *job)
{
- struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
+ struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct lpfc_hba *phba = vport->phba;
struct fc_bsg_request *bsg_request = job->request;
struct fc_bsg_reply *bsg_reply = job->reply;
@@ -1625,7 +1625,7 @@ no_dd_data:
static int
lpfc_bsg_send_mgmt_rsp(struct fc_bsg_job *job)
{
- struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
+ struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct lpfc_hba *phba = vport->phba;
struct fc_bsg_request *bsg_request = job->request;
struct fc_bsg_reply *bsg_reply = job->reply;
@@ -2201,10 +2201,10 @@ lpfc_bsg_diag_loopback_mode(struct fc_bsg_job *job)
struct lpfc_hba *phba;
int rc;
- shost = job->shost;
+ shost = fc_bsg_to_shost(job);
if (!shost)
return -ENODEV;
- vport = (struct lpfc_vport *)job->shost->hostdata;
+ vport = shost_priv(shost);
if (!vport)
return -ENODEV;
phba = vport->phba;
@@ -2241,10 +2241,10 @@ lpfc_sli4_bsg_diag_mode_end(struct fc_bsg_job *job)
uint32_t timeout;
int rc, i;
- shost = job->shost;
+ shost = fc_bsg_to_shost(job);
if (!shost)
return -ENODEV;
- vport = (struct lpfc_vport *)job->shost->hostdata;
+ vport = shost_priv(shost);
if (!vport)
return -ENODEV;
phba = vport->phba;
@@ -2325,12 +2325,12 @@ lpfc_sli4_bsg_link_diag_test(struct fc_bsg_job *job)
struct diag_status *diag_status_reply;
int mbxstatus, rc = 0;
- shost = job->shost;
+ shost = fc_bsg_to_shost(job);
if (!shost) {
rc = -ENODEV;
goto job_error;
}
- vport = (struct lpfc_vport *)job->shost->hostdata;
+ vport = shost_priv(shost);
if (!vport) {
rc = -ENODEV;
goto job_error;
@@ -3018,7 +3018,7 @@ err_post_rxbufs_exit:
static int
lpfc_bsg_diag_loopback_run(struct fc_bsg_job *job)
{
- struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
+ struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct fc_bsg_reply *bsg_reply = job->reply;
struct lpfc_hba *phba = vport->phba;
struct lpfc_bsg_event *evt;
@@ -3322,7 +3322,7 @@ loopback_test_exit:
static int
lpfc_bsg_get_dfc_rev(struct fc_bsg_job *job)
{
- struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
+ struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct fc_bsg_reply *bsg_reply = job->reply;
struct lpfc_hba *phba = vport->phba;
struct get_mgmt_rev_reply *event_reply;
@@ -4933,7 +4933,7 @@ job_cont:
static int
lpfc_bsg_mbox_cmd(struct fc_bsg_job *job)
{
- struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
+ struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct fc_bsg_request *bsg_request = job->request;
struct fc_bsg_reply *bsg_reply = job->reply;
struct lpfc_hba *phba = vport->phba;
@@ -5093,7 +5093,7 @@ lpfc_bsg_menlo_cmd_cmp(struct lpfc_hba *phba,
static int
lpfc_menlo_cmd(struct fc_bsg_job *job)
{
- struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
+ struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct fc_bsg_request *bsg_request = job->request;
struct fc_bsg_reply *bsg_reply = job->reply;
struct lpfc_hba *phba = vport->phba;
@@ -5353,7 +5353,7 @@ lpfc_bsg_request(struct fc_bsg_job *job)
int
lpfc_bsg_timeout(struct fc_bsg_job *job)
{
- struct lpfc_vport *vport = (struct lpfc_vport *)job->shost->hostdata;
+ struct lpfc_vport *vport = shost_priv(fc_bsg_to_shost(job));
struct lpfc_hba *phba = vport->phba;
struct lpfc_iocbq *cmdiocb;
struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING];
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 9293d5a..109b852 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -1,4 +1,4 @@
-/*
+ /*
* QLogic Fibre Channel HBA Driver
* Copyright (c) 2003-2014 QLogic Corporation
*
@@ -122,7 +122,7 @@ qla24xx_fcp_prio_cfg_valid(scsi_qla_host_t *vha,
static int
qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job)
{
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
struct fc_bsg_request *bsg_request = bsg_job->request;
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
scsi_qla_host_t *vha = shost_priv(host);
@@ -271,7 +271,7 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job)
ha = vha->hw;
type = "FC_BSG_RPT_ELS";
} else {
- host = bsg_job->shost;
+ host = fc_bsg_to_shost(bsg_job);
vha = shost_priv(host);
ha = vha->hw;
type = "FC_BSG_HST_ELS_NOLOGIN";
@@ -432,7 +432,7 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job)
{
srb_t *sp;
struct fc_bsg_request *bsg_request = bsg_job->request;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
int rval = (DRIVER_ERROR << 16);
@@ -710,7 +710,7 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_request *bsg_request = bsg_job->request;
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
int rval;
@@ -950,7 +950,7 @@ static int
qla84xx_reset(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_request *bsg_request = bsg_job->request;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
@@ -987,7 +987,7 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_request *bsg_request = bsg_job->request;
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
struct verify_chip_entry_84xx *mn = NULL;
@@ -1099,7 +1099,7 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_request *bsg_request = bsg_job->request;
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
struct access_chip_84xx *mn = NULL;
@@ -1297,7 +1297,7 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_request *bsg_request = bsg_job->request;
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
int rval = 0;
struct qla_port_param *port_param = NULL;
@@ -1455,7 +1455,7 @@ static int
qla2x00_read_optrom(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
int rval = 0;
@@ -1492,7 +1492,7 @@ static int
qla2x00_update_optrom(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
int rval = 0;
@@ -1528,7 +1528,7 @@ static int
qla2x00_update_fru_versions(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
int rval = 0;
@@ -1580,7 +1580,7 @@ static int
qla2x00_read_fru_status(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
int rval = 0;
@@ -1630,7 +1630,7 @@ static int
qla2x00_write_fru_status(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
int rval = 0;
@@ -1676,7 +1676,7 @@ static int
qla2x00_write_i2c(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
int rval = 0;
@@ -1721,7 +1721,7 @@ static int
qla2x00_read_i2c(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
int rval = 0;
@@ -1770,7 +1770,7 @@ static int
qla24xx_process_bidir_cmd(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
uint32_t rval = EXT_STATUS_OK;
@@ -1949,7 +1949,7 @@ static int
qlafx00_mgmt_cmd(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_request *bsg_request = bsg_job->request;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
int rval = (DRIVER_ERROR << 16);
@@ -2072,7 +2072,7 @@ static int
qla26xx_serdes_op(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
int rval = 0;
struct qla_serdes_reg sr;
@@ -2114,7 +2114,7 @@ static int
qla8044_serdes_op(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
int rval = 0;
struct qla_serdes_reg_ex sr;
@@ -2156,7 +2156,7 @@ static int
qla27xx_get_flash_upd_cap(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
struct qla_flash_update_caps cap;
@@ -2188,7 +2188,7 @@ static int
qla27xx_set_flash_upd_cap(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
uint64_t online_fw_attr = 0;
@@ -2234,7 +2234,7 @@ static int
qla27xx_get_bbcr_data(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
struct qla_bbcr_data bbcr;
@@ -2294,7 +2294,7 @@ qla2x00_get_priv_stats(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_request *bsg_request = bsg_job->request;
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
@@ -2354,7 +2354,7 @@ static int
qla2x00_do_dport_diagnostics(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- struct Scsi_Host *host = bsg_job->shost;
+ struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
scsi_qla_host_t *vha = shost_priv(host);
int rval;
struct qla_dport_diag *dd;
@@ -2489,7 +2489,7 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job)
host = rport_to_shost(rport);
vha = shost_priv(host);
} else {
- host = bsg_job->shost;
+ host = fc_bsg_to_shost(bsg_job);
vha = shost_priv(host);
}
@@ -2528,7 +2528,7 @@ int
qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job)
{
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
- scsi_qla_host_t *vha = shost_priv(bsg_job->shost);
+ scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job));
struct qla_hw_data *ha = vha->hw;
srb_t *sp;
int cnt, que;
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 9744476..d6d18ce 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -3639,7 +3639,7 @@ static enum blk_eh_timer_return
fc_bsg_job_timeout(struct request *req)
{
struct fc_bsg_job *job = (void *) req->special;
- struct Scsi_Host *shost = job->shost;
+ struct Scsi_Host *shost = fc_bsg_to_shost(job);
struct fc_internal *i = to_fc_internal(shost->transportt);
unsigned long flags;
int err = 0, done = 0;
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index eca8ed7..efb9488 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -819,6 +819,11 @@ fc_vport_set_state(struct fc_vport *vport, enum fc_vport_state new_state)
vport->vport_state = new_state;
}
+static inline struct Scsi_Host *fc_bsg_to_shost(struct fc_bsg_job *job)
+{
+ return job->shost;
+}
+
struct scsi_transport_template *fc_attach_transport(
struct fc_function_template *);
void fc_release_transport(struct scsi_transport_template *);
--
1.8.5.6
[toc] | [prev] | [next] | [standalone]
| From | Steffen Maier <maier@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-10-12 21:50 +0200 |
| Message-ID | <srxHj-sw-3@gated-at.bofh.it> |
| In reply to | #1499657 |
Hi Johannes, On 10/12/2016 03:06 PM, Johannes Thumshirn wrote: > This series converts the current bsg usage in the FibreChannel drivers over > to use bsg-lib. SAS will follow once FC is in a good enough shape. > > I did take some inspiration from a similar patchset from Mike Christie > dating back to 2011 but it's not a 1:1 copy. Patch 15/16 is heavily based > on his series and attribution is given to him in the commit message. > > It is currently regression tested on FCoE using the 'fcns' and > 'fcrls' utilities. I'm still trying to figure out how to test the other > LLDDs. So any pointer from the respective maintainers are appreciated The first thing that comes to mind for zfcp is libzfcphbaapi and simply run its tools for starters. They issue a few different CT GLS requests. http://www.ibm.com/support/knowledgecenter/linuxonibm/com.ibm.linux.z.lhdd/lhdd_t_fcp_api_runappl.html or http://www.ibm.com/support/knowledgecenter/linuxonibm/com.ibm.linux.z.lgdd/lgdd_t_fcp_api_runappl.html (upstream: http://www.ibm.com/developerworks/linux/linux390/zfcp-hbaapi.html) Theoretically above tools could be built against libHBAAPI on other architectures. Currently I don't have anything handy for ELS requests. Maybe there is some common code tool (possibly building directly on BSG IOCTL) to exercise more code paths? Just as a heads up the result of my example run (need to dig deeper why it crashed): # zfcp_show -n Local Port List: <<<end of ssh output, Linux console following...>>> > [ 799.640378] Oops: 0038 ilc:3 [#1] [ 799.640387] PREEMPT SMP [ 799.640393] > [ 799.640399] Modules linked in: nf_log_ipv6 xt_pkttype nf_log_ipv4 nf_log_common xt_LOG xt_limit ip6t_REJECT nf_reject_ipv6 xt_tcpudp nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT nf_reject_ipv4 iptable_raw xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables ghash_s390 prng ecb aes_s390 des_s390 dm_mod des_generic sha512_s390 sha256_s390 qeth_l2 sha1_s390 qeth zfcp sha_common ccwgroup qdio autofs4 > [ 799.640542] CPU: 1 PID: 2210 Comm: zfcp_show Not tainted 4.8.0fcbsg+ #6 > [ 799.640550] Hardware name: IBM 2964 N96 702 (z/VM) > [ 799.640558] task: 0000000047b60008 task.stack: 0000000062428000 > [ 799.640567] Krnl PSW : 0404e00180000000 00000000001b125c[ 799.640581] (__lock_acquire+0x104/0x7d8) > [ 799.640590] > [ 799.640599] R:0 T:1 IO:0 EX:0 Key:0 M:1 W:0 P:0 AS:3 CC:2 PM:0[ 799.640618] RI:0 EA:3 > [ 799.640621] > [ 799.640621] Krnl GPRS: 0000000000000000 0000000000000008 07f40707c0040000 0000000000000000 > [ 799.640624] 0000000000000000 0000000000000000 0000000000000001 0000000000000000 > [ 799.640627] 0000000000000000 0000000000355cb4 0000000000000000 0000000047b60008 > [ 799.640630] 0300000000000000 00000000009b17b0 000000006242b800 000000006242b778 > [ 799.640643] Krnl Code: 00000000001b124c: b9040029 lgr %r2,%r9 > [ 799.640648] 00000000001b1250: c0e5ffffd6a4 brasl %r14,1abf98 > #00000000001b1256: ec28ffad007c cgij %r2,0,8,1b11b0 > [ 799.640659] >00000000001b125c: eb012198006a asi 408(%r2,1 > 00000000001b1262: 5830ba10 l %r3,2576(%r11) > [ 799.640669] 00000000001b1266: 5030f0a4 st %r3,164(%r15) > 00000000001b126a: c01000e3f9db larl %r1,1e30620 > [ 799.640678] 00000000001b1270: e31010000012 lt %r1,0(%r1) > [ 799.640682] > [ 799.640684] Call Trace: > [ 799.640687] ([<ffffffffffffffff>] 0xffffffffffffffff) > [ 799.640691] ([<00000000001b21f4>] lock_acquire+0x30c/0x358) > [ 799.640699] ([<000000000099fdae>] mutex_lock_interruptible_nested+0x7e/0x4f8) > [ 799.640717] ([<000003ff8047a090>] zfcp_fc_wka_port_get+0x40/0x128 [zfcp]) > [ 799.640724] ([<000003ff8047bd54>] zfcp_fc_exec_bsg_job+0x244/0x2d8 [zfcp]) > [ 799.640732] ([<00000000007c8b1e>] fc_bsg_dispatch+0x20e/0x280) > [ 799.640739] ([<00000000006dea1a>] bsg_request_fn+0x132/0x1e0) > [ 799.640746] ([<00000000006b8e0a>] __blk_run_queue+0x52/0x68) > [ 799.640751] ([<00000000006c549a>] blk_execute_rq_nowait+0xf2/0x110) > [ 799.640754] ([<00000000006c557a>] blk_execute_rq+0xa2/0x110) > [ 799.640757] ([<00000000006de0ee>] bsg_ioctl+0x1f6/0x268) > [ 799.640763] ([<000000000036ca20>] do_vfs_ioctl+0x680/0x6d8) > [ 799.640767] ([<000000000036caf4>] SyS_ioctl+0x7c/0xb0) > [ 799.640771] ([<00000000009a50de>] system_call+0xd6/0x270) > [ 799.640774] INFO: lockdep is turned off. > [ 799.640776] Last Breaking-Event-Address: > [ 799.640779] [<00000000001b1244>] __lock_acquire+0xec/0x7d8 > [ 799.640782] [ 799.640785] Kernel panic - not syncing: Fatal exception: panic_on_oops > although the LLDD changes are purely mechanical. All they do is change from > 'struct fc_bsg_job' to 'struct bsg_job' and corresponding changes in order > to get the series bisectable. > > The idea for this change arose when discussing racy sysfs handling the FC > bsg code with Christoph and is a next step in moving all bsg clients to > bsg-lib to eventually clean up the in kernel bsg API. > > Changes to v1: > * Reduce the number of individual patches (44 -> 16) nice > * Fix s390 build failure (forgotten to kill fc_bsg_job from zfcp_ext.h) I pushed your patches on today's linux.git, i.e. post v4.8 with zfcp fixes of v4.9 merge window already included and it did build with our default_defconfig but qdio and zfcp as modules rather than built-in. > * Make bsg_job_get() call kref_get_unless_zero() and use it in scsi_transport_fc.c Perfect, I had planned to suggest this based on v1 of the patch set. > Johannes Thumshirn (16): > scsi: Get rid of struct fc_bsg_buffer > scsi: don't use fc_bsg_job::request and fc_bsg_job::reply directly > scsi: fc: Export fc_bsg_jobdone and use it in FC drivers > scsi: Unify interfaces of fc_bsg_jobdone and bsg_job_done > scsi: fc: provide fc_bsg_to_shost() helper > scsi: fc: provide fc_bsg_to_rport() helper > scsi: libfc: don't set FC_RQST_STATE_DONE before calling > fc_bsg_jobdone() > scsi: fc: implement kref backed reference counting > block: add reference counting for struct bsg_job > scsi: change FC drivers to use 'struct bsg_job' > scsi: fc: Use bsg_destroy_job > scsi: fc: use bsg_softirq_done > scsi: fc: use bsg_job_done > block: add bsg_job_put() and bsg_job_get() > scsi: fc: move FC transport's bsg code to bsg-lib > block: unexport bsg_softirq_done() again > > block/bsg-lib.c | 19 +- > drivers/s390/scsi/zfcp_ext.h | 4 +- > drivers/s390/scsi/zfcp_fc.c | 33 +-- > drivers/scsi/Kconfig | 1 + > drivers/scsi/bfa/bfad_bsg.c | 62 +++--- > drivers/scsi/bfa/bfad_im.h | 4 +- > drivers/scsi/ibmvscsi/ibmvfc.c | 40 ++-- > drivers/scsi/libfc/fc_lport.c | 47 ++-- > drivers/scsi/lpfc/lpfc_bsg.c | 375 +++++++++++++++++++------------- > drivers/scsi/lpfc/lpfc_crtn.h | 4 +- > drivers/scsi/qla2xxx/qla_bsg.c | 449 ++++++++++++++++++++++----------------- > drivers/scsi/qla2xxx/qla_def.h | 2 +- > drivers/scsi/qla2xxx/qla_gbl.h | 4 +- > drivers/scsi/qla2xxx/qla_iocb.c | 13 +- > drivers/scsi/qla2xxx/qla_isr.c | 52 +++-- > drivers/scsi/qla2xxx/qla_mr.c | 15 +- > drivers/scsi/scsi_transport_fc.c | 409 ++++++----------------------------- > include/linux/bsg-lib.h | 4 + > include/scsi/libfc.h | 2 +- > include/scsi/scsi_transport_fc.h | 62 ++---- > 20 files changed, 745 insertions(+), 856 deletions(-) > -- Mit freundlichen Grüßen / Kind regards Steffen Maier Linux on z Systems Development IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschaeftsfuehrung: Dirk Wittkopp Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
[toc] | [prev] | [next] | [standalone]
| From | Johannes Thumshirn <jthumshirn@suse.de> |
|---|---|
| Date | 2016-10-13 10:30 +0200 |
| Message-ID | <srJyO-120-1@gated-at.bofh.it> |
| In reply to | #1499901 |
On Wed, Oct 12, 2016 at 05:54:45PM +0200, Steffen Maier wrote:
> Hi Johannes,
>
> On 10/12/2016 03:06 PM, Johannes Thumshirn wrote:
> > This series converts the current bsg usage in the FibreChannel drivers over
> > to use bsg-lib. SAS will follow once FC is in a good enough shape.
> >
> > I did take some inspiration from a similar patchset from Mike Christie
> > dating back to 2011 but it's not a 1:1 copy. Patch 15/16 is heavily based
> > on his series and attribution is given to him in the commit message.
> >
> > It is currently regression tested on FCoE using the 'fcns' and
> > 'fcrls' utilities. I'm still trying to figure out how to test the other
> > LLDDs. So any pointer from the respective maintainers are appreciated
>
> The first thing that comes to mind for zfcp is libzfcphbaapi and simply run
> its tools for starters. They issue a few different CT GLS requests.
> http://www.ibm.com/support/knowledgecenter/linuxonibm/com.ibm.linux.z.lhdd/lhdd_t_fcp_api_runappl.html
> or
> http://www.ibm.com/support/knowledgecenter/linuxonibm/com.ibm.linux.z.lgdd/lgdd_t_fcp_api_runappl.html
> (upstream:
> http://www.ibm.com/developerworks/linux/linux390/zfcp-hbaapi.html)
I'll give it a try, thanks. zfcp_show was the 1st hit on Google as well, when
I was looking for a way to test it.
>
> Theoretically above tools could be built against libHBAAPI on other
> architectures.
> Currently I don't have anything handy for ELS requests.
>
> Maybe there is some common code tool (possibly building directly on BSG
> IOCTL) to exercise more code paths?
Yes this is something I had in mind as well and it could become handy later on
anyways.
>
> Just as a heads up the result of my example run (need to dig deeper why it
> crashed):
>
> # zfcp_show -n
>
> Local Port List:
> <<<end of ssh output, Linux console following...>>>
> > [ 799.640378] Oops: 0038 ilc:3 [#1] [ 799.640387] PREEMPT SMP [ 799.640393]
> > [ 799.640399] Modules linked in: nf_log_ipv6 xt_pkttype nf_log_ipv4 nf_log_common xt_LOG xt_limit ip6t_REJECT nf_reject_ipv6 xt_tcpudp nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT nf_reject_ipv4 iptable_raw xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables ghash_s390 prng ecb aes_s390 des_s390 dm_mod des_generic sha512_s390 sha256_s390 qeth_l2 sha1_s390 qeth zfcp sha_common ccwgroup qdio autofs4
> > [ 799.640542] CPU: 1 PID: 2210 Comm: zfcp_show Not tainted 4.8.0fcbsg+ #6
> > [ 799.640550] Hardware name: IBM 2964 N96 702 (z/VM)
> > [ 799.640558] task: 0000000047b60008 task.stack: 0000000062428000
> > [ 799.640567] Krnl PSW : 0404e00180000000 00000000001b125c[ 799.640581] (__lock_acquire+0x104/0x7d8)
> > [ 799.640590]
> > [ 799.640599] R:0 T:1 IO:0 EX:0 Key:0 M:1 W:0 P:0 AS:3 CC:2 PM:0[ 799.640618] RI:0 EA:3
> > [ 799.640621]
> > [ 799.640621] Krnl GPRS: 0000000000000000 0000000000000008 07f40707c0040000 0000000000000000
> > [ 799.640624] 0000000000000000 0000000000000000 0000000000000001 0000000000000000
> > [ 799.640627] 0000000000000000 0000000000355cb4 0000000000000000 0000000047b60008
> > [ 799.640630] 0300000000000000 00000000009b17b0 000000006242b800 000000006242b778
> > [ 799.640643] Krnl Code: 00000000001b124c: b9040029 lgr %r2,%r9
> > [ 799.640648] 00000000001b1250: c0e5ffffd6a4 brasl %r14,1abf98
> > #00000000001b1256: ec28ffad007c cgij %r2,0,8,1b11b0
> > [ 799.640659] >00000000001b125c: eb012198006a asi 408(%r2,1
> > 00000000001b1262: 5830ba10 l %r3,2576(%r11)
> > [ 799.640669] 00000000001b1266: 5030f0a4 st %r3,164(%r15)
> > 00000000001b126a: c01000e3f9db larl %r1,1e30620
> > [ 799.640678] 00000000001b1270: e31010000012 lt %r1,0(%r1)
> > [ 799.640682]
> > [ 799.640684] Call Trace:
> > [ 799.640687] ([<ffffffffffffffff>] 0xffffffffffffffff)
> > [ 799.640691] ([<00000000001b21f4>] lock_acquire+0x30c/0x358)
> > [ 799.640699] ([<000000000099fdae>] mutex_lock_interruptible_nested+0x7e/0x4f8)
> > [ 799.640717] ([<000003ff8047a090>] zfcp_fc_wka_port_get+0x40/0x128 [zfcp])
> > [ 799.640724] ([<000003ff8047bd54>] zfcp_fc_exec_bsg_job+0x244/0x2d8 [zfcp])
> > [ 799.640732] ([<00000000007c8b1e>] fc_bsg_dispatch+0x20e/0x280)
> > [ 799.640739] ([<00000000006dea1a>] bsg_request_fn+0x132/0x1e0)
> > [ 799.640746] ([<00000000006b8e0a>] __blk_run_queue+0x52/0x68)
> > [ 799.640751] ([<00000000006c549a>] blk_execute_rq_nowait+0xf2/0x110)
> > [ 799.640754] ([<00000000006c557a>] blk_execute_rq+0xa2/0x110)
> > [ 799.640757] ([<00000000006de0ee>] bsg_ioctl+0x1f6/0x268)
> > [ 799.640763] ([<000000000036ca20>] do_vfs_ioctl+0x680/0x6d8)
> > [ 799.640767] ([<000000000036caf4>] SyS_ioctl+0x7c/0xb0)
> > [ 799.640771] ([<00000000009a50de>] system_call+0xd6/0x270)
> > [ 799.640774] INFO: lockdep is turned off.
> > [ 799.640776] Last Breaking-Event-Address:
> > [ 799.640779] [<00000000001b1244>] __lock_acquire+0xec/0x7d8
> > [ 799.640782] [ 799.640785] Kernel panic - not syncing: Fatal exception: panic_on_oops
I'll have a look into it. But from a first quick glance over it I must admit I
don't see the problem yet. I could imagine two reasons for it though. One
being the change in the refcounting and one being the patches changing over to
the fc_bsg_to{shost,rport}() helpers. I think a git bisect will help here.
>
>
> > although the LLDD changes are purely mechanical. All they do is change from
> > 'struct fc_bsg_job' to 'struct bsg_job' and corresponding changes in order
> > to get the series bisectable.
> >
> > The idea for this change arose when discussing racy sysfs handling the FC
> > bsg code with Christoph and is a next step in moving all bsg clients to
> > bsg-lib to eventually clean up the in kernel bsg API.
> >
> > Changes to v1:
> > * Reduce the number of individual patches (44 -> 16)
>
> nice
>
> > * Fix s390 build failure (forgotten to kill fc_bsg_job from zfcp_ext.h)
>
> I pushed your patches on today's linux.git, i.e. post v4.8 with zfcp fixes
> of v4.9 merge window already included and it did build with our
> default_defconfig but qdio and zfcp as modules rather than built-in.
Thanks for the feedback.
Johannes
--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
[toc] | [prev] | [next] | [standalone]
| From | Hannes Reinecke <hare@suse.de> |
|---|---|
| Date | 2016-10-13 13:30 +0200 |
| Subject | Re: [PATCH v2 02/16] scsi: don't use fc_bsg_job::request and fc_bsg_job::reply directly |
| Message-ID | <srMn0-2Ty-11@gated-at.bofh.it> |
| In reply to | #1499657 |
On 10/12/2016 03:06 PM, Johannes Thumshirn wrote: > Don't use fc_bsg_job::request and fc_bsg_job::reply directly, but use > helper variables bsg_request and bsg_reply. This will be helpfull when > transitioning to bsg-lib. > > Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> > --- > drivers/s390/scsi/zfcp_fc.c | 9 +- > drivers/scsi/bfa/bfad_bsg.c | 40 +++--- > drivers/scsi/ibmvscsi/ibmvfc.c | 22 ++-- > drivers/scsi/libfc/fc_lport.c | 23 ++-- > drivers/scsi/lpfc/lpfc_bsg.c | 194 +++++++++++++++++----------- > drivers/scsi/qla2xxx/qla_bsg.c | 264 ++++++++++++++++++++++----------------- > drivers/scsi/qla2xxx/qla_iocb.c | 5 +- > drivers/scsi/qla2xxx/qla_isr.c | 46 ++++--- > drivers/scsi/qla2xxx/qla_mr.c | 10 +- > drivers/scsi/scsi_transport_fc.c | 37 +++--- > 10 files changed, 387 insertions(+), 263 deletions(-) > Reviewed-by: Hannes Reinecke <hare@suse.com> Cheers, Hannes -- Dr. Hannes Reinecke Teamlead Storage & Networking hare@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
[toc] | [prev] | [next] | [standalone]
| From | Steffen Maier <maier@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-10-13 17:20 +0200 |
| Subject | Re: [PATCH v2 02/16] scsi: don't use fc_bsg_job::request and fc_bsg_job::reply directly |
| Message-ID | <srPXA-5cV-33@gated-at.bofh.it> |
| In reply to | #1499657 |
I'm puzzled.
$ git bisect start fc_bsg master
Bisecting: 8 revisions left to test after this (roughly 3 steps)
[005d51510eee6102636d5dbb06310531c5d46151] scsi: fc: implement kref
backed reference counting
$ git bisect bad
Bisecting: 3 revisions left to test after this (roughly 2 steps)
[bef6da201de1bb81bb4d9511f9a155862efc251f] scsi: Unify interfaces of
fc_bsg_jobdone and bsg_job_done
$ git bisect bad
Bisecting: 1 revision left to test after this (roughly 1 step)
[3087864ce3d7282f59021245d8a5f83ef1caef18] scsi: don't use
fc_bsg_job::request and fc_bsg_job::reply directly
$ git bisect bad
Bisecting: 0 revisions left to test after this (roughly 0 steps)
[81aea44720d22d2e0c4a2613ae8b1c256ef6b0cb] scsi: Get rid of struct
fc_bsg_buffer
> $ git bisect good
> 3087864ce3d7282f59021245d8a5f83ef1caef18 is the first bad commit
> commit 3087864ce3d7282f59021245d8a5f83ef1caef18
> Author: Johannes Thumshirn <jthumshirn@suse.de>
> Date: Wed Oct 12 15:06:28 2016 +0200
>
> scsi: don't use fc_bsg_job::request and fc_bsg_job::reply directly
>
> Don't use fc_bsg_job::request and fc_bsg_job::reply directly, but use
> helper variables bsg_request and bsg_reply. This will be helpfull when
> transitioning to bsg-lib.
>
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
>
> :040000 040000 140c4b6829d5cfaec4079716e0795f63f8bc3bd2 0d9fe225615679550be91fbd9f84c09ab1e280fc M drivers
From there (on the reverse bisect path) I get the following Oops,
except for the full patch set having another stack trace as in my
previous mail (dying in zfcp code).
> [ 46.942452] Oops: 0004 ilc:2 [#1] [ 46.942460] PREEMPT SMP [ 46.942465]
> [ 46.942470] Modules linked in: nf_log_ipv6 xt_pkttype nf_log_ipv4 nf_log_common xt_LOG xt_limit ip6t_REJECT nf_reject_ipv6 xt_tcpudp nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT nf_reject_ipv4 iptable_raw xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables qeth_l2 ghash_s390 prng ecb aes_s390 des_s390 des_generic sha512_s390 sha256_s390 sha1_s390 sha_common dm_mod qeth ccwgroup zfcp qdio autofs4
> [ 46.942547] CPU: 1 PID: 1714 Comm: zfcp_ping Not tainted 4.8.0fcbsg+ #9
> [ 46.942550] Hardware name: IBM 2964 N96 702 (z/VM)
> [ 46.942556] task: 000000005c988008 task.stack: 000000005d2ec000
> [ 46.942560] Krnl PSW : 0704e00180000000 00000000007c91ec[ 46.942574] (fc_bsg_request_handler+0x404/0x4b0)
> [ 46.942579]
> [ 46.942583] R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:2 PM:000:
> [ 46.942598] RI:0 EA:3
> [ 46.942601]
> [ 46.942601] Krnl GPRS: 0000000000000000 00000000ffffffcb 0000000000000000 0000000080000001
> [ 46.942603] 00000000007c8fe8 0000000064398c68 0000000069f967e8 000000006a3d8008
> [ 46.942605] 000000006a5e02c8 00000000698b5490 0000000000000000 0000000000000000
> [ 46.942607] 000000006a9ef5f8 0000000000a36840 00000000007c8fe8 000000005d2efa00
> [ 46.942619] Krnl Code: 00000000007c91de: e55dc08c0003 clfhsi 140(%r12),3[ 46.942622]
> [ 46.942622] 00000000007c91e4: a7240004 brc 2,7c91ec
> #00000000007c91e8: a7f40001 brc 15,7c91ea[ 46.942629]
> [ 46.942629] >00000000007c91ec: 5010b000 st %r1,0(%r11)
> 00000000007c91f0: e54cb0040000 mvhi 4(%r11),0[ 46.942635]
> [ 46.942635] 00000000007c91f6: e54cc08c0004 mvhi 140(%r12),4
> 00000000007c91fc: b904002c lgr %r2,%r12[ 46.942643]
> [ 46.942643] 00000000007c9200: c0e5ffffe2c0 brasl %r14,7c5780
> [ 46.942646]
> [ 46.942647] Call Trace:
> [ 46.942650] ([<00000000007c8fe8>] fc_bsg_request_handler+0x200/0x4b0)
> [ 46.942656] ([<00000000006b8e0a>] __blk_run_queue+0x52/0x68)
> [ 46.942661] ([<00000000006c549a>] blk_execute_rq_nowait+0xf2/0x110)
> [ 46.942664] ([<00000000006c557a>] blk_execute_rq+0xa2/0x110)
> [ 46.942668] ([<00000000006de0ee>] bsg_ioctl+0x1f6/0x268)
> [ 46.942675] ([<000000000036ca20>] do_vfs_ioctl+0x680/0x6d8)
> [ 46.942677] ([<000000000036caf4>] SyS_ioctl+0x7c/0xb0)
> [ 46.942685] ([<00000000009a541e>] system_call+0xd6/0x270)
> [ 46.942687] INFO: lockdep is turned off.
> [ 46.942688] Last Breaking-Event-Address:
> [ 46.942692] [<00000000007c91e4>] fc_bsg_request_handler+0x3fc/0x4b0
> [ 46.942696] [ 46.942698] Kernel panic - not syncing: Fatal exception: panic_on_oops
On 10/12/2016 03:06 PM, Johannes Thumshirn wrote:
> Don't use fc_bsg_job::request and fc_bsg_job::reply directly, but use
> helper variables bsg_request and bsg_reply. This will be helpfull when
> transitioning to bsg-lib.
>
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
> drivers/s390/scsi/zfcp_fc.c | 9 +-
> drivers/scsi/bfa/bfad_bsg.c | 40 +++---
> drivers/scsi/ibmvscsi/ibmvfc.c | 22 ++--
> drivers/scsi/libfc/fc_lport.c | 23 ++--
> drivers/scsi/lpfc/lpfc_bsg.c | 194 +++++++++++++++++-----------
> drivers/scsi/qla2xxx/qla_bsg.c | 264 ++++++++++++++++++++++-----------------
> drivers/scsi/qla2xxx/qla_iocb.c | 5 +-
> drivers/scsi/qla2xxx/qla_isr.c | 46 ++++---
> drivers/scsi/qla2xxx/qla_mr.c | 10 +-
> drivers/scsi/scsi_transport_fc.c | 37 +++---
> 10 files changed, 387 insertions(+), 263 deletions(-)
> diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
> index 8ff2067..eafc7555 100644
> --- a/drivers/scsi/scsi_transport_fc.c
> +++ b/drivers/scsi/scsi_transport_fc.c
> @@ -3588,9 +3588,10 @@ fc_bsg_jobdone(struct fc_bsg_job *job)
> {
> struct request *req = job->req;
> struct request *rsp = req->next_rq;
> + struct fc_bsg_reply *bsg_reply = job->reply;
> int err;
>
> - err = job->req->errors = job->reply->result;
> + err = job->req->errors = bsg_reply->result;
>
> if (err < 0)
> /* we're only returning the result field in the reply */
> @@ -3602,10 +3603,10 @@ fc_bsg_jobdone(struct fc_bsg_job *job)
> req->resid_len = 0;
>
> if (rsp) {
> - WARN_ON(job->reply->reply_payload_rcv_len > rsp->resid_len);
> + WARN_ON(bsg_reply->reply_payload_rcv_len > rsp->resid_len);
>
> /* set reply (bidi) residual */
> - rsp->resid_len -= min(job->reply->reply_payload_rcv_len,
> + rsp->resid_len -= min(bsg_reply->reply_payload_rcv_len,
> rsp->resid_len);
> }
> blk_complete_request(req);
> @@ -3701,6 +3702,8 @@ fc_req_to_bsgjob(struct Scsi_Host *shost, struct fc_rport *rport,
> struct fc_internal *i = to_fc_internal(shost->transportt);
> struct request *rsp = req->next_rq;
> struct fc_bsg_job *job;
> + struct fc_bsg_request *bsg_request;
> + struct fc_bsg_reply *bsg_reply;
> int ret;
>
> BUG_ON(req->special);
> @@ -3726,9 +3729,9 @@ fc_req_to_bsgjob(struct Scsi_Host *shost, struct fc_rport *rport,
> if (i->f->dd_bsg_size)
> job->dd_data = (void *)&job[1];
> spin_lock_init(&job->job_lock);
> - job->request = (struct fc_bsg_request *)req->cmd;
> + bsg_request = (struct fc_bsg_request *)req->cmd;
> job->request_len = req->cmd_len;
> - job->reply = req->sense;
> + bsg_reply = req->sense;
> job->reply_len = SCSI_SENSE_BUFFERSIZE; /* Size of sense buffer
> * allocated */
> if (req->bio) {
> @@ -3779,11 +3782,13 @@ fc_bsg_host_dispatch(struct request_queue *q, struct Scsi_Host *shost,
> struct fc_bsg_job *job)
> {
> struct fc_internal *i = to_fc_internal(shost->transportt);
> + struct fc_bsg_request *bsg_request = job->request;
> + struct fc_bsg_reply *bsg_reply = job->reply;
> int cmdlen = sizeof(uint32_t); /* start with length of msgcode */
> int ret;
>
> /* Validate the host command */
> - switch (job->request->msgcode) {
> + switch (bsg_request->msgcode) {
> case FC_BSG_HST_ADD_RPORT:
> cmdlen += sizeof(struct fc_bsg_host_add_rport);
> break;
> @@ -3815,7 +3820,7 @@ fc_bsg_host_dispatch(struct request_queue *q, struct Scsi_Host *shost,
> case FC_BSG_HST_VENDOR:
> cmdlen += sizeof(struct fc_bsg_host_vendor);
> if ((shost->hostt->vendor_id == 0L) ||
> - (job->request->rqst_data.h_vendor.vendor_id !=
> + (bsg_request->rqst_data.h_vendor.vendor_id !=
> shost->hostt->vendor_id)) {
> ret = -ESRCH;
> goto fail_host_msg;
> @@ -3840,8 +3845,8 @@ fc_bsg_host_dispatch(struct request_queue *q, struct Scsi_Host *shost,
> fail_host_msg:
> /* return the errno failure code as the only status */
> BUG_ON(job->reply_len < sizeof(uint32_t));
> - job->reply->reply_payload_rcv_len = 0;
> - job->reply->result = ret;
> + bsg_reply->reply_payload_rcv_len = 0;
> + bsg_reply->result = ret;
> job->reply_len = sizeof(uint32_t);
> fc_bsg_jobdone(job);
> return FC_DISPATCH_UNLOCKED;
> @@ -3878,11 +3883,13 @@ fc_bsg_rport_dispatch(struct request_queue *q, struct Scsi_Host *shost,
> struct fc_rport *rport, struct fc_bsg_job *job)
> {
> struct fc_internal *i = to_fc_internal(shost->transportt);
> + struct fc_bsg_request *bsg_request = job->request;
> + struct fc_bsg_reply *bsg_reply = job->reply;
> int cmdlen = sizeof(uint32_t); /* start with length of msgcode */
> int ret;
>
> /* Validate the rport command */
> - switch (job->request->msgcode) {
> + switch (bsg_request->msgcode) {
> case FC_BSG_RPT_ELS:
> cmdlen += sizeof(struct fc_bsg_rport_els);
> goto check_bidi;
> @@ -3915,8 +3922,8 @@ check_bidi:
> fail_rport_msg:
> /* return the errno failure code as the only status */
> BUG_ON(job->reply_len < sizeof(uint32_t));
> - job->reply->reply_payload_rcv_len = 0;
> - job->reply->result = ret;
> + bsg_reply->reply_payload_rcv_len = 0;
> + bsg_reply->result = ret;
> job->reply_len = sizeof(uint32_t);
> fc_bsg_jobdone(job);
> return FC_DISPATCH_UNLOCKED;
> @@ -3937,6 +3944,7 @@ fc_bsg_request_handler(struct request_queue *q, struct Scsi_Host *shost,
> struct request *req;
> struct fc_bsg_job *job;
> enum fc_dispatch_result ret;
> + struct fc_bsg_reply *bsg_reply;
>
> if (!get_device(dev))
> return;
> @@ -3973,8 +3981,9 @@ fc_bsg_request_handler(struct request_queue *q, struct Scsi_Host *shost,
> /* check if we have the msgcode value at least */
> if (job->request_len < sizeof(uint32_t)) {
> BUG_ON(job->reply_len < sizeof(uint32_t));
> - job->reply->reply_payload_rcv_len = 0;
> - job->reply->result = -ENOMSG;
> + bsg_reply = job->reply;
> + bsg_reply->reply_payload_rcv_len = 0;
> + bsg_reply->result = -ENOMSG;
> job->reply_len = sizeof(uint32_t);
> fc_bsg_jobdone(job);
> spin_lock_irq(q->queue_lock);
>
--
Mit freundlichen Grüßen / Kind regards
Steffen Maier
Linux on z Systems Development
IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
[toc] | [prev] | [next] | [standalone]
| From | Johannes Thumshirn <jthumshirn@suse.de> |
|---|---|
| Date | 2016-10-13 18:30 +0200 |
| Subject | Re: [PATCH v2 02/16] scsi: don't use fc_bsg_job::request and fc_bsg_job::reply directly |
| Message-ID | <srR3k-5Qh-49@gated-at.bofh.it> |
| In reply to | #1500350 |
On Thu, Oct 13, 2016 at 05:15:25PM +0200, Steffen Maier wrote:
> I'm puzzled.
>
> $ git bisect start fc_bsg master
> Bisecting: 8 revisions left to test after this (roughly 3 steps)
> [005d51510eee6102636d5dbb06310531c5d46151] scsi: fc: implement kref backed
> reference counting
> $ git bisect bad
> Bisecting: 3 revisions left to test after this (roughly 2 steps)
> [bef6da201de1bb81bb4d9511f9a155862efc251f] scsi: Unify interfaces of
> fc_bsg_jobdone and bsg_job_done
> $ git bisect bad
> Bisecting: 1 revision left to test after this (roughly 1 step)
> [3087864ce3d7282f59021245d8a5f83ef1caef18] scsi: don't use
> fc_bsg_job::request and fc_bsg_job::reply directly
> $ git bisect bad
> Bisecting: 0 revisions left to test after this (roughly 0 steps)
> [81aea44720d22d2e0c4a2613ae8b1c256ef6b0cb] scsi: Get rid of struct
> fc_bsg_buffer
> > $ git bisect good
> > 3087864ce3d7282f59021245d8a5f83ef1caef18 is the first bad commit
> > commit 3087864ce3d7282f59021245d8a5f83ef1caef18
> > Author: Johannes Thumshirn <jthumshirn@suse.de>
> > Date: Wed Oct 12 15:06:28 2016 +0200
> >
> > scsi: don't use fc_bsg_job::request and fc_bsg_job::reply directly
> >
> > Don't use fc_bsg_job::request and fc_bsg_job::reply directly, but use
> > helper variables bsg_request and bsg_reply. This will be helpfull when
> > transitioning to bsg-lib.
> >
> > Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> >
> > :040000 040000 140c4b6829d5cfaec4079716e0795f63f8bc3bd2 0d9fe225615679550be91fbd9f84c09ab1e280fc M drivers
>
> From there (on the reverse bisect path) I get the following Oops,
> except for the full patch set having another stack trace as in my previous
> mail (dying in zfcp code).
>
[...]
>
> > @@ -3937,6 +3944,7 @@ fc_bsg_request_handler(struct request_queue *q, struct Scsi_Host *shost,
> > struct request *req;
> > struct fc_bsg_job *job;
> > enum fc_dispatch_result ret;
> > + struct fc_bsg_reply *bsg_reply;
> >
> > if (!get_device(dev))
> > return;
> > @@ -3973,8 +3981,9 @@ fc_bsg_request_handler(struct request_queue *q, struct Scsi_Host *shost,
> > /* check if we have the msgcode value at least */
> > if (job->request_len < sizeof(uint32_t)) {
> > BUG_ON(job->reply_len < sizeof(uint32_t));
> > - job->reply->reply_payload_rcv_len = 0;
> > - job->reply->result = -ENOMSG;
> > + bsg_reply = job->reply;
> > + bsg_reply->reply_payload_rcv_len = 0;
> > + bsg_reply->result = -ENOMSG;
> > job->reply_len = sizeof(uint32_t);
> > fc_bsg_jobdone(job);
> > spin_lock_irq(q->queue_lock);
> >
Ahm and what exactly can break here? It's just assigning variables. Now
I'm puzzled too.
I'll have to look into it tomorrow.
Byte,
Johannes
--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web