From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: <nbd-general@lists.sf.net>,
Paul Clements <Paul.Clements@steeleye.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 3/3] nbd: show read-only state in sysfs
Date: Tue, 12 Feb 2013 17:06:11 +0100 [thread overview]
Message-ID: <1360685171-3792-4-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1360685171-3792-1-git-send-email-pbonzini@redhat.com>
Pass the read-only flag to set_device_ro, so that it will be
visible to the block layer and in sysfs.
Cc: <nbd-general@lists.sf.net>
Cc: Paul Clements <Paul.Clements@steeleye.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
drivers/block/nbd.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index a9c5c7a..ef17c2e 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -703,6 +703,8 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
mutex_unlock(&nbd->tx_lock);
+ if (nbd->flags & NBD_FLAG_READ_ONLY)
+ set_device_ro(bdev, true);
if (nbd->flags & NBD_FLAG_SEND_TRIM)
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD,
nbd->disk->queue);
@@ -730,6 +732,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
dev_warn(disk_to_dev(nbd->disk), "queue cleared\n");
kill_bdev(bdev);
queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, nbd->disk->queue);
+ set_device_ro(bdev, false);
if (file)
fput(file);
nbd->flags = 0;
--
1.7.1
next prev parent reply other threads:[~2013-02-12 16:06 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-12 16:06 [PATCH 0/3] NBD fixes for caching and block device flags Paolo Bonzini
2013-02-12 16:06 ` [PATCH 1/3] nbd: support FLUSH requests Paolo Bonzini
2013-02-12 17:37 ` Alex Bligh
2013-02-12 18:06 ` Paolo Bonzini
2013-02-12 21:32 ` Andrew Morton
2013-02-13 0:03 ` Alex Bligh
2013-02-13 13:00 ` Paolo Bonzini
2013-02-13 15:55 ` Alex Bligh
2013-02-13 16:02 ` Paolo Bonzini
2013-02-13 17:35 ` Alex Bligh
2013-02-13 0:00 ` Alex Bligh
2013-02-12 22:07 ` Paul Clements
2013-02-12 16:06 ` [PATCH 2/3] nbd: fsync and kill block device on shutdown Paolo Bonzini
2013-02-12 21:41 ` Andrew Morton
2013-02-13 13:05 ` Paolo Bonzini
2013-02-12 22:15 ` Paul Clements
2013-02-12 16:06 ` Paolo Bonzini [this message]
2013-02-12 22:16 ` [PATCH 3/3] nbd: show read-only state in sysfs Paul Clements
2013-02-12 21:43 ` [PATCH 0/3] NBD fixes for caching and block device flags Andrew Morton
2013-02-13 17:14 ` [Nbd] " Wouter Verhelst
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=1360685171-3792-4-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=Paul.Clements@steeleye.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nbd-general@lists.sf.net \
/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®