diff mbox

ext4: force ro mount if ext3_setup_super() fails

Message ID 4FBE693F.6090705@redhat.com
State Superseded, archived
Headers show

Commit Message

Eric Sandeen May 24, 2012, 5 p.m. UTC
If ext4_setup_super() fails i.e. due to a too-high revision,
the error is logged in dmesg but the fs is not mounted RO as
indicated.

Tested by:

# mkfs.ext4 -r 4 /dev/sdb6
# mount /dev/sdb6 /mnt/test
# dmesg | grep "too high"
[164919.759248] EXT4-fs (sdb6): revision level too high, forcing read-only mode
# grep sdb6 /proc/mounts
/dev/sdb6 /mnt/test2 ext4 rw,seclabel,relatime,data=ordered 0 0
                          ^^

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---


--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Andreas Dilger May 24, 2012, 5:30 p.m. UTC | #1
On 2012-05-24, at 11:00 AM, Eric Sandeen wrote:
> If ext4_setup_super() fails i.e. due to a too-high revision,
> the error is logged in dmesg but the fs is not mounted RO as
> indicated.
> 
> Tested by:
> 
> # mkfs.ext4 -r 4 /dev/sdb6
> # mount /dev/sdb6 /mnt/test
> # dmesg | grep "too high"
> [164919.759248] EXT4-fs (sdb6): revision level too high, forcing read-only mode
> # grep sdb6 /proc/mounts
> /dev/sdb6 /mnt/test2 ext4 rw,seclabel,relatime,data=ordered 0 0
>                          ^^
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Reviewed-by: Andreas Dilger <adilger@whamcloud.com>

> ---
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index e1fb1d5..be67c0b 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -3592,7 +3592,8 @@ no_journal:
> 		goto failed_mount4;
> 	}
> 
> -	ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY);
> +	if (ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY))
> +		sb->s_flags |= MS_RDONLY;
> 
> 	/* determine the minimum size of new large inodes, if present */
> 	if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) {
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cheers, Andreas





--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index e1fb1d5..be67c0b 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3592,7 +3592,8 @@  no_journal:
 		goto failed_mount4;
 	}
 
-	ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY);
+	if (ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY))
+		sb->s_flags |= MS_RDONLY;
 
 	/* determine the minimum size of new large inodes, if present */
 	if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) {