linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/3] Ibmvscsis fixes and code cleanup
@ 2016-08-31 16:28 Bryant G. Ly
  2016-08-31 16:28 ` [PATCH v1 1/3] Ibmvscsis: Properly deregister target sessions Bryant G. Ly
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Bryant G. Ly @ 2016-08-31 16:28 UTC (permalink / raw)
  To: nab, dan.carpenter
  Cc: mikecyr, James.Bottomley, tyreld, brking, seroyer, linux-scsi,
	target-devel, martin.petersen, Bryant G. Ly

Here are some small fixes and cleanups for Ibmvscsis Target Driver.
The only one of significance is the first one where there is a
possibility of a kernel crash due to inproper deregister of target
session since we didn't sync up work and didn't deregister_configfs.

Bryant G. Ly (3):
  Ibmvscsis: Properly deregister target sessions
  Ibmvscsis: Code cleanup of print statements
  Ibmvscsis: Fixed a bug reported by Dan Carpenter

 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 30 +++++-------------------------
 1 file changed, 5 insertions(+), 25 deletions(-)

-- 
2.5.4 (Apple Git-61)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1 1/3] Ibmvscsis: Properly deregister target sessions
  2016-08-31 16:28 [PATCH v1 0/3] Ibmvscsis fixes and code cleanup Bryant G. Ly
@ 2016-08-31 16:28 ` Bryant G. Ly
  2016-08-31 16:29 ` [PATCH v1 2/3] Ibmvscsis: Code cleanup of print statements Bryant G. Ly
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Bryant G. Ly @ 2016-08-31 16:28 UTC (permalink / raw)
  To: nab, dan.carpenter
  Cc: mikecyr, James.Bottomley, tyreld, brking, seroyer, linux-scsi,
	target-devel, martin.petersen, Bryant G. Ly

The driver currently doesn't properly deregisters target sessions
completely, so this will address that.

Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Signed-off-by: Michael Cyr <mikecyr@linux.vnet.ibm.com>
---
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
index b29fef9..a515cdd 100644
--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
@@ -1934,6 +1934,8 @@ static int ibmvscsis_drop_nexus(struct ibmvscsis_tport *tport)
 	/*
 	 * Release the SCSI I_T Nexus to the emulated ibmvscsis Target Port
 	 */
+	target_wait_for_sess_cmds(se_sess);
+	transport_deregister_session_configfs(se_sess);
 	transport_deregister_session(se_sess);
 	tport->ibmv_nexus = NULL;
 	kfree(nexus);
-- 
2.5.4 (Apple Git-61)


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1 2/3] Ibmvscsis: Code cleanup of print statements
  2016-08-31 16:28 [PATCH v1 0/3] Ibmvscsis fixes and code cleanup Bryant G. Ly
  2016-08-31 16:28 ` [PATCH v1 1/3] Ibmvscsis: Properly deregister target sessions Bryant G. Ly
@ 2016-08-31 16:29 ` Bryant G. Ly
  2016-08-31 16:29 ` [PATCH v1 3/3] Ibmvscsis: Fixed a bug reported by Dan Carpenter Bryant G. Ly
  2016-09-02 10:53 ` [PATCH v1 0/3] Ibmvscsis fixes and code cleanup Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Bryant G. Ly @ 2016-08-31 16:29 UTC (permalink / raw)
  To: nab, dan.carpenter
  Cc: mikecyr, James.Bottomley, tyreld, brking, seroyer, linux-scsi,
	target-devel, martin.petersen, Bryant G. Ly

Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Signed-off-by: Michael Cyr <mikecyr@linux.vnet.ibm.com>
---
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 26 ++------------------------
 1 file changed, 2 insertions(+), 24 deletions(-)

diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
index a515cdd..d4c67b9 100644
--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
@@ -1606,8 +1606,6 @@ static void ibmvscsis_send_messages(struct scsi_info *vscsi)
 
 	if (!(vscsi->flags & RESPONSE_Q_DOWN)) {
 		list_for_each_entry_safe(cmd, nxt, &vscsi->waiting_rsp, list) {
-			pr_debug("send_messages cmd %p\n", cmd);
-
 			iue = cmd->iue;
 
 			crq->valid = VALID_CMD_RESP_EL;
@@ -2556,10 +2554,6 @@ static void ibmvscsis_parse_cmd(struct scsi_info *vscsi,
 
 	srp->lun.scsi_lun[0] &= 0x3f;
 
-	pr_debug("calling submit_cmd, se_cmd %p, lun 0x%llx, cdb 0x%x, attr:%d\n",
-		 &cmd->se_cmd, scsilun_to_int(&srp->lun), (int)srp->cdb[0],
-		 attr);
-
 	rc = target_submit_cmd(&cmd->se_cmd, nexus->se_sess, srp->cdb,
 			       cmd->sense_buf, scsilun_to_int(&srp->lun),
 			       data_len, attr, dir, 0);
@@ -3144,8 +3138,6 @@ static int ibmvscsis_rdma(struct ibmvscsis_cmd *cmd, struct scatterlist *sg,
 	long tx_len;
 	long rc = 0;
 
-	pr_debug("rdma: dir %d, bytes 0x%x\n", dir, bytes);
-
 	if (bytes == 0)
 		return 0;
 
@@ -3197,9 +3189,6 @@ static int ibmvscsis_rdma(struct ibmvscsis_cmd *cmd, struct scatterlist *sg,
 			/* write to client */
 			struct srp_cmd *srp = (struct srp_cmd *)iue->sbuf->buf;
 
-			if (!READ_CMD(srp->cdb))
-				print_hex_dump_bytes(" data:", DUMP_PREFIX_NONE,
-						     sg_virt(sgp), buf_len);
 			/* The h_copy_rdma will cause phyp, running in another
 			 * partition, to read memory, so we need to make sure
 			 * the data has been written out, hence these syncs.
@@ -3324,12 +3313,9 @@ cmd_work:
 				rc = ibmvscsis_trans_event(vscsi, crq);
 			} else if (vscsi->flags & TRANS_EVENT) {
 				/*
-				 * if a tranport event has occurred leave
+				 * if a transport event has occurred leave
 				 * everything but transport events on the queue
-				 */
-				pr_debug("handle_crq, ignoring\n");
-
-				/*
+				 *
 				 * need to decrement the queue index so we can
 				 * look at the elment again
 				 */
@@ -3695,8 +3681,6 @@ static void ibmvscsis_release_cmd(struct se_cmd *se_cmd)
 						 se_cmd);
 	struct scsi_info *vscsi = cmd->adapter;
 
-	pr_debug("release_cmd %p, flags %d\n", se_cmd, cmd->flags);
-
 	spin_lock_bh(&vscsi->intr_lock);
 	/* Remove from active_q */
 	list_del(&cmd->list);
@@ -3717,9 +3701,6 @@ static int ibmvscsis_write_pending(struct se_cmd *se_cmd)
 	struct iu_entry *iue = cmd->iue;
 	int rc;
 
-	pr_debug("write_pending, se_cmd %p, length 0x%x\n",
-		 se_cmd, se_cmd->data_length);
-
 	rc = srp_transfer_data(cmd, &vio_iu(iue)->srp.cmd, ibmvscsis_rdma,
 			       1, 1);
 	if (rc) {
@@ -3758,9 +3739,6 @@ static int ibmvscsis_queue_data_in(struct se_cmd *se_cmd)
 	uint len = 0;
 	int rc;
 
-	pr_debug("queue_data_in, se_cmd %p, length 0x%x\n",
-		 se_cmd, se_cmd->data_length);
-
 	rc = srp_transfer_data(cmd, &vio_iu(iue)->srp.cmd, ibmvscsis_rdma, 1,
 			       1);
 	if (rc) {
-- 
2.5.4 (Apple Git-61)

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1 3/3] Ibmvscsis: Fixed a bug reported by Dan Carpenter
  2016-08-31 16:28 [PATCH v1 0/3] Ibmvscsis fixes and code cleanup Bryant G. Ly
  2016-08-31 16:28 ` [PATCH v1 1/3] Ibmvscsis: Properly deregister target sessions Bryant G. Ly
  2016-08-31 16:29 ` [PATCH v1 2/3] Ibmvscsis: Code cleanup of print statements Bryant G. Ly
@ 2016-08-31 16:29 ` Bryant G. Ly
  2016-09-02 10:53 ` [PATCH v1 0/3] Ibmvscsis fixes and code cleanup Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Bryant G. Ly @ 2016-08-31 16:29 UTC (permalink / raw)
  To: nab, dan.carpenter
  Cc: mikecyr, James.Bottomley, tyreld, brking, seroyer, linux-scsi,
	target-devel, martin.petersen, Bryant G. Ly

SUPPORTED_FORMATS is 1 << 1 so it's never zero.

Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Signed-off-by: Michael Cyr <mikecyr@linux.vnet.ibm.com>
---
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
index d4c67b9..35455af 100644
--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
@@ -1978,7 +1978,7 @@ static long ibmvscsis_srp_login(struct scsi_info *vscsi,
 		reason = SRP_LOGIN_REJ_MULTI_CHANNEL_UNSUPPORTED;
 	else if (fmt->buffers & (~SUPPORTED_FORMATS))
 		reason = SRP_LOGIN_REJ_UNSUPPORTED_DESCRIPTOR_FMT;
-	else if ((fmt->buffers | SUPPORTED_FORMATS) == 0)
+	else if ((fmt->buffers & SUPPORTED_FORMATS) == 0)
 		reason = SRP_LOGIN_REJ_UNSUPPORTED_DESCRIPTOR_FMT;
 
 	if (vscsi->state == SRP_PROCESSING)
-- 
2.5.4 (Apple Git-61)


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 0/3] Ibmvscsis fixes and code cleanup
  2016-08-31 16:28 [PATCH v1 0/3] Ibmvscsis fixes and code cleanup Bryant G. Ly
                   ` (2 preceding siblings ...)
  2016-08-31 16:29 ` [PATCH v1 3/3] Ibmvscsis: Fixed a bug reported by Dan Carpenter Bryant G. Ly
@ 2016-09-02 10:53 ` Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2016-09-02 10:53 UTC (permalink / raw)
  To: Bryant G. Ly
  Cc: nab, dan.carpenter, mikecyr, James.Bottomley, tyreld, brking,
	seroyer, linux-scsi, target-devel, martin.petersen

>>>>> "Bryant" == Bryant G Ly <bryantly@linux.vnet.ibm.com> writes:

Bryant,

Bryant> Here are some small fixes and cleanups for Ibmvscsis Target
Bryant> Driver.  The only one of significance is the first one where
Bryant> there is a possibility of a kernel crash due to inproper
Bryant> deregister of target session since we didn't sync up work and
Bryant> didn't deregister_configfs.

Applied to 4.9/scsi-queue.

I did patch 2 by hand. It didn't apply to neither my tree, nor Nic's.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-09-02 10:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-31 16:28 [PATCH v1 0/3] Ibmvscsis fixes and code cleanup Bryant G. Ly
2016-08-31 16:28 ` [PATCH v1 1/3] Ibmvscsis: Properly deregister target sessions Bryant G. Ly
2016-08-31 16:29 ` [PATCH v1 2/3] Ibmvscsis: Code cleanup of print statements Bryant G. Ly
2016-08-31 16:29 ` [PATCH v1 3/3] Ibmvscsis: Fixed a bug reported by Dan Carpenter Bryant G. Ly
2016-09-02 10:53 ` [PATCH v1 0/3] Ibmvscsis fixes and code cleanup Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).