Skip to content

Commit

Permalink
vhost-user-blk-test: pass vhost-user socket fds to QSD
Browse files Browse the repository at this point in the history
qemu-storage-daemon is launched with the vhost-user listen socket path.
The path is first unlinked before opening the listen socket. This
prevents stale UNIX domain socket files from stopping socket
initialization.

This behavior is undesirable in vhost-user-blk-test and the cause of a
bug:

There is a race condition in vhost-user-blk-test when QEMU launches
before QSD. It connects to the old socket that QSD unlinks and the
vhost-user connection is never serviced, resulting in a hang.

Pass the listen socket fd to QSD to maintain listen socket continuity
and prevent the lost connection.

Fixes: 8069520 ("test: new qTest case to test the vhost-user-blk-server")
Cc: Raphael Norwitz <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Coiby Xu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
Message-Id: <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
  • Loading branch information
stefanhaRH authored and mstsirkin committed Oct 20, 2021
1 parent 7fe7791 commit 515efff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/qtest/vhost-user-blk-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -906,9 +906,9 @@ static void start_vhost_user_blk(GString *cmd_line, int vus_instances,
img_path = drive_create();
g_string_append_printf(storage_daemon_command,
"--blockdev driver=file,node-name=disk%d,filename=%s "
"--export type=vhost-user-blk,id=disk%d,addr.type=unix,addr.path=%s,"
"--export type=vhost-user-blk,id=disk%d,addr.type=fd,addr.str=%d,"
"node-name=disk%i,writable=on,num-queues=%d ",
i, img_path, i, sock_path, i, num_queues);
i, img_path, i, fd, i, num_queues);

g_string_append_printf(cmd_line, "-chardev socket,id=char%d,path=%s ",
i + 1, sock_path);
Expand Down

0 comments on commit 515efff

Please sign in to comment.