All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars Persson <lists@bofh.nu>
To: linux-mtd@lists.infradead.org
Subject: Re: UBIFS file-system corruption (missing inode) after power-cut on 4.14.96
Date: Thu, 28 Mar 2019 12:54:25 +0100	[thread overview]
Message-ID: <CADnJP=svNQ_LRq1OWbCMNNeTHs_-fAe1kmU1+G4GZ2BV0Jvo2w@mail.gmail.com> (raw)
In-Reply-To: <CADnJP=shWk7qcK1V9v0JiDGqmOD4-B3zyXzbj7ZbTf2H3BLnRg@mail.gmail.com>

On Tue, Mar 26, 2019 at 10:21 AM Lars Persson <lists@bofh.nu> wrote:
>
> On Thu, Mar 21, 2019 at 11:02 AM Lars Persson <lists@bofh.nu> 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/

  reply	other threads:[~2019-03-28 11:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-21 10:02 UBIFS file-system corruption (missing inode) after power-cut on 4.14.96 Lars Persson
2019-03-25 10:21 ` Lars Persson
2019-03-26  9:21 ` Lars Persson
2019-03-28 11:54   ` Lars Persson [this message]
2019-03-28 17:31     ` Richard Weinberger
2019-03-29  9:43       ` Lars Persson
2019-04-04 21:31         ` Richard Weinberger
2019-04-04 21:53         ` Richard Weinberger
2019-04-05 13:19           ` Lars Persson
2019-04-05 13:23             ` Richard Weinberger
2019-07-10  7:14               ` Lars Persson
2019-07-10  9:02                 ` Richard Weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADnJP=svNQ_LRq1OWbCMNNeTHs_-fAe1kmU1+G4GZ2BV0Jvo2w@mail.gmail.com' \
    --to=lists@bofh.nu \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.