grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grub-probe detects ext4 wronly as ext2


From: Javier Martín
Subject: Re: grub-probe detects ext4 wronly as ext2
Date: Mon, 30 Jun 2008 05:02:50 +0200

El dom, 29-06-2008 a las 23:19 +0200, Robert Millan escribió:
> On Sun, Jun 29, 2008 at 09:53:50PM +0200, Javier Martín wrote:
> > Ext4 is as of today in development and unstable; in fact, the FS name in
> > Linux is "ext4dev", but I _think_ the on-disk format is already frozen
> > and thus a readonly driver can be written. I'm not saying that we should
> > delay the implementation of such a driver, just the we first need to
> > address the potentially fatal problem of an ext4 FS mounted as ext3/2.
> > No distro enables ext4 by default.
> 
> Yep.  update-grub heavily relies on grub-probe to figure out if a filesystem
> will be accessible, and therefore whether to enable optional features.
> 

Here is the patch I was talking about, one step farther than I had first
envisioned, i.e. not just about ext4 but an (solid?) implementation of
"xenophobia" in the filesystem driver. This code checks the superblock
backwards-incompatible features bitfield against a predefined set of
features that we do support, and refuses to mount the filesystem if
there are any that we don't. In particular, this makes the driver reject
ext4 filesystems with the "extents" option enabled.

As I don't know what INCOMPAT_* features are implemented, I've added the
one I'm sure we do support because it is used in the code: "filetype".
However, someone with insight in the ext2 driver should take a look at
the patch and add all INCOMPAT_* features that we support to the new
define created to that effect: EXT2_DRIVER_SUPPORTED_INCOMPAT. Just OR
the new flags with the one in there. Failure to do so might cause
regressions if this patch is committed (i.e. FS that mounted fine before
will now refuse to do so), but will ensure that we only try to read what
we can.

I've copied the EXTn_FEATURE_* #defines from the Linux kernel headers,
but only two are actually used (filetype and has_journal, which was
already there, presumably to detect ext3 filesystems) - the rest are
there for completion, but can be removed if you deem it better, though
I'd suggest keeping at least the EXTn_FEATURE_INCOMPAT_* macros.

This patch has been tested on a qemu virtual machine, with two ext2
partitions that started identical. I mounted one of them as ext4dev with
the extents option and copied a new file to it, thus enabling the
"extents" bit in the superblock. Without the patch, GRUB would happily
read both partitions as ext2 (I didn't try to read the new file, but
most probably that would have caused some havoc). With the patch, the
ext4 partition is shown as "unknown filesystem". A good changelog entry
might be "fs/ext2.c: ext2 driver will now reject filesystems with
unknown incompatible features". This patch detects only "incompatible"
features, so ext3 devices with internal journal should continue to work
as they did.

Phew, that was all (I hope)
Cheers!

Habbit

Attachment: ext4_unrecognized.diff
Description: Text Data

Attachment: signature.asc
Description: Esta parte del mensaje está firmada digitalmente


reply via email to

[Prev in Thread] Current Thread [Next in Thread]