linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ilya Dryomov <idryomov@gmail.com>
To: linux-block@vger.kernel.org
Cc: Jens Axboe <axboe@fb.com>, Christoph Hellwig <hch@infradead.org>,
	Tejun Heo <tj@kernel.org>, David Disseldorp <ddiss@suse.de>,
	Sagi Grimberg <sagi@grimberg.me>
Subject: [PATCH v3 0/2] block: enforce ioctl(BLKROSET) and set_disk_ro()
Date: Thu, 11 Jan 2018 14:09:10 +0100	[thread overview]
Message-ID: <1515676152-18476-1-git-send-email-idryomov@gmail.com> (raw)

Hello,

I was doing some cleanup work on rbd BLKROSET handler and discovered
that we ignore partition rw/ro setting (hd_struct->policy) for pretty
much everything but straight writes.

David (CCed) has blktests patches standing by.

(Another aspect of this is that we don't enforce open(2) mode.  Tejun
took a stab at this a few years ago, but his patch had to be reverted:

  75f1dc0d076d ("block: check bdev_read_only() from blkdev_get()")
  e51900f7d38c ("block: revert block_dev read-only check")

It is a separate issue and refusing writes to read-only devices is
obviously more important, but perhaps it's time to revisit that as
well?)

v2 -> v3:
- lookup part only once; combine read-only check with existing
  should_fail_request check

v1 -> v2:
- added unlikely() per Sagi's suggestion

Thanks,

                Ilya


Ilya Dryomov (2):
  block: fail op_is_write() requests to read-only partitions
  block: add bdev_read_only() checks to common helpers

 block/blk-core.c | 56 ++++++++++++++++++++++++++++++++++++++------------------
 block/blk-lib.c  | 12 ++++++++++++
 2 files changed, 50 insertions(+), 18 deletions(-)

-- 
2.4.3

             reply	other threads:[~2018-01-11 13:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11 13:09 Ilya Dryomov [this message]
2018-01-11 13:09 ` [PATCH v3 1/2] block: fail op_is_write() requests to read-only partitions Ilya Dryomov
2018-01-14  9:35   ` Sagi Grimberg
2018-01-11 13:09 ` [PATCH v3 2/2] block: add bdev_read_only() checks to common helpers Ilya Dryomov
2018-01-14  9:35   ` Sagi Grimberg
2018-01-18 11:16 ` [PATCH v3 0/2] block: enforce ioctl(BLKROSET) and set_disk_ro() Ilya Dryomov
2018-01-18 19:57 ` Jens Axboe

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=1515676152-18476-1-git-send-email-idryomov@gmail.com \
    --to=idryomov@gmail.com \
    --cc=axboe@fb.com \
    --cc=ddiss@suse.de \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=sagi@grimberg.me \
    --cc=tj@kernel.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;
as well as URLs for NNTP newsgroup(s).