]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ext4: return EROFS if device is r/o and journal replay is needed
authorTheodore Ts'o <tytso@mit.edu>
Sun, 5 Feb 2017 06:26:48 +0000 (01:26 -0500)
committerJiri Slaby <jslaby@suse.cz>
Mon, 13 Mar 2017 20:40:31 +0000 (21:40 +0100)
commit 4753d8a24d4588657bc0a4cd66d4e282dff15c8c upstream.

If the file system requires journal recovery, and the device is
read-ony, return EROFS to the mount system call.  This allows xfstests
generic/050 to pass.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
fs/ext4/super.c

index 01fc2b14db0e5341b1e7f23bc70198ddb1fc4883..3f19909f5431fba2783bf7511396424c13a8a0dc 100644 (file)
@@ -3977,7 +3977,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
         */
        if (!test_opt(sb, NOLOAD) &&
            EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) {
-               if (ext4_load_journal(sb, es, journal_devnum))
+               err = ext4_load_journal(sb, es, journal_devnum);
+               if (err)
                        goto failed_mount3;
        } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) &&
              EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) {