From e74e8e9b62d6dd22b9bf68577030233b0551926a Mon Sep 17 00:00:00 2001 From: liyuan Date: Thu, 21 Dec 2023 16:16:45 +0800 Subject: [PATCH] backport fcoe-utils: Fix get_ctlr_num() for large ctlr_* indices --- ...get_ctlr_num-for-large-ctlr_-indices.patch | 34 +++++++++++++++++++ fcoe-utils.spec | 6 +++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 0001-fcoe-utils-Fix-get_ctlr_num-for-large-ctlr_-indices.patch diff --git a/0001-fcoe-utils-Fix-get_ctlr_num-for-large-ctlr_-indices.patch b/0001-fcoe-utils-Fix-get_ctlr_num-for-large-ctlr_-indices.patch new file mode 100644 index 0000000..12889b8 --- /dev/null +++ b/0001-fcoe-utils-Fix-get_ctlr_num-for-large-ctlr_-indices.patch @@ -0,0 +1,34 @@ +From f369a89e914eb1f14b26d6e84fa32fdf8a591cfc Mon Sep 17 00:00:00 2001 +From: Andrey Grafin +Date: Mon, 18 Sep 2017 17:35:08 +0300 +Subject: [PATCH] fcoe-utils: Fix get_ctlr_num() for large ctlr_* indices + +Each creation of a FCoE device increases counter which is used as a suffix +in a FCoE device name in sysfs (i.e. /sys/bus/fcoe/devices/ctlr_1). +Once this counter reaches the value of two digits (10 and larger), +get_ctlr_num() stopped working properly and a command like `fcoeadm -i` +which depends on get_ctlr_num() call doesn't show anything. +This patch solves this problem. + +Signed-off-by: Andrey Grafin +Signed-off-by: Johannes Thumshirn +--- + lib/sysfs_hba.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/sysfs_hba.c b/lib/sysfs_hba.c +index 5cb7fd3fa5d..786215440ba 100644 +--- a/lib/sysfs_hba.c ++++ b/lib/sysfs_hba.c +@@ -606,7 +606,7 @@ static int get_ctlr_num(const char *netdev) + if (!ctlr) + continue; + +- ctlr_num = atoi(&ctlr[strlen(ctlr) - 1]); ++ ctlr_num = atoi(&ctlr[sizeof("ctlr_") - 1]); + break; + } + +-- +2.33.0 + diff --git a/fcoe-utils.spec b/fcoe-utils.spec index c338ef9..879bc96 100644 --- a/fcoe-utils.spec +++ b/fcoe-utils.spec @@ -1,6 +1,6 @@ Name: fcoe-utils Version: 1.0.32 -Release: 7 +Release: 8 Summary: Fibre Channel over Ethernet utilities License: GPLv2 URL: https://www.open-fcoe.org @@ -10,6 +10,7 @@ Source2: fcoe.service Source3: fcoe.config Patch0: fcoe-utils-gcc7-fmt-truc-err.patch Patch1: fcoe-utils-gcc8-fmt-truc-err.patch +Patch2: 0001-fcoe-utils-Fix-get_ctlr_num-for-large-ctlr_-indices.patch BuildRequires: autoconf automake libpciaccess-devel libtool lldpad-devel systemd Requires: lldpad iproute device-mapper-multipath @@ -69,6 +70,9 @@ rm -f %{buildroot}/%{_sysconfdir}/fcoe/config %{_mandir}/man8/* %changelog +* Thu Dec 21 2023 liyuanyuan - 1.0.32-8 +- fcoe-utils: Fix get_ctlr_num() for large ctlr_* indices + * Fri Oct 11 2019 openEuler Buildteam - 1.0.32-7 - Package init -- Gitee