linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, axboe@kernel.dk
Subject: Re: [RFC] block_device_operations prototype changes
Date: Tue, 28 Aug 2007 09:33:41 +1000	[thread overview]
Message-ID: <18131.24405.451485.40460@notabene.brown> (raw)
In-Reply-To: message from Al Viro on Monday August 27

On Monday August 27, viro@ftp.linux.org.uk wrote:
> 	* a bug (AFAICT) in md.c - we open raid components r/w and if it
> fails, it fails.  Good for our purposes, but... how about raid0 on read-only
> devices?  In any case, we have a ready place to store mode_t, so it's not a
> problem for getting the right value to blkdev_put().  FWIW, I think that
> allowing fallback to r/o (and making the entire array r/o, of course) would
> be a good thing to have.  Any comments from drivers/md folks?

I've never heard any suggestion of anybody wanting to include a
readonly device in an md array -  I guess one could imagine an array
of CDROMs, but I doubt anyone would actually create one.
However I agree that falling back to read-only (particular if the
error value indicated that this was the only problem) would be a
sensible thing to do in some circumstances.

More interestingly:  one could argue that when the md array is
switched to read-only, each component device should be reopened as
read-only.  So I would really like the interface to have a way to
switch a device between read-only and read-write without closing and
re-opening.

Though I guess opening and then closing as you suggest below would be OK.

> 	* open_bdev_excl()/close_bdev_excl().  Needs an extra argument for
> the latter.  Two interesting callers:
> 	* kill_block_super() - need to store relevant mode_t in superblock,
> along with reference to bdev.  Note that just looking at sb->s_flags is *not*
> enough - some filesystems go read-only on errors and that changes ->s_flags.
> Another side of that is explicit remount from r/o to r/w and there we have
> a bug - we do _not_ tell the driver that something had happened.  Proper
> fix is simple enough - bdget() + blkdev_get() for write + blkdev_put() with
> old mode_t (i.e. FMODE_READ) once we are done remounting (and similar for
> explicit remount to r/o).


I would *really* like to see this.  When the root filesystem gets
mounted read-only, I want md to know so that it can mark the array as
'clean' straight away.  I really don't like having a reboot-notifier
to mark all arrays as 'clean' on shutdown.

So each device would be responsible for keeping a count of 'readonly'
and 'read-write' accesses?  Or would that be in common code?

I look forward to this all getting cleaned up!

NeilBrown

      parent reply	other threads:[~2007-08-27 23:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-27 10:30 [RFC] block_device_operations prototype changes Al Viro
2007-08-27 16:35 ` Linus Torvalds
2007-08-27 22:59 ` Alasdair G Kergon
2007-08-27 23:33 ` Neil Brown [this message]

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=18131.24405.451485.40460@notabene.brown \
    --to=neilb@suse.de \
    --cc=axboe@kernel.dk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@ftp.linux.org.uk \
    /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).