public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH] [JFFS2] check xattr data integrity during the scan.
Date: Wed, 25 Apr 2012 16:55:53 +0300	[thread overview]
Message-ID: <1335362163.5114.14.camel@koala> (raw)
In-Reply-To: <4F942F27.2090807@tribudubois.net>

[-- Attachment #1: Type: text/plain, Size: 2367 bytes --]

Hi Jean-Christophe,

On Sun, 2012-04-22 at 18:17 +0200, Jean-Christophe DUBOIS wrote:
> > The same is done for xattrs - during scanning we do not check the data
> > payload.
> In case of attributes, JFFS2 do detect that they are corrupted later but 
> it is too late. At that time we have lost reference to earlier 
> "versions" of the attribute and I think we would need to rescan the all 
> partition to find it back (assuming it has not been deleted in the mean 
> time as I am not sure how GC deals with earlier versions of the 
> attributes). So it seems better to do it in the first place.

Wait. Now I think I starting remembering a bit more. First of all, you
surely have many good arguments. But my counter-argument - the same
happens for data nodes. We do not check data CRC during scanning. Xattr
nodes should be treated the same way.

JFFS2 scans in 2 phases:
1. early scanning - it scans only the headers of the nodes, but not the
payloads. No I/O on the FS is possible.
2. late background scanning - the GC threads goes through every single
inode and reads it, so forces data CRC checking. JFFS2 is available for
reading, but write requests may block (if they require GC, AFAIR,
because we cannot do GC before we have checked everything, otherwise we
may lose a valuable older node version).

So I guess this is what you should do for xattrs as well - check payload
CRC at the second stage scanning, not the first one.

The idea on this split was to do minimum and make the FS available for
reading, and continue the rest in background. This background thing is
quite heavy BTW, and slows down the entire system boot.

> You also have to consider that attributes are generally "short" (unlike 
> the file content) and there is not much data associated to them. so the 
> overhead implied by the attribute data scanning is not very important 
> (considering the attribute data is already in memory). But it is true 
> that there is an overhead added by this patch.
> What happen for now is that if an attribute is corrupted, then we will 
> not be able to ever read it again (JFFS2 returns a negative/recoverable 
> error on corruption detection on any access and does not try to cure the 
> problem).

AFAIU, this should be dealt with during the second stage scanning.

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

      reply	other threads:[~2012-04-25 13:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11 20:23 [PATCH] [JFFS2] check xattr data integrity during the scan Jean-Christophe DUBOIS
2012-04-22 13:04 ` Artem Bityutskiy
2012-04-22 13:15 ` Artem Bityutskiy
2012-04-22 16:17   ` Jean-Christophe DUBOIS
2012-04-25 13:55     ` Artem Bityutskiy [this message]

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=1335362163.5114.14.camel@koala \
    --to=dedekind1@gmail.com \
    --cc=jcd@tribudubois.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox