forked from pool/ocfs2-tools
55 lines
1.5 KiB
Diff
55 lines
1.5 KiB
Diff
|
From 7085e9177adc7197250d872c50a05dfc9c531bdc Mon Sep 17 00:00:00 2001
|
||
|
From: Konstantin N <b.m.kast@gmail.com>
|
||
|
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 <b.m.kast@gmail.com>
|
||
|
---
|
||
|
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
|
||
|
|