Commit ead6596b authored by Eric Sandeen's avatar Eric Sandeen Committed by Linus Torvalds

[PATCH] ext4: refuse ro to rw remount of fs with orphan inodes

In the rare case where we have skipped orphan inode processing due to a
readonly block device, and the block device subsequently changes back to
read-write, disallow a remount,rw transition of the filesystem when we have an
unprocessed orphan inodes as this would corrupt the list.

Ideally we should process the orphan inode list during the remount, but that's
trickier, and this plugs the hole for now.
Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
Cc: "Stephen C. Tweedie" <sct@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ea9a05a1
...@@ -2419,6 +2419,22 @@ static int ext4_remount (struct super_block * sb, int * flags, char * data) ...@@ -2419,6 +2419,22 @@ static int ext4_remount (struct super_block * sb, int * flags, char * data)
err = -EROFS; err = -EROFS;
goto restore_opts; goto restore_opts;
} }
/*
* If we have an unprocessed orphan list hanging
* around from a previously readonly bdev mount,
* require a full umount/remount for now.
*/
if (es->s_last_orphan) {
printk(KERN_WARNING "EXT4-fs: %s: couldn't "
"remount RDWR because of unprocessed "
"orphan inode list. Please "
"umount/remount instead.\n",
sb->s_id);
err = -EINVAL;
goto restore_opts;
}
/* /*
* Mounting a RDONLY partition read-write, so reread * Mounting a RDONLY partition read-write, so reread
* and store the current valid flag. (It may have * and store the current valid flag. (It may have
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment