All of lore.kernel.org
 help / color / mirror / Atom feed
* [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
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ 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] 4+ 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
  2026-08-06 15:00 ` Theodore Ts'o
  2 siblings, 0 replies; 4+ 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] 4+ 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
  2026-08-06 15:00 ` Theodore Ts'o
  2 siblings, 0 replies; 4+ 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] 4+ 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
@ 2026-08-06 15:00 ` Theodore Ts'o
  2 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2026-08-06 15:00 UTC (permalink / raw)
  To: Jan Kara; +Cc: Theodore Ts'o, linux-ext4, Tigran Aivazian


On Mon, 03 Aug 2026 18:00:38 +0200, 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.
> 
> [...]

Applied, thanks!

[1/1] ext4: Fix spurious message about orphan cleanup on RO fs
      commit: 5aa98f874c013bcce9bb84ffded2f0ef886e4e33

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-06 15:01 UTC | newest]

Thread overview: 4+ 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
2026-08-06 15:00 ` Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.