On Tue, Mar 26, 2019 at 10:21 AM Lars Persson <lists@xxxxxxx> wrote: > > On Thu, Mar 21, 2019 at 11:02 AM Lars Persson <lists@xxxxxxx> wrote: > > > > The missing inode is always triggered on those two particular files > > emotiond.conf and tampering.conf that share the same write pattern at startup: > > > > cp file file.tmp > > echo some data > file.tmp > > mv file.tmp file > > fsync file > > > > A closer look at that script shows that the atomic file update part > was bypassed. It only performs a chown operation on that file. > That simple chown will trigger an overlayfs copyup operation. > > With a proper unmount after the system has finished writing to /etc I > cannot reproduce any corruption. An unclean shutdown triggers > corruption in about 1/3 of the attempts, also when I cut power tens of > seconds after the problematic script has executed. OK I think I have found the bug. Commit 32fe905c17f0 ("Fix O_TMPFILE corner case in ubifs_link()") tried to fix the use of O_TMPFILE by removing an inode from the orphan list when it is relinked. Unfortunately the removal never gets committed to flash because the removal of an orphan does not trigger a commit. The condition for committing is that new_orphans > 0, but in our case it is zero after the call to ubifs_delete_orphan(). ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/