[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 18/19] nbd: fix assert() on qemu-nbd stop
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 18/19] nbd: fix assert() on qemu-nbd stop |
Date: |
Fri, 15 Apr 2016 19:02:21 +0200 |
From: Pavel Butsykin <address@hidden>
>From time to time qemu-nbd is crashing on the following assert:
assert(state == TERMINATING);
nbd_export_closed
nbd_export_put
main
and the state at the moment of the crash is evaluated to TERMINATE.
During shutdown process of the client the nbd_client_thread thread sends
SIGTERM signal and the main thread calls the nbd_client_closed callback.
If the SIGTERM callback will be executed after change the state to
TERMINATING, then the state will once again be TERMINATE.
To solve the issue, we must change the state to TERMINATE only if the state
is RUNNING. In the other case we are shutting down already.
Signed-off-by: Pavel Butsykin <address@hidden>
Signed-off-by: Denis V. Lunev <address@hidden>
CC: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
qemu-nbd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/qemu-nbd.c b/qemu-nbd.c
index b5751f8..2c9754e 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -215,7 +215,7 @@ static int find_partition(BlockBackend *blk, int partition,
static void termsig_handler(int signum)
{
- state = TERMINATE;
+ atomic_cmpxchg(&state, RUNNING, TERMINATE);
qemu_notify_event();
}
--
1.8.3.1
- [Qemu-devel] [PULL 10/19] block: Don't ignore flags in blk_{, co, aio}_write_zeroes(), (continued)
- [Qemu-devel] [PULL 10/19] block: Don't ignore flags in blk_{, co, aio}_write_zeroes(), Kevin Wolf, 2016/04/15
- [Qemu-devel] [PULL 11/19] Fix pflash migration, Kevin Wolf, 2016/04/15
- [Qemu-devel] [PULL 12/19] qemu-iotests: drop unused _within_tolerance() filter, Kevin Wolf, 2016/04/15
- [Qemu-devel] [PULL 13/19] qemu-iotests: common.rc: drop unused _do(), Kevin Wolf, 2016/04/15
- [Qemu-devel] [PULL 09/19] block/vpc: update comments to be compliant w/coding guidelines, Kevin Wolf, 2016/04/15
- [Qemu-devel] [PULL 19/19] nbd: Don't kill server on client that doesn't request TLS, Kevin Wolf, 2016/04/15
- [Qemu-devel] [PULL 16/19] qemu-iotests: 041: More robust assertion on quorum node, Kevin Wolf, 2016/04/15
- [Qemu-devel] [PULL 14/19] qemu-iotests: tests: do not set unused tmp variable, Kevin Wolf, 2016/04/15
- [Qemu-devel] [PULL 15/19] qemu-iotests: place valgrind log file in scratch dir, Kevin Wolf, 2016/04/15
- [Qemu-devel] [PULL 17/19] nbd: Don't fail handshake on NBD_OPT_LIST descriptions, Kevin Wolf, 2016/04/15
- [Qemu-devel] [PULL 18/19] nbd: fix assert() on qemu-nbd stop,
Kevin Wolf <=
- Re: [Qemu-devel] [PULL 00/19] Block layer patches for 2.6.0-rc3, Peter Maydell, 2016/04/18