Accepting request 927736 from network:ha-clustering:Factory

OBS-URL: https://build.opensuse.org/request/show/927736
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ocfs2-tools?expand=0&rev=80
This commit is contained in:
Dominique Leuenberger 2021-10-27 20:21:16 +00:00 committed by Git OBS Bridge
commit 8c975587ea
4 changed files with 83 additions and 1 deletions

View File

@ -0,0 +1,45 @@
From 34888925e54a210cb0e7989eef57ea8041fbc9e8 Mon Sep 17 00:00:00 2001
From: Kastixx <b.m.kast@gmail.com>
Date: Tue, 19 Oct 2021 01:32:14 +0300
Subject: [PATCH 1/2] Fixed `mounted.ocfs2` output when some devices are Not
Ready
When `mounted.ocfs2 -d` (quick scan) encounters a device in Not Ready state, it tries to read the device, fails, and in theory should skip it and proceed to the next one. However, due to an integer comparison with mixed signedness it does not break out of a read loop when `do_pread` returns an error code (-1), and fills the structure for current file system with the data that is left in the buffer from the previous file system.
In such conditions, the command produces the following output:
```
# these two devices are working
/dev/mapper/360000970000197600444533037353334_part1 pcmk hacluster B9223C9922754CE88236EDDE6B281D15 ALPHA
/dev/mapper/360000970000197600444533037353335_part1 pcmk hacluster ACAC4B66517D4EDEA6FA8A9D8E9FC9CF BETA
# these two are not ready
/dev/mapper/360000970000197600444533037423031 pcmk hacluster ACAC4B66517D4EDEA6FA8A9D8E9FC9CF BETA
/dev/mapper/360000970000197600444533037423032 pcmk hacluster ACAC4B66517D4EDEA6FA8A9D8E9FC9CF BETA
# this one is OK
/dev/mapper/360000970000197600444533037423030_part1 pcmk hacluster 7A0C73F5A4C04135874F307384D3F67E GAMMA
# these two are not ready again
/dev/mapper/360000970000197600444533037423033 pcmk hacluster 7A0C73F5A4C04135874F307384D3F67E GAMMA
/dev/mapper/360000970000197600444533037423034 pcmk hacluster 7A0C73F5A4C04135874F307384D3F67E GAMMA
```
Here, labels and UUIDs for offline devices are the same as for preceding active ones.
The fix converts the unsigned value returned by `sizeof` to signed integer explicitly.
---
mounted.ocfs2/mounted.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mounted.ocfs2/mounted.c b/mounted.ocfs2/mounted.c
index 8902fe0c..4fc53da5 100644
--- a/mounted.ocfs2/mounted.c
+++ b/mounted.ocfs2/mounted.c
@@ -530,7 +530,7 @@ static void do_quick_detect(struct list_head *dev_list)
for (offset = 1; offset <= 8; offset <<= 1) {
ret = do_pread(fd, buf, sizeof(buf), (offset * 1024));
- if (ret < sizeof(buf))
+ if (ret < (int) sizeof(buf))
break;
di = (struct ocfs2_dinode *)buf;
if (!memcmp(di->i_signature,
--
2.12.3

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Oct 27 10:20:20 UTC 2021 - ghe@suse.com
- Fix mounted.ocfs2 output when some devices are not ready (bsc#1191810)
+ fixed-mounted.ocfs2-output-when-some-devices-are-Not.patch
+ update-mounted.ocfs2-mounted.c.patch
-------------------------------------------------------------------
Wed May 26 10:32:30 UTC 2021 - ghe@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package ocfs2-tools
#
# Copyright (c) 2021 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -55,6 +55,8 @@ Patch225: 0004-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch
Patch228: 0007-Improve-error-message-if-DLM-service-is-unavailable.patch
Patch405: 0007-vendor-Add-vendor-files-for-sles12.patch
Patch406: 0008-ocfs2-tools-add-systemd-support-fix.patch
Patch501: fixed-mounted.ocfs2-output-when-some-devices-are-Not.patch
Patch502: update-mounted.ocfs2-mounted.c.patch
BuildRequires: autoconf
BuildRequires: e2fsprogs-devel
@ -162,6 +164,8 @@ OCFS2 filesystem.
%patch228 -p1
%patch405 -p1
%patch406 -p1
%patch501 -p1
%patch502 -p1
%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects

View File

@ -0,0 +1,26 @@
From 2fad0b521e244844a6a95e9f1df6201f5f51a203 Mon Sep 17 00:00:00 2001
From: Kastixx <b.m.kast@gmail.com>
Date: Tue, 19 Oct 2021 12:50:19 +0300
Subject: [PATCH 2/2] Update mounted.ocfs2/mounted.c
Co-authored-by: Yuri Kotov <jura.kotov@gmail.com>
---
mounted.ocfs2/mounted.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mounted.ocfs2/mounted.c b/mounted.ocfs2/mounted.c
index 4fc53da5..4e399910 100644
--- a/mounted.ocfs2/mounted.c
+++ b/mounted.ocfs2/mounted.c
@@ -530,7 +530,7 @@ static void do_quick_detect(struct list_head *dev_list)
for (offset = 1; offset <= 8; offset <<= 1) {
ret = do_pread(fd, buf, sizeof(buf), (offset * 1024));
- if (ret < (int) sizeof(buf))
+ if (ret == -1 || ret != sizeof(buf))
break;
di = (struct ocfs2_dinode *)buf;
if (!memcmp(di->i_signature,
--
2.12.3