ext4: reflect error codes from ext4_multi_mount_protect() to its callers
[linux-block.git] / fs / ext4 / super.c
index 8ed6450effaa3b542f7810a247932fe1891f3dab..c8ae6b7e8615980034d7efb888e68a4fbc67c2fb 100644 (file)
@@ -5328,9 +5328,11 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
                          ext4_has_feature_orphan_present(sb) ||
                          ext4_has_feature_journal_needs_recovery(sb));
 
-       if (ext4_has_feature_mmp(sb) && !sb_rdonly(sb))
-               if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block)))
+       if (ext4_has_feature_mmp(sb) && !sb_rdonly(sb)) {
+               err = ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block));
+               if (err)
                        goto failed_mount3a;
+       }
 
        /*
         * The first inode we look at is the journal inode.  Don't try
@@ -6565,12 +6567,12 @@ static int __ext4_remount(struct fs_context *fc, struct super_block *sb)
                                goto restore_opts;
 
                        sb->s_flags &= ~SB_RDONLY;
-                       if (ext4_has_feature_mmp(sb))
-                               if (ext4_multi_mount_protect(sb,
-                                               le64_to_cpu(es->s_mmp_block))) {
-                                       err = -EROFS;
+                       if (ext4_has_feature_mmp(sb)) {
+                               err = ext4_multi_mount_protect(sb,
+                                               le64_to_cpu(es->s_mmp_block));
+                               if (err)
                                        goto restore_opts;
-                               }
+                       }
 #ifdef CONFIG_QUOTA
                        enable_quota = 1;
 #endif