Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Sergei Poselenov <sposelenov@emcraft.com>
Cc: linux-mtd <linux-mtd@lists.infradead.org>
Subject: Re: UBIFS: file data corruption during the power cut-off test
Date: Sun, 9 Jun 2019 10:53:34 +0200 (CEST)	[thread overview]
Message-ID: <1957000286.85744.1560070414116.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <a43eb232a51b7d0c95623de9403158c290163237.camel@emcraft.com>

----- Ursprüngliche Mail -----
> Now, the question: why are these 512 bytes of zeros in test4?
> 
> Extrapolating to a real use case, consider a system writing a log file
> to the UBI partition. Power cutoff, recovery, and we have a garbage at
> the end of the log file. Is this expected?

Well, zero bytes are not garbage. ;)
But yes, this is is expected. In your case, I guess, the inode size
does not match exactly what is present on flash.
So the file size is 512 bytes too large, if you read too far, 0x0 bytes are returned.
During journal replay UBIFS tries to fixup file lengths but is approach
does not work in all cases perfectly.

This case is actually documented, please see:
http://www.linux-mtd.infradead.org/doc/ubifs.html#L_sync_semantics

Thanks,
//richard

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

  reply	other threads:[~2019-06-09  8:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-06  9:10 UBIFS: file data corruption during the power cut-off test Sergei Poselenov
2019-06-06 14:55 ` Richard Weinberger
2019-06-06 18:08   ` Sergei Poselenov
2019-06-06 18:13     ` Richard Weinberger
2019-06-07 14:23       ` Sergei Poselenov
2019-06-07 16:01         ` Steve deRosier
2019-06-09  8:32           ` Sergei Poselenov
2019-06-09 15:25             ` Steve deRosier
2019-06-07 16:02         ` Richard Weinberger
2019-06-08  6:42           ` Sergei Poselenov
2019-06-08  8:46             ` Richard Weinberger
2019-06-09  8:18               ` Sergei Poselenov
2019-06-09  8:53                 ` Richard Weinberger [this message]
2019-06-09  9:59                   ` Sergei Poselenov
2019-06-09 10:00                     ` Richard Weinberger
2019-06-15  7:26                       ` Sergei Poselenov

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=1957000286.85744.1560070414116.JavaMail.zimbra@nod.at \
    --to=richard@nod.at \
    --cc=linux-mtd@lists.infradead.org \
    --cc=sposelenov@emcraft.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox