Skip to contentSkip to conversation

SRP initiator patches for kernel 3.15

PATCH Superseded Bart Van Assche 4 participants 21 messages Feb 20, 2014 – Feb 27, 2014 13 messages not in the archive

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover SRP initiator patches for kernel 3.15

This patch series includes the following six patches:
0001-scsi_transport_srp-Fix-two-kernel-doc-warnings.patch 0002-IB-srp-Add-more-logging.patch 0003-IB-srp-Fail-SCSI-commands-silently.patch 0004-IB-srp-Avoid-duplicate-connections.patch 0005-IB-srp-Make-writing-into-the-add_target-sysfs-attrib.patch 0006-IB-srp-Avoid-that-writing-into-add_target-hangs-due-.patch --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

PATCH 1/6 scsi_transport_srp: Fix two kernel-doc warnings

In reply to a message not in the archive

This patch fixes the following two kernel-doc warnings:

Warning(drivers/scsi/scsi_transport_srp.c:819): No description found for parameter 'rport' Warning(include/scsi/scsi_transport_srp.h:75): Excess struct/union/enum/typedef member 'deleted' description in 'srp_rport'

Cc Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/[email protected]>
Cc Sebastian Riemer <[email protected]>
Cc James Bottomley <[email protected]>
Cc Roland Dreier <[email protected]>
---
 drivers/scsi/scsi_transport_srp.c | 1 +
 include/scsi/scsi_transport_srp.h | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_transport_srp.c +1 -0
index d47ffc8..13e8983 100644
@@ -810,6 +810,7 @@ EXPORT_SYMBOL_GPL(srp_remove_host);
 
 /**
  * srp_stop_rport_timers - stop the transport layer recovery timers
+ * @rport: SRP remote port for which to stop the timers.
  *
  * Must be called after srp_remove_host() and scsi_remove_host(). The caller
  * must hold a reference on the rport (rport->dev) and on the SCSI host
include/scsi/scsi_transport_srp.h +0 -1
index b11da5c..cdb05dd 100644
@@ -41,7 +41,6 @@ enum srp_rport_state {
  * @mutex:             Protects against concurrent rport reconnect /
  *                     fast_io_fail / dev_loss_tmo activity.
  * @state:             rport state.
- * @deleted:           Whether or not srp_rport_del() has already been invoked.
  * @reconnect_delay:   Reconnect delay in seconds.
  * @failed_reconnects: Number of failed reconnect attempts.
  * @reconnect_work:    Work structure used for scheduling reconnect attempts.
Signature · 6 lines
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#6 lore raw

PATCH 3/6 IB/srp: Fail SCSI commands silently

In reply to a message not in the archive

Do not log SCSI command failures that are the result of a transport layer failure, a SCSI abort or SCSI reset. This patch is a slightly modified version of a patch posted by Sebastian Riemer in March 2013 (see also http://thread.gmane.org/gmane.linux.drivers.rdma/15020/).

This patch avoids that a system becomes unresponsive during failover of a large number of LUNs when kernel messages are logged to a serial console.

Cc Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/[email protected]>
Cc Roland Dreier <[email protected]>
---
 drivers/infiniband/ulp/srp/ib_srp.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/infiniband/ulp/srp/ib_srp.c +3 -0
index fba52d2..b3ca4d6 100644
@@ -827,6 +827,7 @@ static void srp_finish_req(struct srp_target_port *target,
 
 	if (scmnd) {
 		srp_free_req(target, req, scmnd, 0);
+		scmnd->request->cmd_flags |= REQ_QUIET;
 		scmnd->result = result;
 		scmnd->scsi_done(scmnd);
 	}
@@ -1517,6 +1518,7 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd)
 
 	result = srp_chkready(target->rport);
 	if (unlikely(result)) {
+		scmnd->request->cmd_flags |= REQ_QUIET;
 		scmnd->result = result;
 		scmnd->scsi_done(scmnd);
 		goto unlock_rport;
@@ -2011,6 +2013,7 @@ static int srp_abort(struct scsi_cmnd *scmnd)
 	else
 		ret = FAILED;
 	srp_free_req(target, req, scmnd, 0);
+	scmnd->request->cmd_flags |= REQ_QUIET;
 	scmnd->result = DID_ABORT << 16;
 	scmnd->scsi_done(scmnd);
 
Signature · 6 lines
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#28 lore raw

PATCH 4/6 IB/srp: Avoid duplicate connections

In reply to a message not in the archive

The connection uniqueness check is performed before a new connection is added to the target list. This patch protects both actions by a mutex such that simultaneous writes from two different threads into the "add_target" variable do not result in duplicate connections.

Cc Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/[email protected]>
Cc Sebastian Riemer <[email protected]>
Cc Roland Dreier <[email protected]>
---
 drivers/infiniband/ulp/srp/ib_srp.c | 12 +++++++++---
 drivers/infiniband/ulp/srp/ib_srp.h |  1 +
 2 files changed, 10 insertions(+), 3 deletions(-)
drivers/infiniband/ulp/srp/ib_srp.c +9 -3
index b3ca4d6..7d9413e 100644
@@ -2617,6 +2617,8 @@ static ssize_t srp_create_target(struct device *dev,
 	target->tl_retry_count	= 7;
 	target->queue_size	= SRP_DEFAULT_QUEUE_SIZE;
 
+	mutex_lock(&host->add_target_mutex);
+
 	ret = srp_parse_options(buf, target);
 	if (ret)
 		goto err;
@@ -2683,7 +2685,11 @@ static ssize_t srp_create_target(struct device *dev,
 		     be64_to_cpu(target->service_id),
 		     target->path.sgid.raw, target->path.dgid.raw);
 
-	return count;
+	ret = count;
+
+out:
+	mutex_unlock(&host->add_target_mutex);
+	return ret;
 
 err_disconnect:
 	srp_disconnect_target(target);
@@ -2699,8 +2705,7 @@ err_free_mem:
 
 err:
 	scsi_host_put(target_host);
-
-	return ret;
+	goto out;
 }
 
 static DEVICE_ATTR(add_target, S_IWUSR, NULL, srp_create_target);
@@ -2736,6 +2741,7 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port)
 	INIT_LIST_HEAD(&host->target_list);
 	spin_lock_init(&host->target_lock);
 	init_completion(&host->released);
+	mutex_init(&host->add_target_mutex);
 	host->srp_dev = device;
 	host->port = port;
 
drivers/infiniband/ulp/srp/ib_srp.h +1 -0
index 5756810..aad27b7 100644
@@ -105,6 +105,7 @@ struct srp_host {
 	spinlock_t		target_lock;
 	struct completion	released;
 	struct list_head	list;
+	struct mutex		add_target_mutex;
 };
 
 struct srp_request {
Signature · 6 lines
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#29 lore raw

PATCH 5/6 IB/srp: Make writing into the "add_target" sysfs attribute interruptible

In reply to a message not in the archive

Avoid that stopping srp_daemon takes unusually long due to a cable pull by making writing into the "add_target" sysfs attribute interruptible.

Cc Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/[email protected]>
Cc Sebastian Riemer <[email protected]>
Cc Roland Dreier <[email protected]>
---
 drivers/infiniband/ulp/srp/ib_srp.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/srp/ib_srp.c +8 -2
index 7d9413e..0d934b7 100644
@@ -411,6 +411,8 @@ static void srp_path_rec_completion(int status,
 
 static int srp_lookup_path(struct srp_target_port *target)
 {
+	int ret;
+
 	target->path.numb_path = 1;
 
 	init_completion(&target->done);
@@ -431,7 +433,9 @@ static int srp_lookup_path(struct srp_target_port *target)
 	if (target->path_query_id < 0)
 		return target->path_query_id;
 
-	wait_for_completion(&target->done);
+	ret = wait_for_completion_interruptible(&target->done);
+	if (ret < 0)
+		return ret;
 
 	if (target->status < 0)
 		shost_printk(KERN_WARNING, target->scsi_host,
@@ -710,7 +714,9 @@ static int srp_connect_target(struct srp_target_port *target)
 		ret = srp_send_req(target);
 		if (ret)
 			return ret;
-		wait_for_completion(&target->done);
+		ret = wait_for_completion_interruptible(&target->done);
+		if (ret < 0)
+			return ret;
 
 		/*
 		 * The CM event handling code will set status to
Signature · 6 lines
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#30 lore raw

PATCH 6/6 IB/srp: Avoid that writing into "add_target" hangs due to a cable pull

In reply to a message not in the archive

If a cable is pulled while srp_connect_target() is in progress that can result in that function never to return. That makes the process, e.g. srp_daemon, that invoked this function unkillable. Avoid this by letting srp_connect_target() finish if the event IB_CM_TIMEWAIT_EXIT is received. This patch fixes a hang with the following call trace:

 [<ffffffff814eae85>] schedule_timeout+0x215/0x2e0
 [<ffffffff814eab03>] wait_for_common+0x123/0x180
 [<ffffffff814eac1d>] wait_for_completion+0x1d/0x20
 [<ffffffffa03b398c>] srp_connect_target+0x1dc/0x410 [ib_srp]
 [<ffffffffa03b5809>] srp_create_target+0xba9/0xe70 [ib_srp]
 [<ffffffff8133e590>] dev_attr_store+0x20/0x30
 [<ffffffff811eb8f5>] sysfs_write_file+0xe5/0x170
 [<ffffffff811767c8>] vfs_write+0xb8/0x1a0
 [<ffffffff811770c1>] sys_write+0x51/0x90
 [<ffffffff8100b072>] system_call_fastpath+0x16/0x1b
Cc Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/[email protected]>
Cc Sebastian Riemer <[email protected]>
Cc Roland Dreier <[email protected]>
---
 drivers/infiniband/ulp/srp/ib_srp.c | 1 +
 1 file changed, 1 insertion(+)
drivers/infiniband/ulp/srp/ib_srp.c +1 -0
index 0d934b7..dcdaf49 100644
@@ -1873,6 +1873,7 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
 	case IB_CM_TIMEWAIT_EXIT:
 		shost_printk(KERN_ERR, target->scsi_host,
 			     PFX "connection closed\n");
+		comp = 1;
 
 		target->status = 0;
 		break;
Signature · 6 lines
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw

PATCH 2/6 IB/srp: Add more logging

In reply to a message not in the archive

Log sgid and dgid when reporting that a login has been rejected or when a host has been added. This makes it easy to figure out which initiator and target ports these messages apply to.

Cc Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/[email protected]>
Cc Sebastian Riemer <[email protected]>
Cc Roland Dreier <[email protected]>
---
 drivers/infiniband/ulp/srp/ib_srp.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)
drivers/infiniband/ulp/srp/ib_srp.c +12 -11
index 529b6bc..fba52d2 100644
@@ -1804,8 +1804,10 @@ static void srp_cm_rej_handler(struct ib_cm_id *cm_id,
 				shost_printk(KERN_WARNING, shost,
 					     PFX "SRP_LOGIN_REJ: requested max_it_iu_len too large\n");
 			else
-				shost_printk(KERN_WARNING, shost,
-					    PFX "SRP LOGIN REJECTED, reason 0x%08x\n", reason);
+				shost_printk(KERN_WARNING, shost, PFX
+					     "SRP LOGIN from %pI6 to %pI6 REJECTED, reason 0x%08x\n",
+					     target->path.sgid.raw,
+					     target->orig_dgid, reason);
 		} else
 			shost_printk(KERN_WARNING, shost,
 				     "  REJ reason: IB_CM_REJ_CONSUMER_DEFINED,"
@@ -2651,15 +2653,6 @@ static ssize_t srp_create_target(struct device *dev,
 
 	ib_query_gid(ibdev, host->port, 0, &target->path.sgid);
 
-	shost_printk(KERN_DEBUG, target->scsi_host, PFX
-		     "new target: id_ext %016llx ioc_guid %016llx pkey %04x "
-		     "service_id %016llx dgid %pI6\n",
-	       (unsigned long long) be64_to_cpu(target->id_ext),
-	       (unsigned long long) be64_to_cpu(target->ioc_guid),
-	       be16_to_cpu(target->path.pkey),
-	       (unsigned long long) be64_to_cpu(target->service_id),
-	       target->path.dgid.raw);
-
 	ret = srp_create_target_ib(target);
 	if (ret)
 		goto err_free_mem;
@@ -2679,6 +2672,14 @@ static ssize_t srp_create_target(struct device *dev,
 	if (ret)
 		goto err_disconnect;
 
+	shost_printk(KERN_DEBUG, target->scsi_host, PFX
+		     "new target: id_ext %016llx ioc_guid %016llx pkey %04x service_id %016llx sgid %pI6 dgid %pI6\n",
+		     be64_to_cpu(target->id_ext),
+		     be64_to_cpu(target->ioc_guid),
+		     be16_to_cpu(target->path.pkey),
+		     be64_to_cpu(target->service_id),
+		     target->path.sgid.raw, target->path.dgid.raw);
+
 	return count;
 
 err_disconnect:
Signature · 6 lines
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#8 lore raw

Re: [PATCH 3/6] IB/srp: Fail SCSI commands silently

In reply to a message not in the archive
Quoted 10 lines · Bart Van Assche

Do not log SCSI command failures that are the result of a transport layer failure, a SCSI abort or SCSI reset. This patch is a slightly modified version of a patch posted by Sebastian Riemer in March 2013 (see also http://thread.gmane.org/gmane.linux.drivers.rdma/15020/).

This patch avoids that a system becomes unresponsive during failover of a large number of LUNs when kernel messages are logged to a serial console.

Since this patch based on work of Sebastian, I should have mentioned:

From: Sebastian Riemer <[email protected]>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: [PATCH 1/6] scsi_transport_srp: Fix two kernel-doc warnings

In reply to a message not in the archive
Quoted 34 lines · Bart Van Assche

This patch fixes the following two kernel-doc warnings:

Warning(drivers/scsi/scsi_transport_srp.c:819): No description found for parameter 'rport' Warning(include/scsi/scsi_transport_srp.h:75): Excess struct/union/enum/typedef member 'deleted' description in 'srp_rport'

Cc Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/[email protected]>
Cc Sebastian Riemer <[email protected]>
Cc James Bottomley <[email protected]>
Cc Roland Dreier <[email protected]>
---
 drivers/scsi/scsi_transport_srp.c | 1 +
 include/scsi/scsi_transport_srp.h | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_transport_srp.c +1 -0
index d47ffc8..13e8983 100644
@@ -810,6 +810,7 @@ EXPORT_SYMBOL_GPL(srp_remove_host);
 
 /**
  * srp_stop_rport_timers - stop the transport layer recovery timers
+ * @rport: SRP remote port for which to stop the timers.
  *
  * Must be called after srp_remove_host() and scsi_remove_host(). The caller
  * must hold a reference on the rport (rport->dev) and on the SCSI host
include/scsi/scsi_transport_srp.h +0 -0
index b11da5c..cdb05dd 100644

include/scsi/scsi_transport_srp.h enum srp_rport_state { · line 46

Quoted 7 lines
include/scsi/scsi_transport_srp.h +0 -1
@@ -41,7 +41,6 @@ enum srp_rport_state {
  * @mutex:             Protects against concurrent rport reconnect /
  *                     fast_io_fail / dev_loss_tmo activity.
  * @state:             rport state.
- * @deleted:           Whether or not srp_rport_del() has already been invoked.
  * @reconnect_delay:   Reconnect delay in seconds.
  * @failed_reconnects: Number of failed reconnect attempts.
  * @reconnect_work:    Work structure used for scheduling reconnect attempts.

This is trivial. Thanks!

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#31 lore raw
In reply to a message not in the archive

2014-02-20 14:50 GMT+04:00 Bart Van Assche <[email protected]>:

Quoted 7 lines

This patch series includes the following six patches:
0001-scsi_transport_srp-Fix-two-kernel-doc-warnings.patch 0002-IB-srp-Add-more-logging.patch 0003-IB-srp-Fail-SCSI-commands-silently.patch 0004-IB-srp-Avoid-duplicate-connections.patch 0005-IB-srp-Make-writing-into-the-add_target-sysfs-attrib.patch 0006-IB-srp-Avoid-that-writing-into-add_target-hangs-due-.patch

Is that possible to get some of this into stable 3.10.x?

Signature · 7 lines
Vasiliy Tolstov,
e-mail: [email protected]
jabber: [email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#9 lore raw

Re: [PATCH 3/6] IB/srp: Fail SCSI commands silently

In reply to a message not in the archive
Quoted 8 lines · Bart Van Assche

Do not log SCSI command failures that are the result of a transport layer failure, a SCSI abort or SCSI reset. This patch is a slightly modified version of a patch posted by Sebastian Riemer in March 2013 (see also http://thread.gmane.org/gmane.linux.drivers.rdma/15020/).

This patch avoids that a system becomes unresponsive during failover of a large number of LUNs when kernel messages are logged to a serial console.

While I can see the utility for slow consoles, this should probably be done in the SCSI lib, with a separate flag for indicating it is a failure due to transport issues. That would allow the functionality to be used by multiple drivers and verbosity configured in one place, rather than patched in driver-by-driver.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw

Re: [PATCH 3/6] IB/srp: Fail SCSI commands silently

In reply to a message not in the archive
Quoted 10 lines · David Dillow
Quoted 8 lines · Bart Van Assche

Do not log SCSI command failures that are the result of a transport layer failure, a SCSI abort or SCSI reset. This patch is a slightly modified version of a patch posted by Sebastian Riemer in March 2013 (see also http://thread.gmane.org/gmane.linux.drivers.rdma/15020/).

This patch avoids that a system becomes unresponsive during failover of a large number of LUNs when kernel messages are logged to a serial console.

Quoted 5 lines

While I can see the utility for slow consoles, this should probably be done in the SCSI lib, with a separate flag for indicating it is a failure due to transport issues. That would allow the functionality to be used by multiple drivers and verbosity configured in one place, rather than patched in driver-by-driver.

Hello Dave,

If it would be possible to move the code for setting the REQ_QUIET flag into the SCSI lib that would be great. However, as far as I know only the LLD knows which requests are in progress. A call to blk_start_request() makes blk_dequeue_request() remove a request from the queuelist in struct request_queue. I am not aware of any list in the block layer nor in the SCSI mid-layer that keeps track of requests that are in progress ?

Thanks,

Bart.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#33 lore raw
In reply to a message not in the archive
Quoted 10 lines · Vasiliy Tolstov

2014-02-20 14:50 GMT+04:00 Bart Van Assche <[email protected]>:

Quoted 7 lines

This patch series includes the following six patches:
0001-scsi_transport_srp-Fix-two-kernel-doc-warnings.patch 0002-IB-srp-Add-more-logging.patch 0003-IB-srp-Fail-SCSI-commands-silently.patch 0004-IB-srp-Avoid-duplicate-connections.patch 0005-IB-srp-Make-writing-into-the-add_target-sysfs-attrib.patch 0006-IB-srp-Avoid-that-writing-into-add_target-hangs-due-.patch

Is that possible to get some of this into stable 3.10.x?

What I understood from Documentation/stable_kernel_rules.txt is that patches that fix a bug are acceptable for the stable kernel series but functionality changes not. So I think patches 4, 5 and 6 would be good candidates for the stable kernel series. Roland, do you want me to resend this series with "stable" tags added where appropriate or are you fine with adding this tag yourself to the last three patches ?

Thanks,

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#13 lore raw

Re: [PATCH 3/6] IB/srp: Fail SCSI commands silently

In reply to a message not in the archive
Quoted 9 lines · Bart Van Assche
Quoted 5 lines · David Dillow

While I can see the utility for slow consoles, this should probably be done in the SCSI lib, with a separate flag for indicating it is a failure due to transport issues. That would allow the functionality to be used by multiple drivers and verbosity configured in one place, rather than patched in driver-by-driver.

Hello Dave,

Quoted 7 lines

If it would be possible to move the code for setting the REQ_QUIET flag into the SCSI lib that would be great. However, as far as I know only the LLD knows which requests are in progress. A call to blk_start_request() makes blk_dequeue_request() remove a request from the queuelist in struct request_queue. I am not aware of any list in the block layer nor in the SCSI mid-layer that keeps track of requests that are in progress ?

I didn't suggest that -- I'm saying add a common functionality to turn on/off the message printing for commands that failed due to a dead transport. If it is useful for SRP initiators, it is probably useful for SAS and iSCSI imitators as well.

At a quick look, it seems you need to add a new value to the rq_flag_bits enum in include/linux/blk_types.h, __REQ_FAILED_TRANSPORT, somewhere before __REQ_NR_BITS. And a #define in the style of those following it. Use that flag instead of REQ_QUIET in the patch we are discussing, and change the code in scsi_lib.c to check

  ((req->cmd_flags & REQ_FAILED_TRANSPORT) && $user_wants_this_knob) || !(req->cmd_flags & REQ_QUIET)

before calling scsi_print_sense(), with appropriate naming, of course. This gives you a central place to control it, and allows for consistency between initiators.

I agree it is much easier to just fix it in SRP, especially given the glacial rate of change for the SCSI mid-layer, but I really think a central control and driver-by-driver enablement would be the best approach. YMMV.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#15 lore raw

Re: [PATCH 3/6] IB/srp: Fail SCSI commands silently

In reply to a message not in the archive
Quoted 13 lines · David Dillow

I didn't suggest that -- I'm saying add a common functionality to turn on/off the message printing for commands that failed due to a dead transport. If it is useful for SRP initiators, it is probably useful for SAS and iSCSI imitators as well.

At a quick look, it seems you need to add a new value to the rq_flag_bits enum in include/linux/blk_types.h, __REQ_FAILED_TRANSPORT, somewhere before __REQ_NR_BITS. And a #define in the style of those following it. Use that flag instead of REQ_QUIET in the patch we are discussing, and change the code in scsi_lib.c to check

  ((req->cmd_flags & REQ_FAILED_TRANSPORT) && $user_wants_this_knob) || !(req->cmd_flags & REQ_QUIET)
Quoted 8 lines

before calling scsi_print_sense(), with appropriate naming, of course. This gives you a central place to control it, and allows for consistency between initiators.

I agree it is much easier to just fix it in SRP, especially given the glacial rate of change for the SCSI mid-layer, but I really think a central control and driver-by-driver enablement would be the best approach. YMMV.

Hello Dave,

That makes sense to me. Do you think the (untested) patch below could be a valid alternative to the above proposal ?

---
 drivers/scsi/scsi_lib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +2 -1
index 7bd7f0d..124ab53 100644
@@ -857,7 +857,8 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
 		 */
 		if ((sshdr.asc == 0x0) && (sshdr.ascq == 0x1d))
 			;
-		else if (!(req->cmd_flags & REQ_QUIET))
+		else if (cmd->device->sdev_state != SDEV_TRANSPORT_OFFLINE &&
+			 !(req->cmd_flags & REQ_QUIET))
 			scsi_print_sense("", cmd);
 		result = 0;
 		/* BLOCK_PC may have set error */
Signature · 11 lines
1.8.4.5


Thanks,

Bart.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#17 lore raw

Re: [PATCH 3/6] IB/srp: Fail SCSI commands silently

In reply to a message not in the archive
Quoted 23 lines · Bart Van Assche
Quoted 13 lines · David Dillow

I didn't suggest that -- I'm saying add a common functionality to turn on/off the message printing for commands that failed due to a dead transport. If it is useful for SRP initiators, it is probably useful for SAS and iSCSI imitators as well.

At a quick look, it seems you need to add a new value to the rq_flag_bits enum in include/linux/blk_types.h, __REQ_FAILED_TRANSPORT, somewhere before __REQ_NR_BITS. And a #define in the style of those following it. Use that flag instead of REQ_QUIET in the patch we are discussing, and change the code in scsi_lib.c to check

  ((req->cmd_flags & REQ_FAILED_TRANSPORT) && $user_wants_this_knob) || !(req->cmd_flags & REQ_QUIET)
Quoted 8 lines

before calling scsi_print_sense(), with appropriate naming, of course. This gives you a central place to control it, and allows for consistency between initiators.

I agree it is much easier to just fix it in SRP, especially given the glacial rate of change for the SCSI mid-layer, but I really think a central control and driver-by-driver enablement would be the best approach. YMMV.

Quoted 4 lines

Hello Dave,

That makes sense to me. Do you think the (untested) patch below could be a valid alternative to the above proposal ?

I'd still like to see a knob to let the user turn it off -- sometimes you want to see those messages -- but it seems like a viable approach, especially if it works when you test it :)

I'll leave to others about how important that knob is, though. If no one else barks, then it should be OK.

Quoted 5 lines
drivers/scsi/scsi_lib.c +0 -0
index 7bd7f0d..124ab53 100644

drivers/scsi/scsi_lib.c void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) · line 864

Quoted 9 lines
drivers/scsi/scsi_lib.c +2 -1
@@ -857,7 +857,8 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
 		 */
 		if ((sshdr.asc == 0x0) && (sshdr.ascq == 0x1d))
 			;
-		else if (!(req->cmd_flags & REQ_QUIET))
+		else if (cmd->device->sdev_state != SDEV_TRANSPORT_OFFLINE &&
+			 !(req->cmd_flags & REQ_QUIET))
 			scsi_print_sense("", cmd);
 		result = 0;
 		/* BLOCK_PC may have set error */

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#19 lore raw

Re: [PATCH 3/6] IB/srp: Fail SCSI commands silently

In reply to a message not in the archive
Quoted 34 lines · David Dillow
Quoted 18 lines · Bart Van Assche
Quoted 17 lines · David Dillow

I didn't suggest that -- I'm saying add a common functionality to turn on/off the message printing for commands that failed due to a dead transport. If it is useful for SRP initiators, it is probably useful for SAS and iSCSI imitators as well.

At a quick look, it seems you need to add a new value to the rq_flag_bits enum in include/linux/blk_types.h, __REQ_FAILED_TRANSPORT, somewhere before __REQ_NR_BITS. And a #define in the style of those following it. Use that flag instead of REQ_QUIET in the patch we are discussing, and change the code in scsi_lib.c to check

  ((req->cmd_flags & REQ_FAILED_TRANSPORT) && $user_wants_this_knob) || !(req->cmd_flags & REQ_QUIET)

before calling scsi_print_sense(), with appropriate naming, of course. This gives you a central place to control it, and allows for consistency between initiators.

Quoted 7 lines
Quoted 4 lines

I agree it is much easier to just fix it in SRP, especially given the glacial rate of change for the SCSI mid-layer, but I really think a central control and driver-by-driver enablement would be the best approach. YMMV.

That makes sense to me. Do you think the (untested) patch below could be a valid alternative to the above proposal ?

I'd still like to see a knob to let the user turn it off -- sometimes you want to see those messages -- but it seems like a viable approach, especially if it works when you test it :)

I'll leave to others about how important that knob is, though. If no one else barks, then it should be OK.

Quoted 14 lines
Quoted 5 lines
drivers/scsi/scsi_lib.c +0 -0
index 7bd7f0d..124ab53 100644

drivers/scsi/scsi_lib.c void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) · line 864

Quoted 9 lines
drivers/scsi/scsi_lib.c +2 -1
@@ -857,7 +857,8 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
 		 */
 		if ((sshdr.asc == 0x0) && (sshdr.ascq == 0x1d))
 			;
-		else if (!(req->cmd_flags & REQ_QUIET))
+		else if (cmd->device->sdev_state != SDEV_TRANSPORT_OFFLINE &&
+			 !(req->cmd_flags & REQ_QUIET))
 			scsi_print_sense("", cmd);
 		result = 0;
 		/* BLOCK_PC may have set error */

Hello Dave,

Testing learned me that the above patch suppresses the messages reported by the SCSI mid-layer due to a transport failure but not the messages reported by the block layer (e.g. "end_request: recoverable transport error, dev sdc, sector 42514" -- see also blk_update_request() in block/blk-core.c). Do you really think it is essential to introduce a new flag in the block layer for the purpose of suppressing transport layer error messages and to add support for that flag in the block core and in the SCSI mid-layer ? To me it seems a lot simpler to use the existing REQ_QUIET flag.

Thanks,

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#21 lore raw

Re: [PATCH 3/6] IB/srp: Fail SCSI commands silently

In reply to a message not in the archive
Quoted 5 lines · Bart Van Assche

Do you really think it is essential to introduce a
new flag in the block layer for the purpose of suppressing transport layer error messages and to add support for that flag in the block core and in the SCSI mid-layer ? To me it seems a lot simpler to use the existing REQ_QUIET flag.

Yes, I think you want different semantics -- one is the requestor saying "don't complain about this if it fails", the other is the LLD saying "this failed due to transport failure, you may or may not want to report it, under user control". But it doesn't necessarily have to be a new block flag -- it may be as simple as adding a stanza in scsi_io_completion() that looks like

if (cmd->device->sdev_state != SDEV_TRANSPORT_OFFLINE &&

    user_want_to_silence_transport_errors)
	req->cmd_flags |= REQ_QUIET;

if ((sshdr.asc == 0x0) && (sshdr.ascq == 0x1d))

	;
else if (!(req->cmd_flags & REQ_QUIET))
	scsi_print_sense("", cmd);

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#23 lore raw

Re: [PATCH 3/6] IB/srp: Fail SCSI commands silently

In reply to a message not in the archive
Quoted 14 lines · David Dillow
Quoted 5 lines · Bart Van Assche

Do you really think it is essential to introduce a
new flag in the block layer for the purpose of suppressing transport layer error messages and to add support for that flag in the block core and in the SCSI mid-layer ? To me it seems a lot simpler to use the existing REQ_QUIET flag.

Yes, I think you want different semantics -- one is the requestor saying "don't complain about this if it fails", the other is the LLD saying "this failed due to transport failure, you may or may not want to report it, under user control". But it doesn't necessarily have to be a new block flag -- it may be as simple as adding a stanza in scsi_io_completion() that looks like

Quoted 8 lines

if (cmd->device->sdev_state != SDEV_TRANSPORT_OFFLINE &&

    user_want_to_silence_transport_errors)
	req->cmd_flags |= REQ_QUIET;

if ((sshdr.asc == 0x0) && (sshdr.ascq == 0x1d))

	;
else if (!(req->cmd_flags & REQ_QUIET))
	scsi_print_sense("", cmd);

But this approach doesn't suppress the error messages printed by the block layer due to a transport layer failure. Additionally, the block layer is neither aware of the SCSI transport layer state nor of the ASC and ASCQ codes in the sense data. Hence my preference to keep patch 3/6 as it has been posted at the start of this thread.

Bart.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#25 lore raw

Re: [PATCH 3/6] IB/srp: Fail SCSI commands silently

In reply to a message not in the archive
Quoted 19 lines · Bart Van Assche
Quoted 18 lines · David Dillow
Quoted 5 lines · Bart Van Assche

Do you really think it is essential to introduce a
new flag in the block layer for the purpose of suppressing transport layer error messages and to add support for that flag in the block core and in the SCSI mid-layer ? To me it seems a lot simpler to use the existing REQ_QUIET flag.

Yes, I think you want different semantics -- one is the requestor saying "don't complain about this if it fails", the other is the LLD saying "this failed due to transport failure, you may or may not want to report it, under user control". But it doesn't necessarily have to be a new block flag -- it may be as simple as adding a stanza in scsi_io_completion() that looks like

if (cmd->device->sdev_state != SDEV_TRANSPORT_OFFLINE &&

    user_want_to_silence_transport_errors)
	req->cmd_flags |= REQ_QUIET;
Quoted 7 lines
Quoted 4 lines

if ((sshdr.asc == 0x0) && (sshdr.ascq == 0x1d))

	;
else if (!(req->cmd_flags & REQ_QUIET))
	scsi_print_sense("", cmd);

But this approach doesn't suppress the error messages printed by the block layer due to a transport layer failure.

I don't see where the block level is printing messages about the failed requests -- but maybe I'm missing it. I see scsi_done() -> blk_complete_request() -> blk_done_softirq() -> scsi_softirq_done() -> scsi_finish_command() -> scsi_io_completion()

I'm not seeing where the errored block requests would be printed before scsi_io_completion(), which is where we were talking about setting the REQ_QUIET flag above.

What messages are you talking about -- even better if you can point to where they come from -- but mainly which ones; I'm happy to track them down myself. It's been a while since I've done a deep dive on this code, so my apologies if it should be obvious to me...

Quoted 2 lines

Additionally, the block layer is neither aware of the SCSI transport layer state nor of the ASC and ASCQ codes in the sense data.

Of course it isn't, and no one is suggesting it should.

Quoted 2 lines

Hence my preference to keep patch 3/6 as it has been posted at the start of this thread.

I agree it is the most expedient approach to solve Sebastian's immediate problem, but I'd rather the solution be generic to the SCSI mid-layer so it will be useful for others beyond SRP.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#27 lore raw

Re: [PATCH 3/6] IB/srp: Fail SCSI commands silently

In reply to a message not in the archive
Quoted 5 lines · David Dillow

I don't see where the block level is printing messages about the failed requests -- but maybe I'm missing it. I see scsi_done() -> blk_complete_request() -> blk_done_softirq() -> scsi_softirq_done() -> scsi_finish_command() -> scsi_io_completion()

Quoted 8 lines

I'm not seeing where the errored block requests would be printed before scsi_io_completion(), which is where we were talking about setting the REQ_QUIET flag above.

What messages are you talking about -- even better if you can point to where they come from -- but mainly which ones; I'm happy to track them down myself. It's been a while since I've done a deep dive on this code, so my apologies if it should be obvious to me...

Hello Dave,

I think the call chain is as follows: scsi_io_completion() -> scsi_end_request() -> blk_end_request() -> blk_end_bidi_request() -> blk_update_bidi_request() -> blk_update_request(). That last function prints an error message for failed requests if REQ_QUIET has not been set. So this means that it's possible to set the REQ_QUIET flag from the SCSI mid-layer before the block layer checks that flag.

Quoted 3 lines

I agree it is the most expedient approach to solve Sebastian's immediate problem, but I'd rather the solution be generic to the SCSI mid-layer so it will be useful for others beyond SRP.

It would be great if this would be solved in a more generic way. But please keep in mind that this is not just Sebastian's problem - other users have reported this before.

Bart.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html