From 41250df49ae0886d19beda048752108429cb0624 Mon Sep 17 00:00:00 2001 From: songliyang Date: Fri, 21 Mar 2025 15:37:22 +0800 Subject: [PATCH] Implement the count of the path state delayed --- ...ment-the-count-of-the-path-state-del.patch | 74 +++++++++++++++++++ multipath-tools.spec | 6 +- 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 0023-multipathd-implement-the-count-of-the-path-state-del.patch diff --git a/0023-multipathd-implement-the-count-of-the-path-state-del.patch b/0023-multipathd-implement-the-count-of-the-path-state-del.patch new file mode 100644 index 0000000..0987755 --- /dev/null +++ b/0023-multipathd-implement-the-count-of-the-path-state-del.patch @@ -0,0 +1,74 @@ +From a50b6f2e8592e70eb3ed86b2adc5f7386aeae65b Mon Sep 17 00:00:00 2001 +From: Kou Wenqi +Date: Thu, 10 Oct 2024 22:03:33 +0800 +Subject: [PATCH] multipathd: implement the count of the path state delayed + +Count the number of times the path state changes from +other (except i/o pending) to delayed. + + # multipathd show paths format "%d %t %T %0 %1" + dev dm_st chk_st failures delayed count + sdb active ready 2 1 + sdc active ready 0 0 +--- + libmultipath/print.c | 7 +++++++ + libmultipath/structs.h | 1 + + multipathd/main.c | 5 +++++ + 3 files changed, 13 insertions(+) + +diff --git a/libmultipath/print.c b/libmultipath/print.c +index 3193dbe..6b91421 100644 +--- a/libmultipath/print.c ++++ b/libmultipath/print.c +@@ -782,6 +782,12 @@ snprint_path_vpd_data(struct strbuf *buff, const struct path * pp) + return append_strbuf_str(buff, "[undef]"); + } + ++static int ++snprint_delayed_count(struct strbuf *buff, const struct path * pp) ++{ ++ return snprint_int(buff, pp ? pp->delayedcount : -1); ++} ++ + static const struct multipath_data mpd[] = { + {'n', "name", snprint_name}, + {'w', "uuid", snprint_multipath_uuid}, +@@ -836,6 +842,7 @@ static const struct path_data pd[] = { + {'P', "protocol", snprint_path_protocol}, + {'I', "init_st", snprint_initialized}, + {'L', "LUN hex", snprint_path_lunhex}, ++ {'1', "delayed count", snprint_delayed_count}, + }; + + static const struct pathgroup_data pgd[] = { +diff --git a/libmultipath/structs.h b/libmultipath/structs.h +index 67ba572..bf497c5 100644 +--- a/libmultipath/structs.h ++++ b/libmultipath/structs.h +@@ -339,6 +339,7 @@ struct path { + int dmstate; + int chkrstate; + int failcount; ++ int delayedcount; + int priority; + int pgindex; + int detect_prio; +diff --git a/multipathd/main.c b/multipathd/main.c +index aa5d1ae..01b6324 100644 +--- a/multipathd/main.c ++++ b/multipathd/main.c +@@ -2460,6 +2460,11 @@ check_path (struct vectors * vecs, struct path * pp, unsigned int ticks) + * so that this path can be recovered + * in time */ + pp->tick = 1; ++ if (pp->state != PATH_DELAYED && pp->state != PATH_PENDING) { ++ condlog(2, "the state of path %s in map %s changes to delayed", ++ pp->dev_t, pp->mpp->alias); ++ pp->delayedcount++; ++ } + pp->state = PATH_DELAYED; + return 1; + } +-- +2.27.0 + diff --git a/multipath-tools.spec b/multipath-tools.spec index 909a462..de021ae 100644 --- a/multipath-tools.spec +++ b/multipath-tools.spec @@ -1,7 +1,7 @@ #needsrootforbuild Name: multipath-tools Version: 0.9.5 -Release: 7 +Release: 8 Summary: Tools to manage multipath devices with the device-mapper License: GPL-2.0-or-later and LGPL-2.0-only URL: http://christophe.varoqui.free.fr/ @@ -31,6 +31,7 @@ Patch19: 0019-libmultipath-sysfs_set_scsi_tmo-do-nothing-for-ACT_D.patch Patch20: 0020-multipath.conf.5-fix-documentation-for-find_multipat.patch Patch21: 0021-multipath.conf.5-fix-the-description-of-prio_args-fo.patch Patch22: 0022-multipath-display-the-correct-configuration-when-dum.patch +Patch23: 0023-multipathd-implement-the-count-of-the-path-state-del.patch BuildRequires: multipath-tools, libcmocka, libcmocka-devel BuildRequires: gcc, libaio-devel, userspace-rcu-devel, device-mapper-devel >= 1.02.89 @@ -185,6 +186,9 @@ fi %changelog +* Fri Mar 21 2025 songliyang - 0.9.5-8 +- Implement the count of the path state delayed + * Tue Aug 27 2024 kouwenqi - 0.9.5-7 - sync patch22 with community -- Gitee