mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
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>
This commit is contained in:
parent
b3f3fdeb95
commit
c0301fcc81
1 changed files with 1 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue