[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 19/41] qemu-nbd: Ignore SIGPIPE
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 19/41] qemu-nbd: Ignore SIGPIPE |
Date: |
Thu, 15 Jun 2017 12:52:39 +0200 |
From: Max Reitz <address@hidden>
qemu proper has done so for 13 years
(8a7ddc38a60648257dc0645ab4a05b33d6040063), qemu-img and qemu-io have
done so for four years (526eda14a68d5b3596be715505289b541288ef2a).
Ignoring this signal is especially important in qemu-nbd because
otherwise a client can easily take down the qemu-nbd server by dropping
the connection when the server wants to send something, for example:
$ qemu-nbd -x foo -f raw -t null-co:// &
[1] 12726
$ qemu-io -c quit nbd://localhost/bar
can't open device nbd://localhost/bar: No export with name 'bar' available
[1] + 12726 broken pipe qemu-nbd -x foo -f raw -t null-co://
In this case, the client sends an NBD_OPT_ABORT and closes the
connection (because it is not required to wait for a reply), but the
server replies with an NBD_REP_ACK (because it is required to reply).
Signed-off-by: Max Reitz <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
qemu-nbd.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 9464a04..4dd3fd4 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -581,6 +581,10 @@ int main(int argc, char **argv)
sa_sigterm.sa_handler = termsig_handler;
sigaction(SIGTERM, &sa_sigterm, NULL);
+#ifdef CONFIG_POSIX
+ signal(SIGPIPE, SIG_IGN);
+#endif
+
module_call_init(MODULE_INIT_TRACE);
qcrypto_init(&error_fatal);
--
1.8.3.1
- [Qemu-devel] [PULL 20/41] accel: split the tcg accelerator from accel.c file, (continued)
- [Qemu-devel] [PULL 20/41] accel: split the tcg accelerator from accel.c file, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 22/41] tcg: move tcg backend files into accel/tcg/, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 17/41] hax-all: make async_safe_run_on_cpu safe on HAX too, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 13/41] megasas: always store SCSIRequest* into MegasasCmd, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 15/41] vl: Fix broken thread=xxx option of the --accel parameter, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 25/41] nbd: make nbd_drop public, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 23/41] accel: move kvm related accelerator files into accel/, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 26/41] nbd/server: get rid of nbd_negotiate_read and friends, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 28/41] nbd/server: refactor nbd_co_send_reply, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 27/41] nbd/server: get rid of ssize_t, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 19/41] qemu-nbd: Ignore SIGPIPE,
Paolo Bonzini <=
- [Qemu-devel] [PULL 29/41] nbd/server: get rid of EAGAIN dead code, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 35/41] nbd/server: refactor nbd_trip, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 10/41] megasas: do not read DCMD opcode more than once from frame, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 11/41] megasas: do not read command more than once from frame, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 05/41] ivshmem: use ram_from_fd(), Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 18/41] nbd: Fix regression on resiliency to port scan, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 07/41] megasas: add qtest, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 24/41] nbd: rename read_sync and friends, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 30/41] nbd/server: refactor nbd_co_receive_request, Paolo Bonzini, 2017/06/15
- [Qemu-devel] [PULL 34/41] nbd/server: rename rc to ret, Paolo Bonzini, 2017/06/15