linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Piergiorgio Sartor <piergiorgio.sartor@nexgo.de>
Cc: linux-raid@vger.kernel.org
Subject: Re: md device is read only mode
Date: Mon, 9 Jul 2012 11:40:22 +1000	[thread overview]
Message-ID: <20120709114022.58f5d52b@notabene.brown> (raw)
In-Reply-To: <20120705172748.GA6464@lazy.lzy>

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

On Thu, 5 Jul 2012 19:27:48 +0200 Piergiorgio Sartor
<piergiorgio.sartor@nexgo.de> wrote:

> Hi all,
> 
> following the comment of Neil about the fact that
> an md device, in r/o mode, will BUG() in case of
> write attempt, I would like to ask for some more
> information on the topic.
> 
> The problem is the following, mounting a filesystem
> in r/o does not, correctly, prevent writes to the
> underlying device.

This is only half the story.
If the mount command requests read-only, the filesystem may still write to
the device.
However if the device is marked read-only then the filesystem should not
write to the disk - if it finds that it needs to, it should fail the
mount request.
I believe that filesystems behave correctly in this manner, though there
could still be bugs lurking.

> 
> Now, assuming a filesystem is mounted r/w over an
> md device, being r/w too, it is pretty clear that
> switching the md device to r/o will create problems.

Not quite.  When the filesystem is mounted, md will refuse to switch the
device to read-only, so that scenario is not possible.

> 
> What if the md device is started in r/o mode and
> than, later, the filesystem is mounted *without*
> specifying r/o mode?

The mount system call will notice that the device is read-only, and will make
assume the read-only mount option.

> 
> The filesystem might try to write to the device,
> but it will not work, of course.
> Does this will cause a BUG() in md?

Only if there are bugs.

> 
> Because using a r/o memory card, there are no
> problems, the mount recognize the device is r/o
> and it sets the filesystems r/o too.
> I do not know if it anyway tries to write to the
> r/o device, ignoring the errors reported.
> 
> I would say that, if md BUG() in any case, it
> could be a bug... :-)
> 
> Any comments?
> 
> Thanks,
> 
> bye,
> 

NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2012-07-09  1:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-05 17:27 md device is read only mode Piergiorgio Sartor
2012-07-09  1:40 ` NeilBrown [this message]
2012-07-09 17:34   ` Piergiorgio Sartor
2012-07-09 21:42     ` NeilBrown

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=20120709114022.58f5d52b@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=piergiorgio.sartor@nexgo.de \
    /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;
as well as URLs for NNTP newsgroup(s).