mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com
Cc: hare@suse.de, bart.vanassche@sandisk.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/4] scsi: scsi_dh_alua: do not print RTPG state if it remains unavailable/standby
Date: Mon, 10 Jul 2017 19:47:36 -0300	[thread overview]
Message-ID: <1499726857-7875-4-git-send-email-mauricfo@linux.vnet.ibm.com> (raw)
In-Reply-To: <1499726857-7875-1-git-send-email-mauricfo@linux.vnet.ibm.com>

Path checkers will check paths of a port group in unavailable/standby
state more frequently (as they are 'failed') - possibly for a long or
indefinite period of time, and/or for a large number of paths.

That might flood the kernel log with scsi_dh_alua RTPG state messages,
due to the recheck scheduled in alua_check_sense() to update PG state.

So, do not to print such message if unavailable/standby state remains
(i.e., the PG did not transition to/from such states). All other cases
continue to be printed.

Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>

---
v2:
- changed v1's alua_state_remains() into alua_rtpg_print_check(),
  which includes in the states (not) to print for (deduplicates code).
- added support for Standby state too (requested in patch 1 of this set)
  (Bart Van Assche <Bart.VanAssche@sandisk.com>)
- remove superfluous parentheses in return statement.
  (Bart Van Assche <Bart.VanAssche@sandisk.com>)
- remove likely() hint
  (Bart Van Assche <Bart.VanAssche@sandisk.com>)

 drivers/scsi/device_handler/scsi_dh_alua.c | 35 ++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index 937341ddb767..e0bf0827a980 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -572,6 +572,30 @@ static void alua_rtpg_print_supported(struct scsi_device *sdev,
 }
 
 /*
+ * alua_rtpg_print_check - Whether to print RTPG state information
+ * 			   on particular state transitions.
+ * @old_state: the old state value.
+ * @new_state: the new state value.
+ */
+static bool alua_rtpg_print_check(int old_state, int new_state)
+{
+	/*
+	 * Do not print RTPG state information in case
+	 * state remains either unavailable or standby.
+	 *
+	 * Print it for everything else.
+	 */
+
+	switch (old_state) {
+	case SCSI_ACCESS_STATE_UNAVAILABLE:
+	case SCSI_ACCESS_STATE_STANDBY:
+		return old_state != new_state;
+	default:
+		return 1;
+	}
+}
+
+/*
  * alua_rtpg - Evaluate REPORT TARGET GROUP STATES
  * @sdev: the device to be evaluated.
  *
@@ -706,6 +730,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
 				if ((tmp_pg == pg) ||
 				    !(tmp_pg->flags & ALUA_PG_RUNNING)) {
 					struct alua_dh_data *h;
+					int tmp_pg_state_orig = tmp_pg->state;
 
 					tmp_pg->state = desc[0] & 0x0f;
 					tmp_pg->pref = desc[0] >> 7;
@@ -718,10 +743,12 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
 					}
 					rcu_read_unlock();
 
-					if (tmp_pg == pg)
-						alua_rtpg_print_supported(sdev, tmp_pg, desc[1]);
-					else
-						alua_rtpg_print(sdev, tmp_pg);
+					if (alua_rtpg_print_check(tmp_pg_state_orig, tmp_pg->state)) {
+						if (tmp_pg == pg)
+							alua_rtpg_print_supported(sdev, tmp_pg, desc[1]);
+						else
+							alua_rtpg_print(sdev, tmp_pg);
+					}
 				}
 				spin_unlock_irqrestore(&tmp_pg->lock, flags);
 			}
-- 
1.8.3.1

  parent reply	other threads:[~2017-07-10 22:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-10 22:47 [PATCH v2 0/4] scsi_dh_alua: fix stuck I/O after unavailable/standby states Mauricio Faria de Oliveira
2017-07-10 22:47 ` [PATCH v2 1/4] scsi: scsi_dh_alua: allow I/O in target port unavailable and standby states Mauricio Faria de Oliveira
2017-07-11  9:18   ` Hannes Reinecke
2017-07-11 15:32     ` Mauricio Faria de Oliveira
2017-07-11 21:01       ` Mauricio Faria de Oliveira
2017-07-10 22:47 ` [PATCH v2 2/4] scsi: scsi_dh_alua: print changes to RTPG state of all PGs Mauricio Faria de Oliveira
2017-07-10 22:47 ` Mauricio Faria de Oliveira [this message]
2017-07-11 14:11   ` [PATCH v2 3/4] scsi: scsi_dh_alua: do not print RTPG state if it remains unavailable/standby kbuild test robot
2017-07-11 14:11   ` [PATCH] scsi: scsi_dh_alua: fix boolreturn.cocci warnings kbuild test robot
2017-07-10 22:47 ` [PATCH v2 4/4] scsi: scsi_dh_alua: add sdev_dbg() to track alua_rtpg_work() Mauricio Faria de Oliveira
2017-07-10 22:53 ` [PATCH v2 0/4] scsi_dh_alua: fix stuck I/O after unavailable/standby states Mauricio Faria de Oliveira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1499726857-7875-4-git-send-email-mauricfo@linux.vnet.ibm.com \
    --to=mauricfo@linux.vnet.ibm.com \
    --cc=bart.vanassche@sandisk.com \
    --cc=hare@suse.de \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®