Re: [PATCH] ext4: Fix spurious message about orphan cleanup on RO fs

Baokun Li <[email protected]> Tue, 4 Aug 2026 18:53:00 +0800
Newsgroups org.kernel.vger.linux-ext4
Message-ID <[email protected]>
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 <[email protected]>
> Signed-off-by: Jan Kara <[email protected]>

Looks good to me.

Reviewed-by: Baokun Li <[email protected]>

> ---
>  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;
>  	}