From: Ryusuke Konishi <konishi.ryusuke@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/5] nilfs2: do not propagate ENOENT error from sufile during recovery
Date: Thu, 22 Aug 2024 00:46:25 +0900 [thread overview]
Message-ID: <20240821154627.11848-4-konishi.ryusuke@gmail.com> (raw)
In-Reply-To: <20240821154627.11848-1-konishi.ryusuke@gmail.com>
nilfs_sufile_free() returns the error code -ENOENT when the block
where the segment usage should be placed does not exist (hole block
case), but this error should not be propagated upwards to the mount
system call.
In nilfs_prepare_segment_for_recovery(), one of the recovery steps
during mount, nilfs_sufile_free() is used and may return -ENOENT as
is, so in that case return -EINVAL instead.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
---
fs/nilfs2/recovery.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c
index 61e25a980f73..cd364cd26a97 100644
--- a/fs/nilfs2/recovery.c
+++ b/fs/nilfs2/recovery.c
@@ -433,8 +433,17 @@ static int nilfs_prepare_segment_for_recovery(struct the_nilfs *nilfs,
* The next segment is invalidated by this recovery.
*/
err = nilfs_sufile_free(sufile, segnum[1]);
- if (unlikely(err))
+ if (unlikely(err)) {
+ if (err == -ENOENT) {
+ nilfs_err(sb,
+ "checkpoint log inconsistency at block %llu (segment %llu): next segment %llu is unallocated",
+ (unsigned long long)nilfs->ns_last_pseg,
+ (unsigned long long)nilfs->ns_segnum,
+ (unsigned long long)segnum[1]);
+ err = -EINVAL;
+ }
goto failed;
+ }
for (i = 1; i < 4; i++) {
err = nilfs_segment_list_add(head, segnum[i]);
--
2.34.1
next prev parent reply other threads:[~2024-08-21 15:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-21 15:46 [PATCH 0/5] nilfs2: prevent unexpected ENOENT propagation Ryusuke Konishi
2024-08-21 15:46 ` [PATCH 1/5] nilfs2: treat missing sufile header block as metadata corruption Ryusuke Konishi
2024-08-21 15:46 ` [PATCH 2/5] nilfs2: treat missing cpfile " Ryusuke Konishi
2024-08-21 15:46 ` Ryusuke Konishi [this message]
2024-08-21 15:46 ` [PATCH 4/5] nilfs2: do not propagate ENOENT error from sufile during GC Ryusuke Konishi
2024-08-21 15:46 ` [PATCH 5/5] nilfs2: do not propagate ENOENT error from nilfs_sufile_mark_dirty() Ryusuke Konishi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240821154627.11848-4-konishi.ryusuke@gmail.com \
--to=konishi.ryusuke@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nilfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox