nbd: Return correct error for write to read-only export
commitc0301fcc811432a587f6f94fee08d7965c1671d0
authorEric Blake <eblake@redhat.com>
Wed, 6 Apr 2016 03:35:02 +0000 (5 21:35 -0600)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 7 Apr 2016 22:07:43 +0000 (8 00:07 +0200)
treec48b8814eebecdf284ea35b861c7f3f7028054c7
parentb3f3fdeb956a1fb866939ee1b2d8392b8f536a79
nbd: Return correct error for write to read-only export

The NBD Protocol requires that servers should send EPERM for
attempts to write (or trim) a read-only export.  We were
correct for TRIM (blk_co_discard() gave EPERM); but were
manually setting EROFS which then got mapped to EINVAL over
the wire on writes.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1459913704-19949-2-git-send-email-eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
nbd/server.c