From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com
Subject: [Qemu-devel] [PATCH 1/3] nbd: Return correct error for write to read-only export
Date: Tue, 5 Apr 2016 21:35:02 -0600 [thread overview]
Message-ID: <1459913704-19949-2-git-send-email-eblake@redhat.com> (raw)
In-Reply-To: <1459913704-19949-1-git-send-email-eblake@redhat.com>
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>
---
nbd/server.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/nbd/server.c b/nbd/server.c
index b95571b..98e3957 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -26,6 +26,7 @@ static int system_errno_to_nbd_errno(int err)
case 0:
return NBD_SUCCESS;
case EPERM:
+ case EROFS:
return NBD_EPERM;
case EIO:
return NBD_EIO;
--
2.5.5
next prev parent reply other threads:[~2016-04-06 3:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-06 3:35 [Qemu-devel] [PATCH 0/3 for-2.6] more nbd fixups Eric Blake
2016-04-06 3:35 ` Eric Blake [this message]
2016-04-06 3:35 ` [Qemu-devel] [PATCH 2/3] nbd: Avoid bitrot in TRACE() usage Eric Blake
2016-04-06 3:35 ` [Qemu-devel] [PATCH 3/3] nbd: Improve debug traces on little-endian Eric Blake
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=1459913704-19949-2-git-send-email-eblake@redhat.com \
--to=eblake@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@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 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).