public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Estelle HAMMACHE <estelle.hammache@st.com>
To: "Artem B. Bityuckiy" <abityuckiy@yandex.ru>
Cc: linux-mtd@lists.infradead.org, David Woodhouse <dwmw2@infradead.org>
Subject: Re: JFFS2 & SMP
Date: Tue, 02 Nov 2004 15:31:52 +0100	[thread overview]
Message-ID: <41879A58.F960F963@st.com> (raw)
In-Reply-To: 4180FAD8.2000107@yandex.ru

Hello Artem,

Have you made any progress with this issue ?

I believe this problem could be reproduced more easily
by adding a long sleep() at the end of __jffs2_flush_wbuf
between memset() and the affectation of c->wbuf_ofs.
Then write and fsync a file and try to read it back during
the sleep.
I've done something similar on my non-linux setup (actually
I use a longjmp to exit from __jffs2_flush_wbuf) and I obtain 
the following when I try to read back the file:
<7>Node read from 00080160: node_crc ffffffff, calculated CRC f09e7845. dsize ffffffff, csize ffffffff, offset ffffffff,
buf 1100a48
<4>Node CRC ffffffff != calculated CRC f09e7845 for node at 00080160

I think the wbuf variables are well protected against
cuncurrent writes, however if the wbuf is being flushed 
(fsync or GC) and you try to _read_ the file which has a 
node in wbuf, there may be some inconsistency between 
wbuf_ofs and wbuf contents.
I suggest to modify the end of __jffs2_flush_wbuf this way:

	c->wbuf_len = 0; /* do this FIRST so that reads won't attempt to use wbuf */
	memset(c->wbuf,0xff,c->wbuf_pagesize);
	/* adjust write buffer offset, else we get a non contiguous write bug */
	c->wbuf_ofs += c->wbuf_pagesize;

Does this seem useful ?
Estelle

"Artem B. Bityuckiy" wrote:
> 
> Hello,
> 
> how the the wbuf and related variables in the jffs2_sb_info are protected?
> 
> --
> Best Regards,
> Artem B. Bityuckiy,
> St.-Petersburg, Russia.
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/

-- 
Estelle Hammache
Terminal Management Team (Mobile phones MCU Software Development)
TINA : 044 8024
Phone : (+33) 1 58 07 80 24

  reply	other threads:[~2004-11-02 14:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-27 12:35 JFFS2 & SMP Artem B. Bityuckiy
2004-10-27 12:59 ` David Woodhouse
2004-10-27 13:19   ` Artem B. Bityuckiy
2004-10-27 13:35   ` Artem B. Bityuckiy
2004-10-27 13:45     ` David Woodhouse
2004-10-27 14:09       ` Artem B. Bityuckiy
2004-10-27 14:59       ` Artem B. Bityuckiy
2004-10-27 15:07         ` Artem B. Bityuckiy
2004-10-28 12:14           ` Artem B. Bityuckiy
2004-10-28 12:33       ` Artem B. Bityuckiy
2004-10-28 13:57         ` Artem B. Bityuckiy
2004-11-02 14:31           ` Estelle HAMMACHE [this message]
2004-11-03 16:29             ` Artem B. Bityuckiy
2004-11-04  9:03               ` Estelle HAMMACHE
2004-11-04  9:36                 ` Artem B. Bityuckiy
     [not found]                   ` <418A591C.A4D46C9E@st.com>
2004-11-04 17:17                     ` Artem B. Bityuckiy
2004-11-05  9:06                       ` Estelle HAMMACHE
2004-11-05 11:51                         ` Artem B. Bityuckiy
2004-11-03 16:39             ` Artem B. Bityuckiy

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=41879A58.F960F963@st.com \
    --to=estelle.hammache@st.com \
    --cc=abityuckiy@yandex.ru \
    --cc=dwmw2@infradead.org \
    --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