[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] qemu-nbd: return EROFS for discard on a read-only e
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH] qemu-nbd: return EROFS for discard on a read-only export |
Date: |
Thu, 7 May 2015 17:26:13 +0200 |
This is consistent with the handling of writes.
Signed-off-by: Paolo Bonzini <address@hidden>
---
nbd.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/nbd.c b/nbd.c
index cb1b9bb..eea8c51 100644
--- a/nbd.c
+++ b/nbd.c
@@ -1325,6 +1325,12 @@ static void nbd_trip(void *opaque)
break;
case NBD_CMD_TRIM:
TRACE("Request type is TRIM");
+ if (exp->nbdflags & NBD_FLAG_READ_ONLY) {
+ TRACE("Server is read-only, return error");
+ reply.error = EROFS;
+ goto error_reply;
+ }
+
ret = blk_co_discard(exp->blk, (request.from + exp->dev_offset)
/ BDRV_SECTOR_SIZE,
request.len / BDRV_SECTOR_SIZE);
--
2.3.5
- [Qemu-devel] [PATCH] qemu-nbd: return EROFS for discard on a read-only export,
Paolo Bonzini <=
Re: [Qemu-devel] [PATCH] qemu-nbd: only send a limited number of errno codes on the wire, Max Reitz, 2015/05/08