All of lore.kernel.org
 help / color / mirror / Atom feed
* read-only partitions: does the policy apply to all metadata ?
@ 2009-03-10 16:26 porte64
  2009-03-10 17:22 ` Valdis.Kletnieks
  2009-03-10 23:33 ` Robert Hancock
  0 siblings, 2 replies; 7+ messages in thread
From: porte64 @ 2009-03-10 16:26 UTC (permalink / raw)
  To: linux-kernel

Hello,

When a partition is mounted as read-only, does the kernel
really prevent ANY byte to be written to it, including
any metadata ?

(i am thinking here about file attributes -- last access time,
as well as meta information about filesystem/blocks
description etc ...).

And is the policy implemented in every filesystem type driver
or at some abstraction level (as if the write() and like
system calls were designed to return an error).

Unfortunately, on common (all?) hard drives, there seems
to be no switch to set the device microcode in read-only
mode.

By the way, this makes me also thing about memory cards
with locks: is it a real protection or it is just a setting
which tells the kernel that it *SHOULD* mount the device
read-only ?

Please include my private address if you answer; i posted to the
list because in some other forums we did not come up
with a clear answer, so this is my last chance to get a
definite done. However i didn't subscribe to the list as
i have realized i am not able to help unfortunately:
operating systems are the most complex thing ever design by humans !

Best regards
Phil

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

* Re: read-only partitions: does the policy apply to all metadata ?
  2009-03-10 16:26 read-only partitions: does the policy apply to all metadata ? porte64
@ 2009-03-10 17:22 ` Valdis.Kletnieks
  2009-03-10 17:34   ` Alan Cox
  2009-03-10 23:33 ` Robert Hancock
  1 sibling, 1 reply; 7+ messages in thread
From: Valdis.Kletnieks @ 2009-03-10 17:22 UTC (permalink / raw)
  To: porte64; +Cc: linux-kernel

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

On Tue, 10 Mar 2009 17:26:44 BST, porte64@free.fr said:
> When a partition is mounted as read-only, does the kernel
> really prevent ANY byte to be written to it, including
> any metadata ?

It's very hard to come up with a workable way to do a true read-only
mount of a journaled filesystem such as ext3 - what do you do if there's
anything in the journal that needs to be replayed?

Your best bet is to not worry about the filesystem, and look at flagging the
underlying block device as read-only.

[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]

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

* Re: read-only partitions: does the policy apply to all metadata ?
  2009-03-10 17:22 ` Valdis.Kletnieks
@ 2009-03-10 17:34   ` Alan Cox
  2009-03-10 18:08     ` Valdis.Kletnieks
  2009-03-15 21:17     ` Pavel Machek
  0 siblings, 2 replies; 7+ messages in thread
From: Alan Cox @ 2009-03-10 17:34 UTC (permalink / raw)
  To: Valdis.Kletnieks; +Cc: porte64, linux-kernel

On Tue, 10 Mar 2009 13:22:39 -0400
Valdis.Kletnieks@vt.edu wrote:

> On Tue, 10 Mar 2009 17:26:44 BST, porte64@free.fr said:
> > When a partition is mounted as read-only, does the kernel
> > really prevent ANY byte to be written to it, including
> > any metadata ?
> 
> It's very hard to come up with a workable way to do a true read-only
> mount of a journaled filesystem such as ext3 - what do you do if there's
> anything in the journal that needs to be replayed?

Replay it to a snapshot backed by the r/o fs ...

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

* Re: read-only partitions: does the policy apply to all metadata ?
  2009-03-10 17:34   ` Alan Cox
@ 2009-03-10 18:08     ` Valdis.Kletnieks
  2009-03-15 21:17     ` Pavel Machek
  1 sibling, 0 replies; 7+ messages in thread
From: Valdis.Kletnieks @ 2009-03-10 18:08 UTC (permalink / raw)
  To: Alan Cox; +Cc: porte64, linux-kernel

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

On Tue, 10 Mar 2009 17:34:37 -0000, Alan Cox said:

> Replay it to a snapshot backed by the r/o fs ...

Assuming you've got an LVM in place, and someplace to put the snapshot,
and all that.  It's certainly well outside what you'd *expect* to happen
if you do a 'mount -o ro' of an ext3 file system. ;)

[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]

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

* Re: read-only partitions: does the policy apply to all metadata ?
  2009-03-10 16:26 read-only partitions: does the policy apply to all metadata ? porte64
  2009-03-10 17:22 ` Valdis.Kletnieks
@ 2009-03-10 23:33 ` Robert Hancock
  2009-03-12  8:55   ` porte64
  1 sibling, 1 reply; 7+ messages in thread
From: Robert Hancock @ 2009-03-10 23:33 UTC (permalink / raw)
  To: porte64; +Cc: linux-kernel

porte64@free.fr wrote:
> Hello,
> 
> When a partition is mounted as read-only, does the kernel
> really prevent ANY byte to be written to it, including
> any metadata ?
> 
> (i am thinking here about file attributes -- last access time,
> as well as meta information about filesystem/blocks
> description etc ...).

As far as I know any of the visible attributes (last access, etc.) 
cannot be modified. However, mounting read-only may still write to the 
filesystem if the block device is writable, for example with ext3/ext4 
if the file system was not unmounted cleanly last time and the journal 
needs to be replayed.

> 
> And is the policy implemented in every filesystem type driver
> or at some abstraction level (as if the write() and like
> system calls were designed to return an error).
> 
> Unfortunately, on common (all?) hard drives, there seems
> to be no switch to set the device microcode in read-only
> mode.
> 
> By the way, this makes me also thing about memory cards
> with locks: is it a real protection or it is just a setting
> which tells the kernel that it *SHOULD* mount the device
> read-only ?

Normally the card reader indicates to the OS that the device is 
read-only, and then the kernel will mount it only read-only. However, 
note that some crappy SD card readers don't implement the write protect 
switch detection and will allow writing to a card marked read-only.

> 
> Please include my private address if you answer; i posted to the
> list because in some other forums we did not come up
> with a clear answer, so this is my last chance to get a
> definite done. However i didn't subscribe to the list as
> i have realized i am not able to help unfortunately:
> operating systems are the most complex thing ever design by humans !
> 
> Best regards
> Phil


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

* Re: read-only partitions: does the policy apply to all metadata ?
  2009-03-10 23:33 ` Robert Hancock
@ 2009-03-12  8:55   ` porte64
  0 siblings, 0 replies; 7+ messages in thread
From: porte64 @ 2009-03-12  8:55 UTC (permalink / raw)
  To: linux-kernel

Thanks to you all for your answers !

Phil

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

* Re: read-only partitions: does the policy apply to all metadata ?
  2009-03-10 17:34   ` Alan Cox
  2009-03-10 18:08     ` Valdis.Kletnieks
@ 2009-03-15 21:17     ` Pavel Machek
  1 sibling, 0 replies; 7+ messages in thread
From: Pavel Machek @ 2009-03-15 21:17 UTC (permalink / raw)
  To: Alan Cox; +Cc: Valdis.Kletnieks, porte64, linux-kernel

On Tue 2009-03-10 17:34:37, Alan Cox wrote:
> On Tue, 10 Mar 2009 13:22:39 -0400
> Valdis.Kletnieks@vt.edu wrote:
> 
> > On Tue, 10 Mar 2009 17:26:44 BST, porte64@free.fr said:
> > > When a partition is mounted as read-only, does the kernel
> > > really prevent ANY byte to be written to it, including
> > > any metadata ?
> > 
> > It's very hard to come up with a workable way to do a true read-only
> > mount of a journaled filesystem such as ext3 - what do you do if there's
> > anything in the journal that needs to be replayed?
> 
> Replay it to a snapshot backed by the r/o fs ...

Or you can use 'ro, noload' to just ignore the journal. See the docs.

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

end of thread, other threads:[~2009-03-15 21:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-10 16:26 read-only partitions: does the policy apply to all metadata ? porte64
2009-03-10 17:22 ` Valdis.Kletnieks
2009-03-10 17:34   ` Alan Cox
2009-03-10 18:08     ` Valdis.Kletnieks
2009-03-15 21:17     ` Pavel Machek
2009-03-10 23:33 ` Robert Hancock
2009-03-12  8:55   ` porte64

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.