mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Chuck Ebbert <cebbert@redhat.com>,
	linux-kernel@vger.kernel.org, Milan Broz <mbroz@redhat.com>
Subject: Re: [Patch v2] block: revert block_dev read-only check
Date: Thu, 17 Feb 2011 01:23:35 +0100	[thread overview]
Message-ID: <20110217002335.GI29600@atj.dyndns.org> (raw)
In-Reply-To: <AANLkTikuMNjk=nBvaARXJ0LBp_8OS+-iMv20t-rf34ph@mail.gmail.com>

Helo,

On Wed, Feb 16, 2011 at 03:56:10PM -0800, Linus Torvalds wrote:
> > The commit was part of effort to enforce the ro flag.  It at least
> > makes sure that a device can't be opened RW if marked RO.  loop and dm
> > showed some problems but fixing the in-kernel part isn't difficult
> > (fixes pending).
> 
> Well, if the thing breaks things, then it needs to be reverted, or
> those fixes need to not be "pending".

They should be mergeable once Jens comes back.

> > IIUC, the problematic part is dm userland, which reportedly opens
> > member devices RW even when building a RO device.  The problem is when
> > a user is trying to build RO dm device from RO member devices.  dm
> > userland tries to open the member devices RW, which block layer
> > rejects now thus failing dm assembly.
> 
> .. this makes me all the more suspicious. Sounds unfixable in a single
> release (or even a few years). So it smells like we should (a) do the
> revert and (b) add a warning for the case where somebody opens a
> device RW where the low-level device itself is RO.

Yeap, I'm not against reverting.  That is likely the right thing to do
in this cycle anyway.

> That said, if the user has permission to open the device RW (and the
> normal device node permission checks have obviously always done that
> check), I do think it's perfectly ok to do that. And if the user never
> writes to it, then the fact that the device isn't writable is
> irrelevant.

It has been a while so the details might be a bit off but read/write
permissions on block devices are rather weird.

* RO block devices can be opened RW.

* Block devices can get writes whether the device is opened RO or RW.

* Filesystem journal replay and probably some of stacking block driver
  metadata updates issue writes to RO block devices.

So, IIUC, there already are paths where writes are issued and
processed where they shouldn't be.  Everything is RO but the block
device ends up being modified.

Thanks.

--
tejun

  reply	other threads:[~2011-02-17  0:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-16 23:11 Chuck Ebbert
2011-02-16 23:28 ` Tejun Heo
2011-02-16 23:56   ` Linus Torvalds
2011-02-17  0:23     ` Tejun Heo [this message]
2011-02-17  0:46       ` Linus Torvalds

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=20110217002335.GI29600@atj.dyndns.org \
    --to=tj@kernel.org \
    --cc=cebbert@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbroz@redhat.com \
    --cc=torvalds@linux-foundation.org \
    /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

all inboxes | Powered by JetHome®