summaryrefslogtreecommitdiffstats
path: root/nbd
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-04-05 21:35:02 -0600
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 20:01:35 -0600
commit8c7325cf057346649cecc595c0db856121291a8e (patch)
treea33427a229e03371b6ac482d9fbf51b26d17d827 /nbd
parent2f95ab51138697419baf25ad687c9920a83d91c1 (diff)
downloadhqemu-8c7325cf057346649cecc595c0db856121291a8e.zip
hqemu-8c7325cf057346649cecc595c0db856121291a8e.tar.gz
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>
Diffstat (limited to 'nbd')
-rw-r--r--nbd/server.c1
1 files changed, 1 insertions, 0 deletions
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;
OpenPOWER on IntegriCloud