Skip to contentSkip to conversation

ext4: Fix spurious message about orphan cleanup on RO fs

PATCH Applied Jan Kara 4 participants 4 messages Aug 3 – Aug 6 ext4 file system

lore
Share & tools
lore

Jan Kara

author reviewer
#0 lore raw

PATCH 1/1 ext4: Fix spurious message about orphan cleanup on RO fs

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")
---
 fs/ext4/orphan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/orphan.c +1 -1
index 64ea47624233..2a44998a6c2e 100644
@@ -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;
 	}
Signature · 1 line
2.51.0
#1 lore raw

fs/ext4/orphan.c void ext4_orphan_cleanup(struct super_block *sb, struct ext4_super_block *es) · line 394

Quoted 13 lines · Jan Kara
fs/ext4/orphan.c +1 -1
index 64ea47624233..2a44998a6c2e 100644
@@ -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

reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Jan Kara
Quoted 10 lines · 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")

Looks good to me.

Quoted 17 lines
---
 fs/ext4/orphan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/orphan.c +1 -1
index 64ea47624233..2a44998a6c2e 100644
@@ -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;
 	}
maintainer Applied
#3 lore raw
In reply to Jan Kara
Quoted 8 lines · 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.

[...]

Applied, thanks!

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

      commit: 5aa98f874c013bcce9bb84ffded2f0ef886e4e33

Best regards,

Signature · 1 line
Theodore Ts'o <[email protected]>