qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu-nbd: return ENOSPC for out-of-range writes
@ 2015-05-08 10:21 Paolo Bonzini
  2015-05-08 12:38 ` Max Reitz
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2015-05-08 10:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, qemu-stable, armbru, mreitz

This ensures that werror=enospc works fine for NBD-backed devices.
Recovery can be done through live snapshots even if the NBD server
does not support online resizing.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 nbd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/nbd.c b/nbd.c
index 57d71b2..a04ba80 100644
--- a/nbd.c
+++ b/nbd.c
@@ -1297,7 +1297,8 @@ static void nbd_trip(void *opaque)
                     request.from, request.len,
                     (uint64_t)exp->size, (uint64_t)exp->dev_offset);
         LOG("requested operation past EOF--bad client?");
-        goto invalid_request;
+        reply.error = (command == NBD_CMD_WRITE) ? ENOSPC : EINVAL;
+        goto error_reply;
     }
 
     switch (command) {
@@ -1390,7 +1391,6 @@ static void nbd_trip(void *opaque)
         break;
     default:
         LOG("invalid request type (%u) received", request.type);
-    invalid_request:
         reply.error = EINVAL;
     error_reply:
         if (nbd_co_send_reply(req, &reply, 0) < 0) {
-- 
2.3.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-08 12:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-08 10:21 [Qemu-devel] [PATCH] qemu-nbd: return ENOSPC for out-of-range writes Paolo Bonzini
2015-05-08 12:38 ` Max Reitz
2015-05-08 12:40   ` Paolo Bonzini

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).