All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-stable@nongnu.org,
	"open list:Network Block Dev..." <qemu-block@nongnu.org>,
	Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PULL 3/8] nbd-client: Refuse read-only client with BDRV_O_RDWR
Date: Sun, 3 Dec 2017 19:01:03 +0000	[thread overview]
Message-ID: <20171203190103.GG2450@redhat.com> (raw)
In-Reply-To: <20171109165939.23154-4-eblake@redhat.com>

On Thu, Nov 09, 2017 at 10:59:34AM -0600, Eric Blake wrote:
> The NBD spec says that clients should not try to write/trim to
> an export advertised as read-only by the server.  But we failed
> to check that, and would allow the block layer to use NBD with
> BDRV_O_RDWR even when the server is read-only, which meant we
> were depending on the server sending a proper EPERM failure for
> various commands, and also exposes a leaky abstraction: using
> qemu-io in read-write mode would succeed on 'w -z 0 0' because
> of local short-circuiting logic, but 'w 0 0' would send a
> request over the wire (where it then depends on the server, and
> fails at least for qemu-nbd but might pass for other NBD
> implementations).
> 
> With this patch, a client MUST request read-only mode to access
> a server that is doing a read-only export, or else it will get
> a message like:
> 
> can't open device nbd://localhost:10809/foo: request for write access conflicts with read-only export

Nice one!

This caught 3 bugs in the nbdkit test suite where we were opening the
connection for write to a read-only server instance, and it happened
to work because the test did not write anything.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW

  reply	other threads:[~2017-12-03 19:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 16:59 [Qemu-devel] [PULL 0/8] NBD patches for 2.11-rc1 Eric Blake
2017-11-09 16:59 ` [Qemu-devel] [PULL 1/8] nbd/server: fix nbd_negotiate_handle_info Eric Blake
2017-11-09 16:59 ` [Qemu-devel] [PULL 2/8] nbd-client: Fix error message typos Eric Blake
2017-11-09 16:59 ` [Qemu-devel] [PULL 3/8] nbd-client: Refuse read-only client with BDRV_O_RDWR Eric Blake
2017-12-03 19:01   ` Richard W.M. Jones [this message]
2017-11-09 16:59 ` [Qemu-devel] [PULL 4/8] nbd/client: Nicer trace of structured reply Eric Blake
2017-11-09 16:59 ` [Qemu-devel] [PULL 5/8] nbd: Fix struct name for structured reads Eric Blake
2017-11-09 16:59 ` [Qemu-devel] [PULL 6/8] nbd-client: Short-circuit 0-length operations Eric Blake
2017-11-09 16:59 ` [Qemu-devel] [PULL 7/8] nbd-client: Stricter enforcing of structured reply spec Eric Blake
2017-11-09 16:59 ` [Qemu-devel] [PULL 8/8] nbd/server: Fix structured read of length 0 Eric Blake
2017-11-13 13:53 ` [Qemu-devel] [PULL 0/8] NBD patches for 2.11-rc1 Peter Maydell

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=20171203190103.GG2450@redhat.com \
    --to=rjones@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.