2010-10-06 02:45:23

by Akira Fujita

[permalink] [raw]
Subject: [BUG] ext3/ext4 migration problem with dir_nlink feature flag

Hi,

I found a bug which returns EIO by file access on ext3 (was ext4) whose
dir_nlink feature flag is removed and has more than 64000 directories.
Kernel: 2.6.36-rc6, e2fsprogs: 1.41.2
Steps to reproduce are as follows:

1. Create ext4 which does not have extent and flex_bg feature flags
(Because this fs will be mounted as ext3 in step 3),
then create more than 64000 directories.
Therefore dir_nlink feature flag is set and link count becomes 1.
2. Remove dir_nlink feature flag with tune2fs command
(e.g. tune2fs -O ^dir_nlink /dev/sdx).
3. Mount ext4 as ext3, then remove subdir (Link: 1->0).
We cannot access parent directory, because link count goes wrong.

We should disallow tune2fs command to remove dir_nlink feature flag.

Regards,
Akira Fujita



2011-01-21 07:34:46

by Akira Fujita

[permalink] [raw]
Subject: Re: [BUG] ext3/ext4 migration problem with dir_nlink feature flag

Hi,

Unfortunately, this bug still exists in 2.6.38-rc1 with e2fsprogs-1.41.13.
Attached test program can reproduce this bug easily.
Please have a look and try.

Regards,
Akira Fujita

(2010/10/06 11:44), Akira Fujita wrote:
> Hi,
>
> I found a bug which returns EIO by file access on ext3 (was ext4) whose
> dir_nlink feature flag is removed and has more than 64000 directories.
> Kernel: 2.6.36-rc6, e2fsprogs: 1.41.2
> Steps to reproduce are as follows:
>
> 1. Create ext4 which does not have extent and flex_bg feature flags
> (Because this fs will be mounted as ext3 in step 3),
> then create more than 64000 directories.
> Therefore dir_nlink feature flag is set and link count becomes 1.
> 2. Remove dir_nlink feature flag with tune2fs command
> (e.g. tune2fs -O ^dir_nlink /dev/sdx).
> 3. Mount ext4 as ext3, then remove subdir (Link: 1->0).
> We cannot access parent directory, because link count goes wrong.
>
> We should disallow tune2fs command to remove dir_nlink feature flag.
>
> Regards,
> Akira Fujita
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>


Attachments:
dir_nlink.sh (1.28 kB)