[U-Boot] UBIFS mount bug when mounting from multiple MTD partitions

Heiko Schocher hs at denx.de
Wed Apr 10 12:44:50 UTC 2019


Hello Frieder,

Am 10.04.2019 um 12:49 schrieb Schrempf Frieder:
> Hi,
> 
> I have a customer who has a NAND device with two MTD partitions and each > of the partitions contains one UBI volume with a UBIFS filesystem.

Bad idea ... why?

You may loose lifetime of the board, as UBI cannot use PEBs between the
2 MTD partitions on the nand ... better you would have one big MTD Partition
with n ubi volumes in it ...

But ... okay... this must work also.

> Now U-Boot can mount the UBIFS from the first partition just fine, but
> if the UBIFS from the second partition is mounted afterwards this fails
> in some cases.

:-(

> I can reproduce the error and tracked it down to uboot_ubifs_mount() in
> fs/ubifs/super.c. If this function is run for the second mount, the
> struct ubifs_fs_type is reused and it contains a list fs_supers, that
> still holds one entry for the first mount.

Sure?

fs_supers in struct file_system_type seems used only in none
U-Boot code...

> I guess, that if the second mount would happen on a volume that is on
> the same MTD partition as the first volume, than this will work. The
> second entry is added to ubifs_fs_type.fs_supers.

I cannot see this from looking into code ... so hard to say, but
I only looked into mainline code ...

> In my case however, the second entry being added to
> ubifs_fs_type.fs_supers is invalid and causes the mount error.
> 
> Reinitializing the list in uboot_ubifs_mount() before each mount, solves
> the problem, but I guess that it will cause failures in other setups,
> where there are actually multiple volumes on one MTD device.
> 
> So how can I solve this properly? Do we need one instance of struct
> ubifs_fs_type for each MTD device?

Hmm.. without digging into it, it is difficult to say...

> I tested this on an old version (2017.03), but looking at the current
> code, it looks like the same problem applies to current mainline.

Is there any chance to try it with current mainline ?

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de


More information about the U-Boot mailing list