add tytso's DCO
[ext4-patch-queue.git] / return-erofs-for-recovery-when-device-readonly
blob9b6284412abe8ebc3ca03131fc30f450f6a2a4ab
1 ext4: return EROFS if device is r/o and journal replay is needed
3 If the file system requires journal recovery, and the device is
4 read-ony, return EROFS to the mount system call.  This allows xfstests
5 generic/050 to pass.
7 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 Cc: stable@vger.kernel.org
9 ---
10  fs/ext4/super.c | 3 ++-
11  1 file changed, 2 insertions(+), 1 deletion(-)
13 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
14 index 3fef82e79131..514e5fc59893 100644
15 --- a/fs/ext4/super.c
16 +++ b/fs/ext4/super.c
17 @@ -3925,7 +3925,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
18          * root first: it may be modified in the journal!
19          */
20         if (!test_opt(sb, NOLOAD) && ext4_has_feature_journal(sb)) {
21 -               if (ext4_load_journal(sb, es, journal_devnum))
22 +               err = ext4_load_journal(sb, es, journal_devnum);
23 +               if (err)
24                         goto failed_mount3a;
25         } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) &&
26                    ext4_has_feature_journal_needs_recovery(sb)) {