Skip to content

Commit 2ea0fcc

Browse files
tytsogregkh
authored andcommitted
ext4: don't try to clear the orphan_present feature block device is r/o
commit c5e104a upstream. When the file system is frozen in preparation for taking an LVM snapshot, the journal is checkpointed and if the orphan_file feature is enabled, and the orphan file is empty, we clear the orphan_present feature flag. But if there are pending inodes that need to be removed the orphan_present feature flag can't be cleared. The problem comes if the block device is read-only. In that case, we can't process the orphan inode list, so it is skipped in ext4_orphan_cleanup(). But then in ext4_mark_recovery_complete(), this results in the ext4 error "Orphan file not empty on read-only fs" firing and the file system mount is aborted. Fix this by clearing the needs_recovery flag in the block device is read-only. We do this after the call to ext4_load_and_init-journal() since there are some error checks need to be done in case the journal needs to be replayed and the block device is read-only, or if the block device containing the externa journal is read-only, etc. Cc: stable@kernel.org Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1108271 Cc: stable@vger.kernel.org Fixes: 02f310f ("ext4: Speedup ext4 orphan inode handling") Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent dea93e9 commit 2ea0fcc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/ext4/super.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5414,6 +5414,8 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
54145414
err = ext4_load_and_init_journal(sb, es, ctx);
54155415
if (err)
54165416
goto failed_mount3a;
5417+
if (bdev_read_only(sb->s_bdev))
5418+
needs_recovery = 0;
54175419
} else if (test_opt(sb, NOLOAD) && !sb_rdonly(sb) &&
54185420
ext4_has_feature_journal_needs_recovery(sb)) {
54195421
ext4_msg(sb, KERN_ERR, "required journal recovery "

0 commit comments

Comments
 (0)