* [PATCH] ext4: Fix spurious message about orphan cleanup on RO fs
@ 2026-08-03 16:00 Jan Kara
2026-08-04 7:06 ` Tigran Aivazian
2026-08-04 10:53 ` Baokun Li
0 siblings, 2 replies; 3+ messages in thread
From: Jan Kara @ 2026-08-03 16:00 UTC (permalink / raw)
To: Ted Tso; +Cc: linux-ext4, Tigran Aivazian, Jan Kara
When orphan_file feature is enabled, ext4_orphan_cleanup() was always
walking through the orphan file looking for orphan inodes. This is
mostly harmless but for read-only filesystem it results in spurious
"orphan cleanup on readonly fs" message and in other cornercases it
could result in similar somewhat misleading messages. Skip orphan
cleanup if the orphan file is empty to avoid confusing messages.
Fixes: 02f310fcf47f ("ext4: Speedup ext4 orphan inode handling")
Reported-by: Tigran Aivazian <aivazian.tigran@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext4/orphan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/orphan.c b/fs/ext4/orphan.c
index 64ea47624233..2a44998a6c2e 100644
--- a/fs/ext4/orphan.c
+++ b/fs/ext4/orphan.c
@@ -388,7 +388,7 @@ void ext4_orphan_cleanup(struct super_block *sb, struct ext4_super_block *es)
struct ext4_orphan_info *oi = &EXT4_SB(sb)->s_orphan_info;
int inodes_per_ob = ext4_inodes_per_orphan_block(sb);
- if (!es->s_last_orphan && !oi->of_blocks) {
+ if (!es->s_last_orphan && ext4_orphan_file_empty(sb)) {
ext4_debug("no orphan inodes to clean up\n");
return;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: Fix spurious message about orphan cleanup on RO fs
2026-08-03 16:00 [PATCH] ext4: Fix spurious message about orphan cleanup on RO fs Jan Kara
@ 2026-08-04 7:06 ` Tigran Aivazian
2026-08-04 10:53 ` Baokun Li
1 sibling, 0 replies; 3+ messages in thread
From: Tigran Aivazian @ 2026-08-04 7:06 UTC (permalink / raw)
To: Jan Kara; +Cc: Ted Tso, linux-ext4
On Mon, 3 Aug 2026 at 17:01, Jan Kara <jack@suse.cz> wrote:
> diff --git a/fs/ext4/orphan.c b/fs/ext4/orphan.c
> index 64ea47624233..2a44998a6c2e 100644
> --- a/fs/ext4/orphan.c
> +++ b/fs/ext4/orphan.c
> @@ -388,7 +388,7 @@ void ext4_orphan_cleanup(struct super_block *sb, struct ext4_super_block *es)
> struct ext4_orphan_info *oi = &EXT4_SB(sb)->s_orphan_info;
> int inodes_per_ob = ext4_inodes_per_orphan_block(sb);
>
> - if (!es->s_last_orphan && !oi->of_blocks) {
> + if (!es->s_last_orphan && ext4_orphan_file_empty(sb)) {
> ext4_debug("no orphan inodes to clean up\n");
> return;
> }
I have just re-tested my original scenario and confirm what you
asserted in the second half of your earlier email: the "remount,ro"
step in my testing was indeed irrelevant. We would get the spurious
"orphan cleanup on readonly fs" message even with just a normal
"umount /mnt" intervening between the rw and ro mounts of the
filesystem in question. Therefore, your patch above appears to be the
most sensible thing to do in this situation, especially as that code
path uses ext4_debug() but the spurious message is using a stronger
ext4_msg(sb, KERN_INFO,...).
Kind regards,
Tigran
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: Fix spurious message about orphan cleanup on RO fs
2026-08-03 16:00 [PATCH] ext4: Fix spurious message about orphan cleanup on RO fs Jan Kara
2026-08-04 7:06 ` Tigran Aivazian
@ 2026-08-04 10:53 ` Baokun Li
1 sibling, 0 replies; 3+ messages in thread
From: Baokun Li @ 2026-08-04 10:53 UTC (permalink / raw)
To: Jan Kara; +Cc: Ted Tso, linux-ext4, Tigran Aivazian
On 2026/8/4 00:00, Jan Kara wrote:
> When orphan_file feature is enabled, ext4_orphan_cleanup() was always
> walking through the orphan file looking for orphan inodes. This is
> mostly harmless but for read-only filesystem it results in spurious
> "orphan cleanup on readonly fs" message and in other cornercases it
> could result in similar somewhat misleading messages. Skip orphan
> cleanup if the orphan file is empty to avoid confusing messages.
>
> Fixes: 02f310fcf47f ("ext4: Speedup ext4 orphan inode handling")
> Reported-by: Tigran Aivazian <aivazian.tigran@gmail.com>
> Signed-off-by: Jan Kara <jack@suse.cz>
Looks good to me.
Reviewed-by: Baokun Li <libaokun@linux.alibaba.com>
> ---
> fs/ext4/orphan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/orphan.c b/fs/ext4/orphan.c
> index 64ea47624233..2a44998a6c2e 100644
> --- a/fs/ext4/orphan.c
> +++ b/fs/ext4/orphan.c
> @@ -388,7 +388,7 @@ void ext4_orphan_cleanup(struct super_block *sb, struct ext4_super_block *es)
> struct ext4_orphan_info *oi = &EXT4_SB(sb)->s_orphan_info;
> int inodes_per_ob = ext4_inodes_per_orphan_block(sb);
>
> - if (!es->s_last_orphan && !oi->of_blocks) {
> + if (!es->s_last_orphan && ext4_orphan_file_empty(sb)) {
> ext4_debug("no orphan inodes to clean up\n");
> return;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-04 10:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03 16:00 [PATCH] ext4: Fix spurious message about orphan cleanup on RO fs Jan Kara
2026-08-04 7:06 ` Tigran Aivazian
2026-08-04 10:53 ` Baokun Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox