public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Do I have to umount JFFS2?
@ 2005-12-15 10:12 Steven Scholz
  2005-12-15 10:26 ` Jarkko Lavinen
  0 siblings, 1 reply; 10+ messages in thread
From: Steven Scholz @ 2005-12-15 10:12 UTC (permalink / raw)
  To: linux-mtd

Hi all,

we're using JFFS2 as rootfs for embedded devices.

>From time to time we have to reboot shortly after writing to this fs,
e.g. a firware update is basically copying the new fw to the jffs2
partition and call "reboot".

Now I wonder if it is needed to umount this partition explicitly before
rebooting? Or mount it read only first by having

::shutdown:/bin/umount -a -r

in /etc/inittab. Or call "sync"?

Or is the unmounting done by the kernel before actually rebooting?
So the system only reboots when all writing to flash is finished?

(I've lately seen corrupt root fs and want to find out if these reboots
could cause the trouble...)

Thanks a million!

-- 
Steven

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Do I have to umount JFFS2?
  2005-12-15 10:12 Do I have to umount JFFS2? Steven Scholz
@ 2005-12-15 10:26 ` Jarkko Lavinen
  2005-12-15 12:25   ` Steven Scholz
  0 siblings, 1 reply; 10+ messages in thread
From: Jarkko Lavinen @ 2005-12-15 10:26 UTC (permalink / raw)
  To: Steven Scholz; +Cc: linux-mtd

On Thu, Dec 15, 2005 at 11:12:31AM +0100, ext Steven Scholz wrote:
> Now I wonder if it is needed to umount this partition explicitly before
> rebooting? Or mount it read only first by having

JFFS2 is synhronous except for the write buffer (used with Nand chips).  
Doing sync is enough and flushes the write buffer.

Jarkko Lavinen

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Do I have to umount JFFS2?
  2005-12-15 10:26 ` Jarkko Lavinen
@ 2005-12-15 12:25   ` Steven Scholz
  2005-12-15 12:51     ` Peter Menzebach
  0 siblings, 1 reply; 10+ messages in thread
From: Steven Scholz @ 2005-12-15 12:25 UTC (permalink / raw)
  To: Jarkko Lavinen; +Cc: linux-mtd

Jarkko Lavinen wrote:
> On Thu, Dec 15, 2005 at 11:12:31AM +0100, ext Steven Scholz wrote:
> 
>>Now I wonder if it is needed to umount this partition explicitly before
>>rebooting? Or mount it read only first by having
> 
> 
> JFFS2 is synhronous except for the write buffer (used with Nand chips).  
> Doing sync is enough and flushes the write buffer.

Is "sync()" done by the kernel before reboot? Or do I have to call "sync"?

--
Steven

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Do I have to umount JFFS2?
  2005-12-15 12:25   ` Steven Scholz
@ 2005-12-15 12:51     ` Peter Menzebach
  2005-12-16  2:16       ` alfred hitch
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Menzebach @ 2005-12-15 12:51 UTC (permalink / raw)
  To: Steven Scholz; +Cc: linux-mtd

Steven Scholz wrote:
> Jarkko Lavinen wrote:
>> On Thu, Dec 15, 2005 at 11:12:31AM +0100, ext Steven Scholz wrote:
>>
>>> Now I wonder if it is needed to umount this partition explicitly before
>>> rebooting? Or mount it read only first by having
>>
>> JFFS2 is synhronous except for the write buffer (used with Nand chips).  
>> Doing sync is enough and flushes the write buffer.
> 
> Is "sync()" done by the kernel before reboot? Or do I have to call "sync"?
> 
Hi Steven,
afaik,
and this this is inline with my experience, you have call sync before 
reboot.
Since I write only complete files to jffs2, I reduced the timer, which 
flushes the write buffer automatically from 3 seconds to 500 ms.
In that case, I normally get no errors even in case of a hard reset.

Otherwise I get some "found empty flash at" and some CRC errors. The 
filesystem as whole should remain in a stable state in any case (that's 
the main reason apart from wear levelling for jffs2, I think)


Best regards
Peter


-- 
Peter Menzebach
Menzebach und Wolff IT-Consulting GbR
Phone +49 751 355 387 1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Do I have to umount JFFS2?
  2005-12-15 12:51     ` Peter Menzebach
@ 2005-12-16  2:16       ` alfred hitch
  2005-12-16  9:10         ` Peter Menzebach
  0 siblings, 1 reply; 10+ messages in thread
From: alfred hitch @ 2005-12-16  2:16 UTC (permalink / raw)
  To: Peter Menzebach; +Cc: linux-mtd, Steven Scholz

Hi Steven, Peter,

I would like to put in some problems we are also facing. I had
reported it sometime back here also.

On our system, we are observing that files on flash (jffs2 intel cfi nand)
are getting corrupted, after  a number of resets and say 3 months of usage)

Anyone seen anything like this ? any clues on how one can look into this.

Regards,
Alfred

On 12/15/05, Peter Menzebach <pm-mtd@mw-itcon.de> wrote:
> Steven Scholz wrote:
> > Jarkko Lavinen wrote:
> >> On Thu, Dec 15, 2005 at 11:12:31AM +0100, ext Steven Scholz wrote:
> >>
> >>> Now I wonder if it is needed to umount this partition explicitly before
> >>> rebooting? Or mount it read only first by having
> >>
> >> JFFS2 is synhronous except for the write buffer (used with Nand chips).
> >> Doing sync is enough and flushes the write buffer.
> >
> > Is "sync()" done by the kernel before reboot? Or do I have to call "sync"?
> >
> Hi Steven,
> afaik,
> and this this is inline with my experience, you have call sync before
> reboot.
> Since I write only complete files to jffs2, I reduced the timer, which
> flushes the write buffer automatically from 3 seconds to 500 ms.
> In that case, I normally get no errors even in case of a hard reset.
>
> Otherwise I get some "found empty flash at" and some CRC errors. The
> filesystem as whole should remain in a stable state in any case (that's
> the main reason apart from wear levelling for jffs2, I think)
>
>
> Best regards
> Peter
>
>
> --
> Peter Menzebach
> Menzebach und Wolff IT-Consulting GbR
> Phone +49 751 355 387 1
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Do I have to umount JFFS2?
  2005-12-16  2:16       ` alfred hitch
@ 2005-12-16  9:10         ` Peter Menzebach
  2005-12-16 16:36           ` alfred hitch
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Menzebach @ 2005-12-16  9:10 UTC (permalink / raw)
  To: alfred hitch; +Cc: Steven Scholz, linux-mtd

alfred hitch wrote:
> Hi Steven, Peter,
> 
> I would like to put in some problems we are also facing. I had
> reported it sometime back here also.
> 
> On our system, we are observing that files on flash (jffs2 intel cfi nand)
> are getting corrupted, after  a number of resets and say 3 months of usage)
> 
> Anyone seen anything like this ? any clues on how one can look into this.
> 

Hi Alfred,
I have had no non recoverable error here up to now, but I am not 
representative, since I do not need many permanent writes: I have all 
permanently changeable informations like configuration files in one rw 
partition, and all temporary information like log, lock, pidfiles... in 
the ramdisk. My rootfs stays ro. In my case, I can simply erase the 
"config-partition", and the board definitely is clean.

I have 2 ideas to your problems:
1. Single files can be still corrupted, when you write them and press reset.
2. Your jffs2 version is from a let's say "not so good time"

What I do not understand (from one of your previous posts): You said, a 
command file was damaged. Was this file written at generation time of 
the fs, and then not written any more?

Best regards
Peter

-- 
Peter Menzebach
Menzebach und Wolff IT-Consulting GbR
Phone +49 751 355 387 1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Do I have to umount JFFS2?
  2005-12-16  9:10         ` Peter Menzebach
@ 2005-12-16 16:36           ` alfred hitch
  2005-12-16 16:54             ` Peter Menzebach
  0 siblings, 1 reply; 10+ messages in thread
From: alfred hitch @ 2005-12-16 16:36 UTC (permalink / raw)
  To: Peter Menzebach; +Cc: Steven Scholz, linux-mtd

Hi Peter,

We happened to have our system in rw mode (dont ask me why,I will be
embarassed).
Now, we have made it ro.
Files in question happened to be "sh"  or libc.so. etc.. basically one
which appeared to be in memory at that time before kernel oops or
sudden resets etc. So, to answer your question, yes they were from
start there. After making ro as ofnow we havent seen any corruptions.
But, my head has been looking for a reason as to why would it be
executables be ever written back to flash ??

Well jffs2 version we are using happened to be from snapgear 3.0 from
net. so I am kinda biased and hoping we arent with a such a broken
one.
(How to update to latest btw ? 2.4 backwards compatible ?)

Didnt get this comment of ur's :
1. Single files can be still corrupted, when you write them and press reset.

Regards,
Alfred

On 12/16/05, Peter Menzebach <pm-mtd@mw-itcon.de> wrote:
> alfred hitch wrote:
> > Hi Steven, Peter,
> >
> > I would like to put in some problems we are also facing. I had
> > reported it sometime back here also.
> >
> > On our system, we are observing that files on flash (jffs2 intel cfi nand)
> > are getting corrupted, after  a number of resets and say 3 months of usage)
> >
> > Anyone seen anything like this ? any clues on how one can look into this.
> >
>
> Hi Alfred,
> I have had no non recoverable error here up to now, but I am not
> representative, since I do not need many permanent writes: I have all
> permanently changeable informations like configuration files in one rw
> partition, and all temporary information like log, lock, pidfiles... in
> the ramdisk. My rootfs stays ro. In my case, I can simply erase the
> "config-partition", and the board definitely is clean.
>
> I have 2 ideas to your problems:
> 1. Single files can be still corrupted, when you write them and press reset.
> 2. Your jffs2 version is from a let's say "not so good time"
>
> What I do not understand (from one of your previous posts): You said, a
> command file was damaged. Was this file written at generation time of
> the fs, and then not written any more?
>
> Best regards
> Peter
>
> --
> Peter Menzebach
> Menzebach und Wolff IT-Consulting GbR
> Phone +49 751 355 387 1
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Do I have to umount JFFS2?
  2005-12-16 16:36           ` alfred hitch
@ 2005-12-16 16:54             ` Peter Menzebach
  2005-12-18 15:08               ` Steven Scholz
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Menzebach @ 2005-12-16 16:54 UTC (permalink / raw)
  To: alfred hitch; +Cc: linux-mtd

alfred hitch wrote:
> Hi Peter,
> 
> We happened to have our system in rw mode (dont ask me why,I will be
> embarassed).
> Now, we have made it ro.
> Files in question happened to be "sh"  or libc.so. etc.. basically one
> which appeared to be in memory at that time before kernel oops or
> sudden resets etc. So, to answer your question, yes they were from
> start there. After making ro as ofnow we havent seen any corruptions.
> But, my head has been looking for a reason as to why would it be
> executables be ever written back to flash ??
> 
I do not know exactly. But a question to the others: Does the wear 
leveling affect only free blocks, or does it reorganize seldom written 
used blocks too?

> Well jffs2 version we are using happened to be from snapgear 3.0 from
> net. so I am kinda biased and hoping we arent with a such a broken
> one.
> (How to update to latest btw ? 2.4 backwards compatible ?)
> 
> Didnt get this comment of ur's :
> 1. Single files can be still corrupted, when you write them and press reset.
> 
When you press reset, when a file is written, you get a partly written 
block. So you get a file, which is not written completely. This 
corruption is detected by jffs2 and issues warnings. The filesystem as 
whole stays intact, but the file as such doesn't have the contents you 
might expect.


Best regards
Peter

-- 
Peter Menzebach
Menzebach und Wolff IT-Consulting GbR
Phone +49 751 355 387 1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Do I have to umount JFFS2?
  2005-12-16 16:54             ` Peter Menzebach
@ 2005-12-18 15:08               ` Steven Scholz
  2005-12-19  7:52                 ` Peter Menzebach
  0 siblings, 1 reply; 10+ messages in thread
From: Steven Scholz @ 2005-12-18 15:08 UTC (permalink / raw)
  To: Peter Menzebach; +Cc: linux-mtd

Peter,

>> Didnt get this comment of ur's :
>> 1. Single files can be still corrupted, when you write them and press
>> reset.
>>
> When you press reset, when a file is written, you get a partly written
> block. So you get a file, which is not written completely. This
> corruption is detected by jffs2 and issues warnings. The filesystem as
> whole stays intact, but the file as such doesn't have the contents you
> might expect.

Since you're talking about "pressing reset" I have to ask again.

When we do a firmware update of our devices we do something like

 cp /tmp/large_file /opt/imc/application
 reboot

where /tmp is a ramdisk and / a jffs2 rw rootfs.

So we're not pressing reset but doing a reboot. And I wanted to know if
linux does only reboot _after_ all data is correctly written to flash?

Would it make sense to do

 cp /tmp/large_file /opt/imc/application
 sync
 reboot

???

What's the point of having a line

::shutdown:/bin/umount -a -r

in /etc/inittab?

I have

/dev/mtdblock0 on / type jffs2 (rw,noatime)
/proc on /proc type proc (rw,nodiratime)
devpts on /dev/pts type devpts (rw)
sysfs on /sys type sysfs (rw)
/dev/shm on /var type tmpfs (rw)
/sys/kernel/debug on /var/tmp/debug type debugfs (rw)

So the only real fs is jffs2. Does it help to unmount it before reboot?

--
Steven

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Do I have to umount JFFS2?
  2005-12-18 15:08               ` Steven Scholz
@ 2005-12-19  7:52                 ` Peter Menzebach
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Menzebach @ 2005-12-19  7:52 UTC (permalink / raw)
  To: Steven Scholz; +Cc: linux-mtd

Steven Scholz wrote:
> Peter,
> 
>>> Didnt get this comment of ur's :
>>> 1. Single files can be still corrupted, when you write them and press
>>> reset.
>>>
>> When you press reset, when a file is written, you get a partly written
>> block. So you get a file, which is not written completely. This
>> corruption is detected by jffs2 and issues warnings. The filesystem as
>> whole stays intact, but the file as such doesn't have the contents you
>> might expect.
> 
> Since you're talking about "pressing reset" I have to ask again.
> 
> When we do a firmware update of our devices we do something like
> 
>  cp /tmp/large_file /opt/imc/application
>  reboot
> 
> where /tmp is a ramdisk and / a jffs2 rw rootfs.
> 
> So we're not pressing reset but doing a reboot. And I wanted to know if
> linux does only reboot _after_ all data is correctly written to flash?
> 
> Would it make sense to do
> 
>  cp /tmp/large_file /opt/imc/application
>  sync
>  reboot
> 
> ???
> 
> What's the point of having a line
> 
> ::shutdown:/bin/umount -a -r
> 
> in /etc/inittab?
> 
> I have
> 
> /dev/mtdblock0 on / type jffs2 (rw,noatime)
> /proc on /proc type proc (rw,nodiratime)
> devpts on /dev/pts type devpts (rw)
> sysfs on /sys type sysfs (rw)
> /dev/shm on /var type tmpfs (rw)
> /sys/kernel/debug on /var/tmp/debug type debugfs (rw)
> 
> So the only real fs is jffs2. Does it help to unmount it before reboot?
> 
> --
> Steven
> 
> 
Hi Steven,
I have not verified this in code, but afaik there is no automatic 
unmount of the filesystems at remount.

So you should either call sync or unmount the filesystem (which calls 
implicit a sync)

Best regards
Peter


-- 
Peter Menzebach
Menzebach und Wolff IT-Consulting GbR
Phone +49 751 355 387 1

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-12-19  7:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-15 10:12 Do I have to umount JFFS2? Steven Scholz
2005-12-15 10:26 ` Jarkko Lavinen
2005-12-15 12:25   ` Steven Scholz
2005-12-15 12:51     ` Peter Menzebach
2005-12-16  2:16       ` alfred hitch
2005-12-16  9:10         ` Peter Menzebach
2005-12-16 16:36           ` alfred hitch
2005-12-16 16:54             ` Peter Menzebach
2005-12-18 15:08               ` Steven Scholz
2005-12-19  7:52                 ` Peter Menzebach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox