[PATCH] cpukit/jffs2: Handle used empty file system

Kinsey Moore kinsey.moore at oarcorp.com
Tue Feb 6 02:28:21 UTC 2024


On Mon, Feb 5, 2024 at 2:36 AM Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> Hello Kinsey,
>
> On 02.02.24 23:03, Kinsey Moore wrote:
> > On JFFS2 file systems on NOR flash or dataflash that does not have spare
> > area for metadata and thus does not invoke delayed writes, it is
> > possible to put the file system into a state where all blocks have been
> > written to and all files have been deleted from the filesystem. There is
> > a bug in the JFFS2 file system scan routine that detects this situation
> > as a corrupted file system since the scan routine relies on "used" space
> > to discriminate a valid file system when there are blocks that need to
> > be erased. The correct fix would require a partial rewrite of the scan
> > routine, so instead this patch tracks the space marked as obsolete along
> > with space at the end of each block that is otherwise too small to
> > contain a JFFS2 node so that it can me compared with the dirty space.
> > Corrupted data (or otherwise non-JFFS2 blocks) will still cause this
> > check to fail as corrupted data isn't recognized as obsoleted (deleted)
> > nodes.
>
> this should be reported to the Linux JFFS2 maintainers. A test case
> would be also nice.
>

I'm already communicating with the Linux MTD group over IRC and provided
them an example FS image that reproduces the problem along with this patch
that works around it. I should be able to get this into a test case.

Kinsey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20240205/3f0d15ba/attachment.htm>


More information about the devel mailing list