* For UBIFS users: be aware of write-back!
@ 2008-10-01 5:51 Artem Bityutskiy
2008-10-03 7:15 ` David Woodhouse
0 siblings, 1 reply; 6+ messages in thread
From: Artem Bityutskiy @ 2008-10-01 5:51 UTC (permalink / raw)
To: linux-mtd; +Cc: Bruce_Leonard
Hi,
this e-mail informs about a quite important UBIFS feature which
have already confused many people.
If you use UBIFS, and especially if you have been using JFFS2 before,
please, read this documentation entry:
http://www.linux-mtd.infradead.org/doc/ubifs.html#L_writeback
Please, remember that UBIFS is _asynchronous_ FS. JFFS2 was synchronous,
so expect some of your old applications which were fine on JFFS2 to be
not ready to handle power cuts correctly in case of UBIFS.
Just an unsorted list of important items:
* Every time you write to a file, please, ask yourself: "if a
power cut happens now, is it OK if I loose data or that my file may
contain garbage or be inconsistent afterward? Is my application
ready to clean that up?"
* If your application changes a configuration file, you probably
should use the "atomic file update" trick described at the web site.
* Keep the write-back issues in mind if you write scripts as
well. In bash, use "sync" when needed. Smarter languages like
Perl have more fine-grained and efficient calls.
Thanks.
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: For UBIFS users: be aware of write-back!
2008-10-01 5:51 For UBIFS users: be aware of write-back! Artem Bityutskiy
@ 2008-10-03 7:15 ` David Woodhouse
2008-10-03 7:45 ` Artem Bityutskiy
2008-10-03 8:11 ` Artem Bityutskiy
0 siblings, 2 replies; 6+ messages in thread
From: David Woodhouse @ 2008-10-03 7:15 UTC (permalink / raw)
To: dedekind; +Cc: linux-mtd, Bruce_Leonard
On Wed, 2008-10-01 at 08:51 +0300, Artem Bityutskiy wrote:
>
> this e-mail informs about a quite important UBIFS feature which
> have already confused many people.
>
> If you use UBIFS, and especially if you have been using JFFS2 before,
> please, read this documentation entry:
>
> http://www.linux-mtd.infradead.org/doc/ubifs.html#L_writeback
>
> Please, remember that UBIFS is _asynchronous_ FS. JFFS2 was synchronous,
> so expect some of your old applications which were fine on JFFS2 to be
> not ready to handle power cuts correctly in case of UBIFS.
JFFS2 wasn't synchronous on NAND. You still needed to use fsync() as
appropriate to ensure that written data made it to the flash and not
just to the write-buffer.
Your list of things to think about is good, but it should be pointed out
that it applies _generally_ to all systems and all file systems.
This is "Programming 101", and there was no excuse for people getting it
wrong on JFFS2, either. It's not as if an fsync() was expensive in the
cases where it did nothing.
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: For UBIFS users: be aware of write-back!
2008-10-03 7:15 ` David Woodhouse
@ 2008-10-03 7:45 ` Artem Bityutskiy
2008-10-03 7:57 ` David Woodhouse
2008-10-03 8:11 ` Artem Bityutskiy
1 sibling, 1 reply; 6+ messages in thread
From: Artem Bityutskiy @ 2008-10-03 7:45 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-mtd, Bruce_Leonard
On Fri, 2008-10-03 at 08:15 +0100, David Woodhouse wrote:
> On Wed, 2008-10-01 at 08:51 +0300, Artem Bityutskiy wrote:
> >
> > this e-mail informs about a quite important UBIFS feature which
> > have already confused many people.
> >
> > If you use UBIFS, and especially if you have been using JFFS2 before,
> > please, read this documentation entry:
> >
> > http://www.linux-mtd.infradead.org/doc/ubifs.html#L_writeback
> >
> > Please, remember that UBIFS is _asynchronous_ FS. JFFS2 was synchronous,
> > so expect some of your old applications which were fine on JFFS2 to be
> > not ready to handle power cuts correctly in case of UBIFS.
>
> JFFS2 wasn't synchronous on NAND. You still needed to use fsync() as
> appropriate to ensure that written data made it to the flash and not
> just to the write-buffer.
That's right, the above documentation even tells about this:
"In contrast, JFFS2 does not have write-back support and all the JFFS2
file system changes go the flash synchronously. Well, this is not
completely true and JFFS2 does have a small buffer of a NAND page size,
but it is small and we may treat JFFS2 as completely synchronous."
> Your list of things to think about is good, but it should be pointed out
> that it applies _generally_ to all systems and all file systems.
Right, agree. I'll amend the docs on the web site.
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: For UBIFS users: be aware of write-back!
2008-10-03 7:45 ` Artem Bityutskiy
@ 2008-10-03 7:57 ` David Woodhouse
2008-10-03 8:03 ` Artem Bityutskiy
0 siblings, 1 reply; 6+ messages in thread
From: David Woodhouse @ 2008-10-03 7:57 UTC (permalink / raw)
To: dedekind; +Cc: linux-mtd, Bruce_Leonard
On Fri, 2008-10-03 at 10:45 +0300, Artem Bityutskiy wrote:
> "In contrast, JFFS2 does not have write-back support and all the JFFS2
> file system changes go the flash synchronously. Well, this is not
> completely true and JFFS2 does have a small buffer of a NAND page
> size, but it is small and we may treat JFFS2 as completely
> synchronous."
That's quite poorly phrased. You may _not_ treat JFFS2 as completely
synchronous. You treat it like a normal file system, or it's going to
eat your babies.
There was a reason I was perfectly happy to make the change which made
JFFS2 start requiring fsync() like normal file systems -- it was because
people should have been doing it _anyway_.
Anyone who was skipping the required sync handling because they 'knew'
that it didn't matter on JFFS2, even though it didn't cost them anything
anyway -- and who didn't wake up at 3am every morning in a cold sweat,
worrying that it might have broken today -- deserves to be taken out
back and shot.
When it comes to correctness, people shouldn't have to do anything
special for different file systems. If there is _anything_ fs-specific
about the correctness issues, you are doing something WRONG (cf. NFS).
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: For UBIFS users: be aware of write-back!
2008-10-03 7:57 ` David Woodhouse
@ 2008-10-03 8:03 ` Artem Bityutskiy
0 siblings, 0 replies; 6+ messages in thread
From: Artem Bityutskiy @ 2008-10-03 8:03 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-mtd, Bruce_Leonard
On Fri, 2008-10-03 at 08:57 +0100, David Woodhouse wrote:
> On Fri, 2008-10-03 at 10:45 +0300, Artem Bityutskiy wrote:
> > "In contrast, JFFS2 does not have write-back support and all the JFFS2
> > file system changes go the flash synchronously. Well, this is not
> > completely true and JFFS2 does have a small buffer of a NAND page
> > size, but it is small and we may treat JFFS2 as completely
> > synchronous."
>
> That's quite poorly phrased. You may _not_ treat JFFS2 as completely
> synchronous. You treat it like a normal file system, or it's going to
> eat your babies.
>
> There was a reason I was perfectly happy to make the change which made
> JFFS2 start requiring fsync() like normal file systems -- it was because
> people should have been doing it _anyway_.
>
> Anyone who was skipping the required sync handling because they 'knew'
> that it didn't matter on JFFS2, even though it didn't cost them anything
> anyway -- and who didn't wake up at 3am every morning in a cold sweat,
> worrying that it might have broken today -- deserves to be taken out
> back and shot.
>
> When it comes to correctness, people shouldn't have to do anything
> special for different file systems. If there is _anything_ fs-specific
> about the correctness issues, you are doing something WRONG (cf. NFS).
Well, this is what I actually assume. I'll change the docs to make them
telling loudly about this.
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: For UBIFS users: be aware of write-back!
2008-10-03 7:15 ` David Woodhouse
2008-10-03 7:45 ` Artem Bityutskiy
@ 2008-10-03 8:11 ` Artem Bityutskiy
1 sibling, 0 replies; 6+ messages in thread
From: Artem Bityutskiy @ 2008-10-03 8:11 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-mtd, Bruce_Leonard
On Fri, 2008-10-03 at 08:15 +0100, David Woodhouse wrote:
> On Wed, 2008-10-01 at 08:51 +0300, Artem Bityutskiy wrote:
> >
> > this e-mail informs about a quite important UBIFS feature which
> > have already confused many people.
> >
> > If you use UBIFS, and especially if you have been using JFFS2 before,
> > please, read this documentation entry:
> >
> > http://www.linux-mtd.infradead.org/doc/ubifs.html#L_writeback
> >
> > Please, remember that UBIFS is _asynchronous_ FS. JFFS2 was synchronous,
> > so expect some of your old applications which were fine on JFFS2 to be
> > not ready to handle power cuts correctly in case of UBIFS.
>
> JFFS2 wasn't synchronous on NAND. You still needed to use fsync() as
> appropriate to ensure that written data made it to the flash and not
> just to the write-buffer.
>
> Your list of things to think about is good, but it should be pointed out
> that it applies _generally_ to all systems and all file systems.
>
> This is "Programming 101", and there was no excuse for people getting it
> wrong on JFFS2, either. It's not as if an fsync() was expensive in the
> cases where it did nothing.
I probably did not phrase things well enough and suggestions are
welcome.
But the idea of what I wanted to say is:
1. There is a lot of user-space which kind of works fine in JFFS2
2. But the user-space is buggy, and it looses/corrupts files in case of
UBIFS.
3. I try to explain why this happens, and why people should change their
user-space which sort of worked fine on JFFS2.
This is the reason why I brought up JFFS2 to the discussion and why I
called it synchronous. I did not intend to encourage people not to use
fsync() in case of JFFS2.
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-10-03 8:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-01 5:51 For UBIFS users: be aware of write-back! Artem Bityutskiy
2008-10-03 7:15 ` David Woodhouse
2008-10-03 7:45 ` Artem Bityutskiy
2008-10-03 7:57 ` David Woodhouse
2008-10-03 8:03 ` Artem Bityutskiy
2008-10-03 8:11 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox