[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <18131.24405.451485.40460@notabene.brown>
Date: Tue, 28 Aug 2007 09:33:41 +1000
From: Neil Brown <neilb@...e.de>
To: Al Viro <viro@....linux.org.uk>
Cc: linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-fsdevel@...r.kernel.org, axboe@...nel.dk
Subject: Re: [RFC] block_device_operations prototype changes
On Monday August 27, viro@....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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists