Bug 186854 - [ext2fs] [patch] allow mounting an ext4 file system with uninit_bg and flex_bg in read-only mode
Summary: [ext2fs] [patch] allow mounting an ext4 file system with uninit_bg and flex_b...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: Pedro F. Giffuni
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-18 03:40 UTC by gnehzuil
Modified: 2014-04-17 02:13 UTC (History)
0 users

See Also:


Attachments
file.txt (2.64 KB, text/plain)
2014-02-18 03:40 UTC, gnehzuil
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description gnehzuil 2014-02-18 03:40:00 UTC
Currently ext2fs driver has ability to access a ext4 file system in
read-only mode under some specific features.  But it couldn't mount a
ext4 file system that is created from scratch because uninit_bg and
flex_bg features will be enabled by default.  Hence the user would be
trouble with this if he/she wants to access a ext4 file system with
default features in read-only mode.

This patch tries to fix this issue.  In the patch, all we need to do
is to define a new flag set called 'EXT4F_RO_INCOMPAT_SUPP' in order
to prevent the user from trying to mount a ext4 file system in read-
write mode and do some sanity check.

uninit_bg is a read-only compatible feature in ext4.  It is used to
mark which block group is uninitialised.  This feature can save the
time when a user creates a ext4 file system because 'mkfs' doesn't try
to zero out inode/block bitmap and inode table.  Meanwhile 'fsck' will
skip uninitialised block group for the same purpose.

flex_bg is an incompatible feature in ext4.  It tries to put multiple
block groups tie together as one logical block group [1].  After enabling
this feature we will get more continuous disk space.

1. https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout#Flexible_Block_Groups

Fix: The attached patch tries to fix this problem.

Patch attached with submission follows:
How-To-Repeat: mkfs.ext4 ${DEV}
mount -t ext2fs -ro ${DEV} ${MNT}

The user will get an error message when he/she tries to mount a ext4 file system due to some unsupported features.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2014-04-16 03:09:05 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 2 Pedro F. Giffuni freebsd_committer freebsd_triage 2014-04-17 02:10:51 UTC
State Changed
From-To: open->closed

Variant committed as r262346 and MFC'd, 

Thank you for your contribution! 


Comment 3 Pedro F. Giffuni freebsd_committer freebsd_triage 2014-04-17 02:10:51 UTC
Responsible Changed
From-To: freebsd-fs->pfg

Grab it as I committed a variant already.