linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard.weinberger@gmail.com>
To: Lars Persson <lists@bofh.nu>
Cc: 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 18:31:22 +0100	[thread overview]
Message-ID: <CAFLxGvye+F5hB+1DUUhDzjaHB5ajC_M+W3fyt5x840sO68RgUQ@mail.gmail.com> (raw)
In-Reply-To: <CADnJP=svNQ_LRq1OWbCMNNeTHs_-fAe1kmU1+G4GZ2BV0Jvo2w@mail.gmail.com>

On Thu, Mar 28, 2019 at 12:54 PM Lars Persson <lists@bofh.nu> wrote:
>
> 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.

Thanks for hunting this down!

> 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().

Can you please share me your corrupted fs?
I'm not so sure what is really the root cause.
The thing is, ubifs_delete_orphan() does not need to tigger a commit.
Ff something depends on a commit, we have another problem, I fear.

-- 
Thanks,
//richard

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2019-03-28 17:31 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
2019-03-28 17:31     ` Richard Weinberger [this message]
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=CAFLxGvye+F5hB+1DUUhDzjaHB5ajC_M+W3fyt5x840sO68RgUQ@mail.gmail.com \
    --to=richard.weinberger@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=lists@bofh.nu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).