2023-07-17 11:36:39 +00:00
|
|
|
|
From 368c5581b8e7f9f796764c3f697babd63d637767 Mon Sep 17 00:00:00 2001
|
2023-06-01 09:31:08 +00:00
|
|
|
|
From: Stefan Haberland <sth@linux.ibm.com>
|
|
|
|
|
Date: Mon, 8 May 2023 14:52:54 +0200
|
2023-07-17 11:36:39 +00:00
|
|
|
|
Subject: [PATCH 1/4] zdev: add support for autoquiesce related sysfs
|
|
|
|
|
attributes (#2196517)
|
2023-06-01 09:31:08 +00:00
|
|
|
|
|
|
|
|
|
Autoquiesce is a mechanism that tells Linux to stop issuing I/Os to a
|
|
|
|
|
specific DASD after certain events.
|
|
|
|
|
|
|
|
|
|
Add support for configuring related DASD device attributes
|
|
|
|
|
that govern the following aspects of autoquiesce:
|
|
|
|
|
|
|
|
|
|
aq_mask - Configure which events lead to autoquiesce.
|
|
|
|
|
aq_requeue - Configure if autoquiesce will requeue all I/O to blocklayer.
|
|
|
|
|
aq_timeouts - Configure the number of timeouts before autoquiesce.
|
|
|
|
|
|
|
|
|
|
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
|
|
|
|
|
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
|
|
|
|
|
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
|
2023-07-17 11:36:39 +00:00
|
|
|
|
(cherry picked from commit 493af760ed47454f5719f05a6e6316f43a3be98a)
|
2023-06-01 09:31:08 +00:00
|
|
|
|
---
|
|
|
|
|
zdev/src/dasd.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
|
1 file changed, 65 insertions(+)
|
|
|
|
|
|
|
|
|
|
diff --git a/zdev/src/dasd.c b/zdev/src/dasd.c
|
|
|
|
|
index f9fd231..4330229 100644
|
|
|
|
|
--- a/zdev/src/dasd.c
|
|
|
|
|
+++ b/zdev/src/dasd.c
|
|
|
|
|
@@ -344,6 +344,68 @@ static struct attrib dasd_attr_fc_security = {
|
|
|
|
|
.readonly = 1,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
+static struct attrib dasd_attr_aq_mask = {
|
|
|
|
|
+ .name = "aq_mask",
|
|
|
|
|
+ .title = "Specify autoquiesce triggers",
|
|
|
|
|
+ .desc =
|
|
|
|
|
+ "Use the aq_mask attribute to automatically quiesce a device and block\n"
|
|
|
|
|
+ "new I/O after certain events.\n"
|
|
|
|
|
+ "\n"
|
|
|
|
|
+ "The value is a bitmask in decimal or hexadecimal format where each set bit\n"
|
|
|
|
|
+ "indicates that the associated event shown in the table below triggers an\n"
|
|
|
|
|
+ "autoquiesce.\n"
|
|
|
|
|
+ " Bit 0 is not used.\n"
|
|
|
|
|
+ " 1 - 0x02 - A terminal I/O error occurred\n"
|
|
|
|
|
+ " 2 - 0x04 - No active channel paths remain for the device\n"
|
|
|
|
|
+ " 3 - 0x08 - A state change interrupt occurred\n"
|
|
|
|
|
+ " 4 - 0x10 - The device is PPRC suspended\n"
|
|
|
|
|
+ " 5 - 0x20 - No space is left on an ESE device\n"
|
|
|
|
|
+ " 6 - 0x40 – The number of timeouts specified in aq_timeouts is reached\n"
|
|
|
|
|
+ " 7 - 0x80 - I/O was not started because of an error in the start function\n"
|
|
|
|
|
+ "\n"
|
|
|
|
|
+ "For example bits 1,3 and 5 set (0010 1010) lead to an integer value of 42\n"
|
|
|
|
|
+ "or 0x2A.\n"
|
|
|
|
|
+ "An integer value of 0 turns off the autoquiesce function.\n",
|
|
|
|
|
+ .order_cmp = ccw_online_only_order_cmp,
|
|
|
|
|
+ .check = ccw_online_only_check,
|
|
|
|
|
+ .defval = "0",
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Currently only 8 bits are defined and the max value is 255.
|
|
|
|
|
+ * This needs to be adjusted if more bits are defined.
|
|
|
|
|
+ */
|
|
|
|
|
+ .accept = ACCEPT_ARRAY(ACCEPT_RANGE(0, 255)),
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+static struct attrib dasd_attr_aq_requeue = {
|
|
|
|
|
+ .name = "aq_requeue",
|
|
|
|
|
+ .title = "Control I/O requeing during autoquiesce",
|
|
|
|
|
+ .desc =
|
|
|
|
|
+ "Use the aq_requeue attribute to control whether outstanding I/O\n"
|
|
|
|
|
+ "operations to the blocklayer should be automatically requeued after\n"
|
|
|
|
|
+ "an autoquiesce event.\n"
|
|
|
|
|
+ "Valid values are 1 for requeuing, or 0 for no requeueing.\n"
|
|
|
|
|
+ "Requeing the I/O requests to the blocklayer might benefit I/O\n"
|
|
|
|
|
+ "in case of a copy_pair swap operation.\n",
|
|
|
|
|
+ .order_cmp = ccw_online_only_order_cmp,
|
|
|
|
|
+ .check = ccw_online_only_check,
|
|
|
|
|
+ .defval = "0",
|
|
|
|
|
+ .accept = ACCEPT_ARRAY(ACCEPT_RANGE(0, 1)),
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+static struct attrib dasd_attr_aq_timeouts = {
|
|
|
|
|
+ .name = "aq_timeouts",
|
|
|
|
|
+ .title = "Specify timeout retry threshold",
|
|
|
|
|
+ .desc =
|
|
|
|
|
+ "Specify the number of sequential timeout events for an I/O operation\n"
|
|
|
|
|
+ "before an autoquiesce is triggered on a device.\n"
|
|
|
|
|
+ "This requires that the corresponding trigger bit 6 is set\n"
|
|
|
|
|
+ "in the aq_mask attribute.\n",
|
|
|
|
|
+ .order_cmp = ccw_online_only_order_cmp,
|
|
|
|
|
+ .check = ccw_online_only_check,
|
|
|
|
|
+ .defval = "32768",
|
|
|
|
|
+ .accept = ACCEPT_ARRAY(ACCEPT_RANGE(0, 32768)),
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
/*
|
|
|
|
|
* DASD subtype methods.
|
|
|
|
|
*/
|
|
|
|
|
@@ -725,6 +787,9 @@ struct subtype dasd_subtype_eckd = {
|
|
|
|
|
&dasd_attr_safe_offline,
|
|
|
|
|
&dasd_attr_fc_security,
|
|
|
|
|
&dasd_attr_copy_pair,
|
|
|
|
|
+ &dasd_attr_aq_mask,
|
|
|
|
|
+ &dasd_attr_aq_requeue,
|
|
|
|
|
+ &dasd_attr_aq_timeouts,
|
|
|
|
|
&internal_attr_early,
|
|
|
|
|
),
|
|
|
|
|
.unknown_dev_attribs = 1,
|
|
|
|
|
--
|
2023-07-17 11:36:39 +00:00
|
|
|
|
2.40.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
From 21a9e00ffeb5ef885ad52b73f2724cef6d1ae73d Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: Vineeth Vijayan <vneethv@linux.ibm.com>
|
|
|
|
|
Date: Wed, 7 Jun 2023 14:10:56 +0200
|
|
|
|
|
Subject: [PATCH 2/4] zdev: add proper value input for the ZDEV_SITE_ID key
|
|
|
|
|
(#2223304)
|
|
|
|
|
MIME-Version: 1.0
|
|
|
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
|
|
|
|
|
|
udev does not allow an empty value for keys when importing output
|
|
|
|
|
from an external program. Providing an empty value for any key
|
|
|
|
|
invokes a warning during the parsing. Currently, ZDEV_SITE_ID for
|
|
|
|
|
fallback sites are not assigned any value. Add an empty double
|
|
|
|
|
quotes as the value in case of failover sites.
|
|
|
|
|
|
|
|
|
|
This modification is tested on udevadm version 253 on fedora38.
|
|
|
|
|
|
|
|
|
|
Also verify that the ZDEV_SITE_ID is properly written, if not log
|
|
|
|
|
the error.
|
|
|
|
|
|
|
|
|
|
Fixes: c8ad5f57d0fc ("zdev: modify zdev_id to read the site_id from loadparm")
|
|
|
|
|
Reported-by: Alexander Egorenkov <egorenar@linux.ibm.com>
|
|
|
|
|
Signed-off-by: Vineeth Vijayan <vneethv@linux.ibm.com>
|
|
|
|
|
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
|
|
|
|
|
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
|
|
|
|
|
(cherry picked from commit 27902c91064f5900fa0ae8116d3e1d0bcd9477bc)
|
|
|
|
|
---
|
|
|
|
|
zdev/src/zdev_id.c | 22 +++++++++++++++++-----
|
|
|
|
|
1 file changed, 17 insertions(+), 5 deletions(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/zdev/src/zdev_id.c b/zdev/src/zdev_id.c
|
|
|
|
|
index c341d31..9ad9961 100644
|
|
|
|
|
--- a/zdev/src/zdev_id.c
|
|
|
|
|
+++ b/zdev/src/zdev_id.c
|
|
|
|
|
@@ -213,16 +213,28 @@ out:
|
|
|
|
|
static void write_zdev_site_id(int site_id)
|
|
|
|
|
{
|
|
|
|
|
FILE *fd;
|
|
|
|
|
+ int rc;
|
|
|
|
|
|
|
|
|
|
fd = fopen(ZDEV_SITE_ID_FILE, "w");
|
|
|
|
|
if (!fd)
|
|
|
|
|
- err(1, "Could not write to zdev_site_id file");
|
|
|
|
|
+ goto err;
|
|
|
|
|
+
|
|
|
|
|
if (site_id == SITE_FALLBACK)
|
|
|
|
|
- fprintf(fd, "ZDEV_SITE_ID=\n");
|
|
|
|
|
+ rc = fprintf(fd, "ZDEV_SITE_ID=\"\"\n");
|
|
|
|
|
else
|
|
|
|
|
- fprintf(fd, "ZDEV_SITE_ID=%d\n", site_id);
|
|
|
|
|
+ rc = fprintf(fd, "ZDEV_SITE_ID=%d\n", site_id);
|
|
|
|
|
|
|
|
|
|
- fclose(fd);
|
|
|
|
|
+ if (rc < 0) {
|
|
|
|
|
+ fclose(fd);
|
|
|
|
|
+ goto err;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (fclose(fd))
|
|
|
|
|
+ goto err;
|
|
|
|
|
+
|
|
|
|
|
+ return;
|
|
|
|
|
+err:
|
|
|
|
|
+ err(1, "Could not write to zdev_site_id file");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read the loadparm and extract the current site_id.
|
|
|
|
|
@@ -265,7 +277,7 @@ static void process_loadparm(const char *filename)
|
|
|
|
|
out:
|
|
|
|
|
write_zdev_site_id(site_id);
|
|
|
|
|
if (site_id == SITE_FALLBACK)
|
|
|
|
|
- printf("ZDEV_SITE_ID=\n");
|
|
|
|
|
+ printf("ZDEV_SITE_ID=\"\"\n");
|
|
|
|
|
else
|
|
|
|
|
printf("ZDEV_SITE_ID=%d\n", site_id);
|
|
|
|
|
}
|
|
|
|
|
--
|
|
|
|
|
2.40.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
From 90bab830c617cbecdc51ef9f6f2a19d14e6445c5 Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: Vineeth Vijayan <vneethv@linux.ibm.com>
|
|
|
|
|
Date: Wed, 7 Jun 2023 14:10:57 +0200
|
|
|
|
|
Subject: [PATCH 3/4] zdev: use rename-file to avoid any symlinks created
|
|
|
|
|
(#2223304)
|
|
|
|
|
MIME-Version: 1.0
|
|
|
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
|
|
|
|
|
|
During the boot, the ZDEV_SITE_ID is derived with the help
|
|
|
|
|
of loadparm and will be saved in ZDEV_SITE_ID_FILE, which
|
|
|
|
|
will be the used by the udev-rules.
|
|
|
|
|
|
|
|
|
|
ZDEV_SITE_ID_FILE creation can have a surface of symlink attack
|
|
|
|
|
as we are directly using the fopen and fprintf on it. To avoid
|
|
|
|
|
this, make sure that we are writing the ZDEV_SITE_ID to a temporary
|
|
|
|
|
file, which will then be renamed to ZDEV_SITE_ID_FILE, which will
|
|
|
|
|
remove all the existing symlinks associated with the target file.
|
|
|
|
|
|
|
|
|
|
Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
|
|
|
|
|
Signed-off-by: Vineeth Vijayan <vneethv@linux.ibm.com>
|
|
|
|
|
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
|
|
|
|
|
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
|
|
|
|
|
(cherry picked from commit 09c01e580abc519976c8e20c5d867b3d1a31e062)
|
|
|
|
|
---
|
|
|
|
|
zdev/src/zdev_id.c | 17 +++++++++++++++--
|
|
|
|
|
1 file changed, 15 insertions(+), 2 deletions(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/zdev/src/zdev_id.c b/zdev/src/zdev_id.c
|
|
|
|
|
index 9ad9961..2464b16 100644
|
|
|
|
|
--- a/zdev/src/zdev_id.c
|
|
|
|
|
+++ b/zdev/src/zdev_id.c
|
|
|
|
|
@@ -213,9 +213,16 @@ out:
|
|
|
|
|
static void write_zdev_site_id(int site_id)
|
|
|
|
|
{
|
|
|
|
|
FILE *fd;
|
|
|
|
|
- int rc;
|
|
|
|
|
+ int tmpfd, rc;
|
|
|
|
|
+ const char zdev_id_file[] = ZDEV_SITE_ID_FILE;
|
|
|
|
|
+ char zdev_id_tmpfile[] = ZDEV_SITE_ID_FILE "-XXXXXX";
|
|
|
|
|
|
|
|
|
|
- fd = fopen(ZDEV_SITE_ID_FILE, "w");
|
|
|
|
|
+ tmpfd = mkstemp(zdev_id_tmpfile);
|
|
|
|
|
+ if (tmpfd == -1)
|
|
|
|
|
+ goto err;
|
|
|
|
|
+
|
|
|
|
|
+ /* Open the temp file to use with fprintf */
|
|
|
|
|
+ fd = fdopen(tmpfd, "w");
|
|
|
|
|
if (!fd)
|
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
|
|
@@ -232,6 +239,12 @@ static void write_zdev_site_id(int site_id)
|
|
|
|
|
if (fclose(fd))
|
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
|
|
+ /* Rename the temporary file to ZDEV_SITE_ID_FILE*/
|
|
|
|
|
+ if (rename(zdev_id_tmpfile, zdev_id_file) == -1) {
|
|
|
|
|
+ remove(zdev_id_tmpfile);
|
|
|
|
|
+ goto err;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
return;
|
|
|
|
|
err:
|
|
|
|
|
err(1, "Could not write to zdev_site_id file");
|
|
|
|
|
--
|
|
|
|
|
2.40.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
From 5e9a117d1da306ad13b46612b709d769c792baae Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: Vineeth Vijayan <vneethv@linux.ibm.com>
|
|
|
|
|
Date: Mon, 19 Jun 2023 11:32:15 +0200
|
|
|
|
|
Subject: [PATCH 4/4] zdev: add missing label in the udev-rules (#2222900)
|
|
|
|
|
MIME-Version: 1.0
|
|
|
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
|
|
|
|
|
|
The udev-rules generated with the current version of chzdev command
|
|
|
|
|
is missing the configuration label, incase of auto configuration,
|
|
|
|
|
resulting in an ineffective configuration logic.
|
|
|
|
|
Add the missing configuration start label for autoconfig.
|
|
|
|
|
|
|
|
|
|
Fixes: 2e89722ef0ec ("zdev: make site specific udev-rule for ccw")
|
|
|
|
|
Signed-off-by: Vineeth Vijayan <vneethv@linux.ibm.com>
|
|
|
|
|
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
|
|
|
|
|
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
|
|
|
|
|
(cherry picked from commit 2a1a821bb3941ddd341b52068d5c05e06d907355)
|
|
|
|
|
---
|
|
|
|
|
zdev/src/udev_ccw.c | 1 +
|
|
|
|
|
1 file changed, 1 insertion(+)
|
|
|
|
|
|
|
|
|
|
diff --git a/zdev/src/udev_ccw.c b/zdev/src/udev_ccw.c
|
|
|
|
|
index 3375a5e..1881337 100644
|
|
|
|
|
--- a/zdev/src/udev_ccw.c
|
|
|
|
|
+++ b/zdev/src/udev_ccw.c
|
|
|
|
|
@@ -295,6 +295,7 @@ static exit_code_t udev_ccw_write_device_legacy(struct device *dev, bool autocon
|
|
|
|
|
}
|
|
|
|
|
fprintf(fd, "GOTO=\"%s\"\n", end_label);
|
|
|
|
|
fprintf(fd, "\n");
|
|
|
|
|
+ fprintf(fd, "LABEL=\"%s\"\n", cfg_label);
|
|
|
|
|
|
|
|
|
|
write_attr_to_file(fd, state, id);
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
2.40.1
|
2023-06-01 09:31:08 +00:00
|
|
|
|
|