[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/7] nbd: treat EPIPE from NBD_DO_IT as success
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 1/7] nbd: treat EPIPE from NBD_DO_IT as success |
Date: |
Fri, 4 Nov 2011 15:51:18 +0100 |
This can be seen with "qemu-nbd -v -c", which returns 1 instead of 0
when you disconnect with "qemu-nbd -d".
Signed-off-by: Paolo Bonzini <address@hidden>
---
I think this is a bug (because there would be no way to exit
qemu-nbd with zero status!), but the patch can be left out safely.
nbd.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/nbd.c b/nbd.c
index fb5e424..e6c931c 100644
--- a/nbd.c
+++ b/nbd.c
@@ -425,6 +425,13 @@ int nbd_client(int fd)
TRACE("Doing NBD loop");
ret = ioctl(fd, NBD_DO_IT);
+ if (ret == -1 && errno == EPIPE) {
+ /* NBD_DO_IT normally returns EPIPE when someone has disconnected
+ * the socket via NBD_DISCONNECT. We do not want to return 1 in
+ * that case.
+ */
+ ret = 0;
+ }
serrno = errno;
TRACE("NBD loop returned %d: %s", ret, strerror(serrno));
--
1.7.6.4
- [Qemu-devel] [PATCH 0/7] reorganize operation of "qemu-nbd -c" and fix it, Paolo Bonzini, 2011/11/04
- [Qemu-devel] [PATCH 1/7] nbd: treat EPIPE from NBD_DO_IT as success,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 3/7] qemu-nbd: rename socket variable, Paolo Bonzini, 2011/11/04
- [Qemu-devel] [PATCH 2/7] qemu-nbd: trap SIGTERM, Paolo Bonzini, 2011/11/04
- [Qemu-devel] [PATCH 5/7] qemu-nbd: print error messages from the daemon through a pipe, Paolo Bonzini, 2011/11/04
- [Qemu-devel] [PATCH 4/7] qemu-nbd: move client to a thread, Paolo Bonzini, 2011/11/04
- [Qemu-devel] [PATCH 7/7] qemu-nbd: open the block device after starting the client thread, Paolo Bonzini, 2011/11/04
- [Qemu-devel] [PATCH 6/7] qemu-nbd: fix socket creation race, Paolo Bonzini, 2011/11/04
- Re: [Qemu-devel] [PATCH 0/7] reorganize operation of "qemu-nbd -c" and fix it, Kevin Wolf, 2011/11/08