All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] iotests: Wait for qemu to end in 223
@ 2019-03-05 18:29 Eric Blake
  2019-03-06 11:05 ` Kevin Wolf
  2019-03-06 13:03 ` Alberto Garcia
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Blake @ 2019-03-05 18:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: berto, qemu-block, Kevin Wolf, Max Reitz

When iotest 223 was first written, it didn't matter if we waited for
the qemu process to clean up. But with the introduction of a later
qemu-nbd process trying to reuse the same file, there is a race where
even though the asynchronous qemu process has responded to "quit", it
has not yet had time to unlock the file and exit, resulting in:

-[{ "start": 0, "length": 65536, "depth": 0, "zero": false, "data": false},
-{ "start": 65536, "length": 2031616, "depth": 0, "zero": false, "data": true},
-{ "start": 2097152, "length": 2097152, "depth": 0, "zero": false, "data": false}]
+qemu-nbd: Failed to blk_new_open 'tests/qemu-iotests/scratch/t.qcow2': Failed to get shared "write" lock
+Is another process using the image [tests/qemu-iotests/scratch/t.qcow2]?
+qemu-img: Could not open 'driver=nbd,server.type=unix,server.path=tests/qemu-iotests/scratch/qemu-nbd.sock,x-dirty-bitmap=qemu:dirty-bitmap:b': Failed to connect socket tests/qemu-iotests/scratch/qemu-nbd.sock: Connection refused
+./common.nbd: line 33: kill: (11122) - No such process

Fixes: ddd09448
Reported-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 tests/qemu-iotests/223     | 1 +
 tests/qemu-iotests/223.out | 1 +
 2 files changed, 2 insertions(+)

diff --git a/tests/qemu-iotests/223 b/tests/qemu-iotests/223
index f120a016460..c0a4f9c14b7 100755
--- a/tests/qemu-iotests/223
+++ b/tests/qemu-iotests/223
@@ -179,6 +179,7 @@ _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-remove",
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-stop"}' "return"
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-stop"}' "error" # Again
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"quit"}' "return"
+wait=yes _cleanup_qemu

 echo
 echo "=== Use qemu-nbd as server ==="
diff --git a/tests/qemu-iotests/223.out b/tests/qemu-iotests/223.out
index 6476b77ba20..95c40a17ad7 100644
--- a/tests/qemu-iotests/223.out
+++ b/tests/qemu-iotests/223.out
@@ -89,6 +89,7 @@ read 2097152/2097152 bytes at offset 2097152
 {"return": {}}
 {"error": {"class": "GenericError", "desc": "NBD server not running"}}
 {"return": {}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}

 === Use qemu-nbd as server ===

-- 
2.20.1

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

* Re: [Qemu-devel] [PATCH] iotests: Wait for qemu to end in 223
  2019-03-05 18:29 [Qemu-devel] [PATCH] iotests: Wait for qemu to end in 223 Eric Blake
@ 2019-03-06 11:05 ` Kevin Wolf
  2019-03-06 13:03 ` Alberto Garcia
  1 sibling, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2019-03-06 11:05 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel, berto, qemu-block, Max Reitz

Am 05.03.2019 um 19:29 hat Eric Blake geschrieben:
> When iotest 223 was first written, it didn't matter if we waited for
> the qemu process to clean up. But with the introduction of a later
> qemu-nbd process trying to reuse the same file, there is a race where
> even though the asynchronous qemu process has responded to "quit", it
> has not yet had time to unlock the file and exit, resulting in:
> 
> -[{ "start": 0, "length": 65536, "depth": 0, "zero": false, "data": false},
> -{ "start": 65536, "length": 2031616, "depth": 0, "zero": false, "data": true},
> -{ "start": 2097152, "length": 2097152, "depth": 0, "zero": false, "data": false}]
> +qemu-nbd: Failed to blk_new_open 'tests/qemu-iotests/scratch/t.qcow2': Failed to get shared "write" lock
> +Is another process using the image [tests/qemu-iotests/scratch/t.qcow2]?
> +qemu-img: Could not open 'driver=nbd,server.type=unix,server.path=tests/qemu-iotests/scratch/qemu-nbd.sock,x-dirty-bitmap=qemu:dirty-bitmap:b': Failed to connect socket tests/qemu-iotests/scratch/qemu-nbd.sock: Connection refused
> +./common.nbd: line 33: kill: (11122) - No such process
> 
> Fixes: ddd09448
> Reported-by: Alberto Garcia <berto@igalia.com>
> Signed-off-by: Eric Blake <eblake@redhat.com>

Makes sense to me. Berto, can you test it?

Kevin

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

* Re: [Qemu-devel] [PATCH] iotests: Wait for qemu to end in 223
  2019-03-05 18:29 [Qemu-devel] [PATCH] iotests: Wait for qemu to end in 223 Eric Blake
  2019-03-06 11:05 ` Kevin Wolf
@ 2019-03-06 13:03 ` Alberto Garcia
  2019-03-06 13:04   ` Eric Blake
  1 sibling, 1 reply; 5+ messages in thread
From: Alberto Garcia @ 2019-03-06 13:03 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: qemu-block, Kevin Wolf, Max Reitz

On Tue 05 Mar 2019 07:29:08 PM CET, Eric Blake wrote:
> When iotest 223 was first written, it didn't matter if we waited for
> the qemu process to clean up. But with the introduction of a later
> qemu-nbd process trying to reuse the same file, there is a race where
> even though the asynchronous qemu process has responded to "quit", it
> has not yet had time to unlock the file and exit, resulting in:
>
> -[{ "start": 0, "length": 65536, "depth": 0, "zero": false, "data": false},
> -{ "start": 65536, "length": 2031616, "depth": 0, "zero": false, "data": true},
> -{ "start": 2097152, "length": 2097152, "depth": 0, "zero": false, "data": false}]
> +qemu-nbd: Failed to blk_new_open 'tests/qemu-iotests/scratch/t.qcow2': Failed to get shared "write" lock
> +Is another process using the image [tests/qemu-iotests/scratch/t.qcow2]?
> +qemu-img: Could not open 'driver=nbd,server.type=unix,server.path=tests/qemu-iotests/scratch/qemu-nbd.sock,x-dirty-bitmap=qemu:dirty-bitmap:b': Failed to connect socket tests/qemu-iotests/scratch/qemu-nbd.sock: Connection refused
> +./common.nbd: line 33: kill: (11122) - No such process
>
> Fixes: ddd09448
> Reported-by: Alberto Garcia <berto@igalia.com>
> Signed-off-by: Eric Blake <eblake@redhat.com>

Tested-by: Alberto Garcia <berto@igalia.com>

Berto

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

* Re: [Qemu-devel] [PATCH] iotests: Wait for qemu to end in 223
  2019-03-06 13:03 ` Alberto Garcia
@ 2019-03-06 13:04   ` Eric Blake
  2019-03-06 14:55     ` Kevin Wolf
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Blake @ 2019-03-06 13:04 UTC (permalink / raw)
  To: Alberto Garcia, qemu-devel; +Cc: qemu-block, Kevin Wolf, Max Reitz

[-- Attachment #1: Type: text/plain, Size: 1559 bytes --]

On 3/6/19 7:03 AM, Alberto Garcia wrote:
> On Tue 05 Mar 2019 07:29:08 PM CET, Eric Blake wrote:
>> When iotest 223 was first written, it didn't matter if we waited for
>> the qemu process to clean up. But with the introduction of a later
>> qemu-nbd process trying to reuse the same file, there is a race where
>> even though the asynchronous qemu process has responded to "quit", it
>> has not yet had time to unlock the file and exit, resulting in:
>>
>> -[{ "start": 0, "length": 65536, "depth": 0, "zero": false, "data": false},
>> -{ "start": 65536, "length": 2031616, "depth": 0, "zero": false, "data": true},
>> -{ "start": 2097152, "length": 2097152, "depth": 0, "zero": false, "data": false}]
>> +qemu-nbd: Failed to blk_new_open 'tests/qemu-iotests/scratch/t.qcow2': Failed to get shared "write" lock
>> +Is another process using the image [tests/qemu-iotests/scratch/t.qcow2]?
>> +qemu-img: Could not open 'driver=nbd,server.type=unix,server.path=tests/qemu-iotests/scratch/qemu-nbd.sock,x-dirty-bitmap=qemu:dirty-bitmap:b': Failed to connect socket tests/qemu-iotests/scratch/qemu-nbd.sock: Connection refused
>> +./common.nbd: line 33: kill: (11122) - No such process
>>
>> Fixes: ddd09448
>> Reported-by: Alberto Garcia <berto@igalia.com>
>> Signed-off-by: Eric Blake <eblake@redhat.com>
> 
> Tested-by: Alberto Garcia <berto@igalia.com>

Thanks; will queue through my NBD tree this week.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [Qemu-devel] [PATCH] iotests: Wait for qemu to end in 223
  2019-03-06 13:04   ` Eric Blake
@ 2019-03-06 14:55     ` Kevin Wolf
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2019-03-06 14:55 UTC (permalink / raw)
  To: Eric Blake; +Cc: Alberto Garcia, qemu-devel, qemu-block, Max Reitz

[-- Attachment #1: Type: text/plain, Size: 1633 bytes --]

Am 06.03.2019 um 14:04 hat Eric Blake geschrieben:
> On 3/6/19 7:03 AM, Alberto Garcia wrote:
> > On Tue 05 Mar 2019 07:29:08 PM CET, Eric Blake wrote:
> >> When iotest 223 was first written, it didn't matter if we waited for
> >> the qemu process to clean up. But with the introduction of a later
> >> qemu-nbd process trying to reuse the same file, there is a race where
> >> even though the asynchronous qemu process has responded to "quit", it
> >> has not yet had time to unlock the file and exit, resulting in:
> >>
> >> -[{ "start": 0, "length": 65536, "depth": 0, "zero": false, "data": false},
> >> -{ "start": 65536, "length": 2031616, "depth": 0, "zero": false, "data": true},
> >> -{ "start": 2097152, "length": 2097152, "depth": 0, "zero": false, "data": false}]
> >> +qemu-nbd: Failed to blk_new_open 'tests/qemu-iotests/scratch/t.qcow2': Failed to get shared "write" lock
> >> +Is another process using the image [tests/qemu-iotests/scratch/t.qcow2]?
> >> +qemu-img: Could not open 'driver=nbd,server.type=unix,server.path=tests/qemu-iotests/scratch/qemu-nbd.sock,x-dirty-bitmap=qemu:dirty-bitmap:b': Failed to connect socket tests/qemu-iotests/scratch/qemu-nbd.sock: Connection refused
> >> +./common.nbd: line 33: kill: (11122) - No such process
> >>
> >> Fixes: ddd09448
> >> Reported-by: Alberto Garcia <berto@igalia.com>
> >> Signed-off-by: Eric Blake <eblake@redhat.com>
> > 
> > Tested-by: Alberto Garcia <berto@igalia.com>
> 
> Thanks; will queue through my NBD tree this week.

Ah, if it doesn't go through my tree, you get my explicit:

Reviewed-by: Kevin Wolf <kwolf@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

end of thread, other threads:[~2019-03-06 14:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-05 18:29 [Qemu-devel] [PATCH] iotests: Wait for qemu to end in 223 Eric Blake
2019-03-06 11:05 ` Kevin Wolf
2019-03-06 13:03 ` Alberto Garcia
2019-03-06 13:04   ` Eric Blake
2019-03-06 14:55     ` Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.