All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Manfred Spraul <manfred@colorfullife.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: UBIFS does not mount after powerfail
Date: Thu, 30 Nov 2017 21:03:37 +0100	[thread overview]
Message-ID: <2908877.jEbli3qftF@blindfold> (raw)
In-Reply-To: <10097404-fd3d-73a3-6e0a-658fe8385cd2@colorfullife.com>

Manfred,

Am Donnerstag, 30. November 2017, 18:41:52 CET schrieb Manfred Spraul:
> Hi Richard,
> 
> On 11/28/2017 10:00 PM, Richard Weinberger wrote:
> > Manfred,
> > 
> > 
> > Am Donnerstag, 23. November 2017, 23:03:28 CET schrieb Manfred Spraul:
> > 
> > I tied, but TBH I'm completely lost in all the data you throwing on me.
> 
> Understood, I generated way too much data.
> I have also confused all my coworkers :-(

No problem.
We will sort this out. :-)
 
> Let's keep it simple and concentrate on the
> garbage_collect_leb()/ubifs_scan issue.
> 
> > Let's recap, you trigger a corruption that happens only(!) when xattrs are
> > used?
> 
> Correct, I only see the corruption when xattr is used.

Good.

> > How is Fastmap involved in the game? If so, I want to know whether you can
> > trigger without Fastmap being enabled.
> 
> Correct, I have seen the corruption without FASTMAP.

Also Good.

> > Which one is the image that failed first with chk_fs enabled?
> > On a vanilla kernel...
> 
> I have used a modified MTDRAM: I have patched it so that it writes every
> ERASE and every WRITE into a log.
> Both the addresses and the data.
> First, I have created an initial image
> (ubiformat/ubiattach/ubimkvol/ubidetach).
> Then I did a dump of it (nanddump /dev/mtd0 > dump-before.bin)
> Then I enabled logging, and run the test load (ubiattach/mount/mount
> ecryptfs/<many touch/write/rm/mv commands>/umount/ubidetach).
> Then I created a dump of the final image. (nanddump /dev/mtd0 >
> dump-after.bin)

Okay.

> Then the obvious cross checks:
> Initial image+apply all commands from the log is identical to the final
> image.
> 
> Now I can use the log to create virtual power fail events:
> 
> What if a power failure happens after 168168 commands?
> Image:
> https://sourceforge.net/projects/calculix-rpm/files/ubifs/image-168168.bin/d
> ownload
> 
> Logfile of a mount without chk_fs:
> https://sourceforge.net/projects/calculix-rpm/files/ubifs/r-168168.txt/downl
> oad
> 
> What was the last write command?
> FUNC_WRITE_CHK(addr=0xd61000, len=0x800)
> 
> What would have been the next write command:
> FUNC_WRITE_CHK(addr=0xd61800, len=0x800)
> 
> Image after that command:
> https://sourceforge.net/projects/calculix-rpm/files/ubifs/image-168169.bin/d
> ownload

Which file contains the MTD with chk_fs being enabled?

What did you set for CONFIG_MTDRAM_TOTAL_SIZE and CONFIG_MTDRAM_ERASE_SIZE?

> 
> Just to clarify:
> I have simulated power fails.
> A bit like ubi_dbg_power_cut, but instead of stopping further
> writes/erase commands, I created a log file.
> And now I can replay the log to an arbitrary point, and then mount the
> result.
> I have a total of 5 logs, and from these 5 logs, I did around 100k
> replays and mounted the results.
> 
> --
>      Manfred
> 
> P.S.: I'm doing final polishing of the modifications to mtdram. As soon
> as I have the internal release, I will send it to linux-mtd.

Wonderful. Your tool seems to be a good stresstest.
I'd love to see it upstream.

> P.P.S.: To avoid any brown paperbag bugs: mtd->_erase and mtd->_write
> are allowed to sleep, correct? At least, st_spi_fsm contains mutex_lock().

I always assumed that they can sleep and everything else would surprise me.

Thanks,
//richard

  reply	other threads:[~2017-11-30 20:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-12 19:26 UBIFS does not mount after powerfail Manfred Spraul
2017-11-12 19:54 ` Richard Weinberger
2017-11-13 20:59   ` Manfred Spraul
2017-11-13 21:06     ` Richard Weinberger
2017-11-14 18:49       ` Manfred Spraul
2017-11-15 20:04         ` Manfred Spraul
2017-11-15 20:29           ` Richard Weinberger
2017-11-16 16:51             ` Manfred Spraul
2017-11-19 20:52               ` Richard Weinberger
2017-11-23 22:03                 ` Manfred Spraul
2017-11-28 21:00                   ` Richard Weinberger
2017-11-30 17:41                     ` Manfred Spraul
2017-11-30 20:03                       ` Richard Weinberger [this message]
2017-12-01  7:41                         ` Manfred Spraul
2017-12-01 10:01                           ` Richard Weinberger
2017-12-01 17:38                             ` Manfred Spraul
2017-12-05 13:27                           ` Richard Weinberger
2017-12-05 19:11                             ` Manfred Spraul
2017-12-05 20:06                               ` Richard Weinberger
2017-12-05 22:19                                 ` Richard Weinberger
2017-12-06 18:42                                   ` 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=2908877.jEbli3qftF@blindfold \
    --to=richard@nod.at \
    --cc=linux-mtd@lists.infradead.org \
    --cc=manfred@colorfullife.com \
    /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.