From cee99716abd5c00b9d0a89f0a517ba5277a84528 Mon Sep 17 00:00:00 2001 From: heming zhao Date: Wed, 23 Mar 2022 07:41:31 +0000 Subject: [PATCH] Accepting request 964023 from home:hmzhao:branches:network:ha-clustering:Factory - fsck.ocfs2: do not try locking after replaying journals if -F is given (bsc#1196705) + fsck.ocfs2-do-not-try-locking-after-replaying-journa.patch OBS-URL: https://build.opensuse.org/request/show/964023 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=145 --- ...t-try-locking-after-replaying-journa.patch | 54 +++++++++++++++++++ ocfs2-tools.changes | 6 +++ ocfs2-tools.spec | 2 + 3 files changed, 62 insertions(+) create mode 100644 fsck.ocfs2-do-not-try-locking-after-replaying-journa.patch diff --git a/fsck.ocfs2-do-not-try-locking-after-replaying-journa.patch b/fsck.ocfs2-do-not-try-locking-after-replaying-journa.patch new file mode 100644 index 0000000..aa78ffb --- /dev/null +++ b/fsck.ocfs2-do-not-try-locking-after-replaying-journa.patch @@ -0,0 +1,54 @@ +From 7085e9177adc7197250d872c50a05dfc9c531bdc Mon Sep 17 00:00:00 2001 +From: Konstantin N +Date: Thu, 3 Mar 2022 00:56:44 +0300 +Subject: [PATCH] fsck.ocfs2: do not try locking after replaying journals if -F + is given + +With -F option, `fsck.ocfs2` skips locking down the cluster, but not if +the journals are replayed. If it has to replay the journals then it +tries to lock down the cluster regardless of -F. + +This fix moves the check to `fsck_lock_fs()` function so the flag +is checked in any case when cluster locking is attempted. + +Signed-off-by: Konstantin Neshin +--- + fsck.ocfs2/fsck.c | 15 ++++++++------- + 1 file changed, 8 insertions(+), 7 deletions(-) + +diff --git a/fsck.ocfs2/fsck.c b/fsck.ocfs2/fsck.c +index 757224f43846..13d68f9862f9 100644 +--- a/fsck.ocfs2/fsck.c ++++ b/fsck.ocfs2/fsck.c +@@ -707,6 +707,10 @@ static errcode_t fsck_lock_fs(o2fsck_state *ost) + { + errcode_t ret; + ++ if (!(ost->ost_fs->fs_flags & OCFS2_FLAG_RW) || ost->ost_skip_o2cb || ++ ocfs2_mount_local(ost->ost_fs)) ++ return 0; ++ + ret = o2cb_init(); + if (ret) { + com_err(whoami, ret, "while initializing the cluster"); +@@ -986,13 +990,10 @@ int main(int argc, char **argv) + goto out; + } + +- if (open_flags & OCFS2_FLAG_RW && !ost->ost_skip_o2cb && +- !ocfs2_mount_local(ost->ost_fs)) { +- ret = fsck_lock_fs(ost); +- if (ret) { +- fsck_mask |= FSCK_ERROR; +- goto close; +- } ++ ret = fsck_lock_fs(ost); ++ if (ret) { ++ fsck_mask |= FSCK_ERROR; ++ goto close; + } + + printf("Checking OCFS2 filesystem in %s:\n", filename); +-- +2.34.1 + diff --git a/ocfs2-tools.changes b/ocfs2-tools.changes index e288e4b..196d9a5 100644 --- a/ocfs2-tools.changes +++ b/ocfs2-tools.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Mar 22 14:40:00 UTC 2022 - heming.zhao@suse.com + +- fsck.ocfs2: do not try locking after replaying journals if -F is given (bsc#1196705) + + fsck.ocfs2-do-not-try-locking-after-replaying-journa.patch + ------------------------------------------------------------------- Fri Nov 12 14:20:25 UTC 2021 - ghe@suse.com diff --git a/ocfs2-tools.spec b/ocfs2-tools.spec index 575efe4..b174221 100644 --- a/ocfs2-tools.spec +++ b/ocfs2-tools.spec @@ -58,6 +58,7 @@ 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 Patch503: libocfs2-roll-back-when-dir_index-creation-fails.patch +Patch504: fsck.ocfs2-do-not-try-locking-after-replaying-journa.patch BuildRequires: autoconf BuildRequires: e2fsprogs-devel @@ -168,6 +169,7 @@ OCFS2 filesystem. %patch501 -p1 %patch502 -p1 %patch503 -p1 +%patch504 -p1 %build %global _lto_cflags %{_lto_cflags} -ffat-lto-objects