[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAECXXi67L+Oo0W6bwoKqr_AY95HHcsXbK=XrK6H_iT8Ca6T14A@mail.gmail.com>
Date: Tue, 12 Feb 2013 17:16:28 -0500
From: Paul Clements <paul.clements@...sios.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: linux-kernel@...r.kernel.org, nbd-general@...ts.sf.net,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 3/3] nbd: show read-only state in sysfs
On Tue, Feb 12, 2013 at 11:06 AM, Paolo Bonzini <pbonzini@...hat.com> wrote:
> Pass the read-only flag to set_device_ro, so that it will be
> visible to the block layer and in sysfs.
Looks good
> Cc: <nbd-general@...ts.sf.net>
> Cc: Paul Clements <Paul.Clements@...eleye.com>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Signed-off-by: Paolo Bonzini <pbonzini@...hat.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
>
--
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