All of lore.kernel.org
 help / color / mirror / Atom feed
* o_sync in vfat driver
@ 2006-02-26 22:55 col-pepper
  0 siblings, 0 replies; 49+ messages in thread
From: col-pepper @ 2006-02-26 22:55 UTC (permalink / raw)
  To: linux-kernel

part 3 (we'll get past these filters in the end...)

These devices do present special problems since they are a rw media that
can be abruptly removed at any time without even the chance for the OS to
interrupt on-going IO.

This is compounded by the fact that flash memory has to be zeroed and then
rewritten with the new data. If the device is physically removed before a
block is written the update will be lost. If it is removed _during_ write
the new and the old data will likely be lost.

If the block being written is the FAT , the principal record of the
structure of the whole disk will very likely be erased.

Since there is a heavy performance penalty involved (typically around an
_order of magnitude_ slower), it seems that the sole aim here is security
of data at any cost in the case of premature withdrawal.

^ permalink raw reply	[flat|nested] 49+ messages in thread
* o_sync in vfat driver
@ 2006-02-26 23:08 col-pepper
  2006-02-27  0:51 ` Andrew Morton
  0 siblings, 1 reply; 49+ messages in thread
From: col-pepper @ 2006-02-26 23:08 UTC (permalink / raw)
  To: linux-kernel


*** Is that aim being achieved by the current policy? ***

As I understand it the old (<=2.6.11) sync model kept the data in sync
without updating the FAT until later. This runs the risks of partial
corruption of one or more files on pullout.

The new model attempts to be more rigourous by updating the FAT every time
a block of data is written. Thus the "hammering" of the physical memory
hosting the FAT record.

In view of the nature of flash memory this may actually be drastically
increasing the chance that the whole FAT gets erased.
part IV (end of a sage)

If a pullout occurs during write , there is now a near 50% chance that
this takes out the entire FAT.

It would seem that the main advantage of this scheme is that it is so slow
that it encourages users to turn it off. Presumably in the process of
coming to that conclusion they will become aware of the need to run umount
or the sync command before doing removing the device.

= Danger of destroying hardware =

It seems that there are well documented cases of this abusive rewriting of
the FAT causing rapid and total premature failure of what Alan Cox refers
to as "ultra-crap devices".

There may be valid reasons of cost or miniaturisation that preclude the
additional hardware found in more complex devices.

Even if better quality devices may have some sort of paging mechanism
which makes them more resistant to this sort of abuse, it does not seem
good engineering practice to dismiss those that fail as "shite".

There is nothing in the spec of vfat that suggests the FAT will be written
10.000 during the writing of one large file. Indeed it is hard to imagine
that any other implementation on any other OS or any previous linux kernel
behaves like that.

So should the hardware manufacturers have anticipated this particular
driver implementation or should the kernel be more aware of the existing
hardware that it purports to support.

= The way forward =

It would seem that the first step could be to revert to the 2.6.11
behaviour which was more appropriate and probably safer even from the data
point of view.

I lack the knowlege and experience to produce reliable kernel code so I
wont try. However, I have already seen a number of suggestions of how the
old model could be improved. This post could be the starting point for a
discussion of more robust techniques. In any case the coding is unlikely
to be very complex given the existing , tested code base that is in place
in 2.6.11

Any new technique should probably aim to be applicable to larger devices
as well. The 2G limit is artificial and is a tacit recognition of the
precarity of the current code. USB hard disks are just as prone to
accidental cable pullout. Some periodic or per file sync should probably
be envisaged for the VFAT sync mount option.


PS if anyone can tell me why I had to post this ten times and chop it into  
little bits it would be appreciated in not messing up the list in the  
future.

I spent an hour reading the faq and I dont see anything taboo here.


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

end of thread, other threads:[~2006-03-30 17:38 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <op.s5cj47sxj68xd1@mail.piments.com>
     [not found] ` <op.s5jpqvwhui3qek@mail.piments.com>
     [not found]   ` <op.s5kxhyzgfx0war@mail.piments.com>
     [not found]     ` <op.s5kx7xhfj68xd1@mail.piments.com>
     [not found]       ` <op.s5kya3t0j68xd1@mail.piments.com>
     [not found]         ` <op.s5ky2dbcj68xd1@mail.piments.com>
     [not found]           ` <op.s5ky71nwj68xd1@mail.piments.com>
     [not found]             ` <op.s5kzao2jj68xd1@mail.piments.com>
2006-02-26 22:50               ` o_sync in vfat driver col-pepper
2006-02-27 13:28                 ` Lennart Sorensen
2006-02-27 13:50                   ` Arjan van de Ven
2006-02-27 14:06                     ` Anton Altaparmakov
2006-02-27 14:27                       ` Arjan van de Ven
2006-02-27 14:41                         ` Anton Altaparmakov
2006-02-27 21:04                           ` col-pepper
2006-02-27 21:17                             ` Arjan van de Ven
2006-02-27 23:21                               ` col-pepper
2006-02-27 21:32                             ` linux-os (Dick Johnson)
2006-02-27 23:21                               ` col-pepper
2006-02-28 13:10                                 ` linux-os (Dick Johnson)
2006-02-28 13:52                                   ` Sergei Organov
2006-02-28 15:18                                   ` Lennart Sorensen
2006-02-28 16:16                                     ` linux-os (Dick Johnson)
2006-02-28 17:23                                       ` Sergei Organov
2006-02-28 18:09                                       ` Krzysztof Halasa
2006-02-28 17:16                                   ` col-pepper
2006-02-28 22:38                                 ` Pavel Machek
2006-02-28 23:10                                   ` why VM_SHM has been removed from mm.h? Kamran Karimi
2006-03-01  3:02                                     ` Phillip Susi
2006-03-01  7:56                                     ` Hugh Dickins
2006-03-01 14:58                                       ` Kamran Karimi
2006-03-01 16:24                                         ` Hugh Dickins
2006-03-01 16:55                                           ` Kamran Karimi
2006-03-01 17:50                                             ` Hugh Dickins
2006-03-01  4:28                                   ` o_sync in vfat driver Kyle Moffett
2006-03-02  8:23                                   ` col-pepper
2006-03-02  8:32                                     ` Pavel Machek
2006-02-28 16:11                             ` Helge Hafting
2006-02-28 22:37                             ` Pavel Machek
2006-02-27 14:26                   ` linux-os (Dick Johnson)
2006-02-27 18:53                     ` Jan Engelhardt
2006-02-26 22:55 col-pepper
  -- strict thread matches above, loose matches on Subject: below --
2006-02-26 23:08 col-pepper
2006-02-27  0:51 ` Andrew Morton
2006-02-27 22:19   ` col-pepper
2006-02-27 23:12     ` Andrew Morton
2006-02-28 18:47       ` Chris Mason
2006-02-28 19:10         ` Andrew Morton
2006-02-28 19:48           ` Chris Mason
     [not found]         ` <87u0aiw6pi.fsf@duaron.myhome.or.jp>
2006-03-01 15:23           ` Chris Mason
     [not found]             ` <87mzg9wst0.fsf@duaron.myhome.or.jp>
2006-03-02 13:45               ` Chris Mason
2006-03-02 14:07                 ` OGAWA Hirofumi
2006-03-02 17:01                   ` Chris Mason
2006-03-02 18:14                     ` OGAWA Hirofumi
2006-03-29  2:13         ` Mathis Ahrens
2006-03-30 17:35           ` col-pepper
2006-02-28  0:52     ` Machida, Hiroyuki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.