jffs2: directory rename and power-cut causes strange situation
Ronald Wahl
rwahl at gmx.de
Mon Sep 15 11:59:11 PDT 2025
Hi,
I have experienced a strange behaviour on a jffs2 filesystem with a
directory rename and power-cut. I have to admit that I have write
buffering (and SUMMARY) enabled and it is a SPI-NOR flash with
transparent ECC and a write buffer size of 16 bytes. Not sure if this
matters but it makes the issue more reproducable I think. Kernel is 6.12.40.
Steps:
1. mkdir D
2. touch D/file
3. sync
4. mv D E
5. immediate power-cut
6. reboot and mount the filesystem
Observations:
1. Mounting will show some errors that might be expected:
jffs2: jffs2_scan_dirent_node(): Name CRC failed on node at
0x0007d81c: Read 0xffffffff, calculated 0x2d02ef8d
jffs2: error: (575) jffs2_build_filesystem: child dir "D" (ino
#20025) of dir ino #1 is also hard linked from dir ino #1
2. There are two directories D and E both referring to the same inode,
i.e. a hardlink, which typically is not allowed to create with
link() for good reasons
3. Removing one of the directories with "rm -rf D" will (not quite
unexpected) and a subsequent "ls -l" cause jffs2 errors and ls fails:
jffs2: warning: (1097) jffs2_get_inode_nodes: Eep. No valid nodes for
ino #20025.
jffs2: warning: (1097) jffs2_do_read_inode_internal: no data nodes
found for ino #20025
jffs2: iget() failed for ino #20025
ls: ./E: Input/output error
So now the question is how to recover from this situation? Somehow
hard-linked directories are something rather evil. Maybe this should be
corrected during mount already?
Thx,
ron
More information about the linux-mtd
mailing list