1 | The following changes since commit 560009f2c8b57b7cdd31a5693ea86ab369382f49: | 1 | The following changes since commit 9c125d17e9402c232c46610802e5931b3639d77b: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2019-10-07 15:40:53 +0100) | 3 | Merge tag 'pull-tcg-20220420' of https://gitlab.com/rth7680/qemu into staging (2022-04-20 16:43:11 -0700) |
4 | 4 | ||
5 | are available in the Git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | https://github.com/stefanha/qemu.git tags/block-pull-request | 7 | https://gitlab.com/stefanha/qemu.git tags/block-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to 4d804b5305ffb4d5fa414c38d4f1bdfb987c8d0b: | 9 | for you to fetch changes up to d45c83328feab2e4083991693160f0a417cfd9b0: |
10 | 10 | ||
11 | iotests/262: Switch source/dest VM launch order (2019-10-08 14:28:25 +0100) | 11 | virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option (2022-04-21 12:05:15 +0200) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Pull request | 14 | Pull request |
15 | 15 | ||
16 | This pull request also contains the two commits from the previous pull request | 16 | Small contrib/vhost-user-blk, contrib/vhost-user-scsi, and tools/virtiofsd |
17 | that was dropped due to a mingw compilation error. The compilation should now | 17 | improvements. |
18 | be fixed. | ||
19 | 18 | ||
20 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
21 | 20 | ||
22 | Max Reitz (2): | 21 | Liu Yiding (1): |
23 | block: Skip COR for inactive nodes | 22 | virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option |
24 | iotests/262: Switch source/dest VM launch order | ||
25 | 23 | ||
26 | Sergio Lopez (1): | 24 | Sakshi Kaushik (1): |
27 | virtio-blk: schedule virtio_notify_config to run on main context | 25 | Implements Backend Program conventions for vhost-user-scsi |
28 | 26 | ||
29 | Vladimir Sementsov-Ogievskiy (1): | 27 | Stefan Hajnoczi (1): |
30 | util/ioc.c: try to reassure Coverity about qemu_iovec_init_extended | 28 | contrib/vhost-user-blk: add missing GOptionEntry NULL terminator |
31 | 29 | ||
32 | block/io.c | 41 +++++++++++++++++++++++++------------- | 30 | docs/tools/virtiofsd.rst | 5 ++ |
33 | hw/block/virtio-blk.c | 16 ++++++++++++++- | 31 | contrib/vhost-user-blk/vhost-user-blk.c | 3 +- |
34 | util/iov.c | 5 +++-- | 32 | contrib/vhost-user-scsi/vhost-user-scsi.c | 77 +++++++++++++++-------- |
35 | tests/qemu-iotests/262 | 12 +++++------ | 33 | tools/virtiofsd/helper.c | 3 + |
36 | tests/qemu-iotests/262.out | 6 +++--- | 34 | 4 files changed, 62 insertions(+), 26 deletions(-) |
37 | 5 files changed, 54 insertions(+), 26 deletions(-) | ||
38 | 35 | ||
39 | -- | 36 | -- |
40 | 2.21.0 | 37 | 2.35.1 |
41 | |||
42 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
2 | 1 | ||
3 | Make it more obvious, that filling qiov corresponds to qiov allocation, | ||
4 | which in turn corresponds to total_niov calculation, based on mid_niov | ||
5 | (not mid_len). Still add an assertion to show that there should be no | ||
6 | difference. | ||
7 | |||
8 | [Added mingw "error: 'mid_iov' may be used uninitialized in this | ||
9 | function" compiler error fix suggested by Vladimir. | ||
10 | --Stefan] | ||
11 | |||
12 | Reported-by: Coverity (CID 1405302) | ||
13 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
14 | Message-id: 20190910090310.14032-1-vsementsov@virtuozzo.com | ||
15 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
17 | Message-Id: <20190910090310.14032-1-vsementsov@virtuozzo.com> | ||
18 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
19 | |||
20 | fixup! util/ioc.c: try to reassure Coverity about qemu_iovec_init_extended | ||
21 | --- | ||
22 | util/iov.c | 5 +++-- | ||
23 | 1 file changed, 3 insertions(+), 2 deletions(-) | ||
24 | |||
25 | diff --git a/util/iov.c b/util/iov.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/util/iov.c | ||
28 | +++ b/util/iov.c | ||
29 | @@ -XXX,XX +XXX,XX @@ void qemu_iovec_init_extended( | ||
30 | { | ||
31 | size_t mid_head, mid_tail; | ||
32 | int total_niov, mid_niov = 0; | ||
33 | - struct iovec *p, *mid_iov; | ||
34 | + struct iovec *p, *mid_iov = NULL; | ||
35 | |||
36 | if (mid_len) { | ||
37 | mid_iov = qiov_slice(mid_qiov, mid_offset, mid_len, | ||
38 | @@ -XXX,XX +XXX,XX @@ void qemu_iovec_init_extended( | ||
39 | p++; | ||
40 | } | ||
41 | |||
42 | - if (mid_len) { | ||
43 | + assert(!mid_niov == !mid_len); | ||
44 | + if (mid_niov) { | ||
45 | memcpy(p, mid_iov, mid_niov * sizeof(*p)); | ||
46 | p[0].iov_base = (uint8_t *)p[0].iov_base + mid_head; | ||
47 | p[0].iov_len -= mid_head; | ||
48 | -- | ||
49 | 2.21.0 | ||
50 | |||
51 | diff view generated by jsdifflib |
1 | From: Max Reitz <mreitz@redhat.com> | 1 | From: Sakshi Kaushik <sakshikaushik717@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | Launching the destination VM before the source VM gives us a regression | 3 | Signed-off-by: Sakshi Kaushik <sakshikaushik717@gmail.com> |
4 | test for HEAD^: | 4 | Message-id: 20220406162410.8536-1-sakshikaushik717@gmail.com |
5 | 5 | ||
6 | The guest device causes a read from the disk image through | 6 | [Name the iSCSI URL long option --iscsi-uri instead of --iscsi_uri for |
7 | guess_disk_lchs(). This will not work if the first sector (containing | 7 | consistency, fix --fd which was rejected due to an outdated |
8 | the partition table) is yet unallocated, we use COR, and the node is | 8 | --socket-path check, and add missing entries[] terminator. |
9 | inactive. | 9 | --Stefan] |
10 | 10 | ||
11 | By launching the source VM before the destination, however, the COR | ||
12 | filter on the source will allocate that area in the image shared between | ||
13 | both VMs, thus the problem will not become apparent. | ||
14 | |||
15 | Switching the launch order causes the sector to still be unallocated | ||
16 | when guess_disk_lchs() runs on the inactive node in the destination VM, | ||
17 | and thus we get our test case. | ||
18 | |||
19 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
20 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
21 | Message-id: 20191001174827.11081-3-mreitz@redhat.com | ||
22 | Message-Id: <20191001174827.11081-3-mreitz@redhat.com> | ||
23 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 11 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
24 | --- | 12 | --- |
25 | tests/qemu-iotests/262 | 12 ++++++------ | 13 | contrib/vhost-user-scsi/vhost-user-scsi.c | 77 +++++++++++++++-------- |
26 | tests/qemu-iotests/262.out | 6 +++--- | 14 | 1 file changed, 52 insertions(+), 25 deletions(-) |
27 | 2 files changed, 9 insertions(+), 9 deletions(-) | ||
28 | 15 | ||
29 | diff --git a/tests/qemu-iotests/262 b/tests/qemu-iotests/262 | 16 | diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c |
30 | index XXXXXXX..XXXXXXX 100755 | 17 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/tests/qemu-iotests/262 | 18 | --- a/contrib/vhost-user-scsi/vhost-user-scsi.c |
32 | +++ b/tests/qemu-iotests/262 | 19 | +++ b/contrib/vhost-user-scsi/vhost-user-scsi.c |
33 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('img') as img_path, \ | 20 | @@ -XXX,XX +XXX,XX @@ fail: |
34 | 21 | ||
35 | os.mkfifo(fifo) | 22 | /** vhost-user-scsi **/ |
36 | 23 | ||
37 | - iotests.log('Launching source VM...') | 24 | +static int opt_fdnum = -1; |
38 | - add_opts(vm_a) | 25 | +static char *opt_socket_path; |
39 | - vm_a.launch() | 26 | +static gboolean opt_print_caps; |
40 | - | 27 | +static char *iscsi_uri; |
41 | - vm_a.enable_migration_events('A') | ||
42 | - | ||
43 | iotests.log('Launching destination VM...') | ||
44 | add_opts(vm_b) | ||
45 | vm_b.add_incoming("exec: cat '%s'" % (fifo)) | ||
46 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('img') as img_path, \ | ||
47 | |||
48 | vm_b.enable_migration_events('B') | ||
49 | |||
50 | + iotests.log('Launching source VM...') | ||
51 | + add_opts(vm_a) | ||
52 | + vm_a.launch() | ||
53 | + | 28 | + |
54 | + vm_a.enable_migration_events('A') | 29 | +static GOptionEntry entries[] = { |
30 | + { "print-capabilities", 'c', 0, G_OPTION_ARG_NONE, &opt_print_caps, | ||
31 | + "Print capabilities", NULL }, | ||
32 | + { "fd", 'f', 0, G_OPTION_ARG_INT, &opt_fdnum, | ||
33 | + "Use inherited fd socket", "FDNUM" }, | ||
34 | + { "iscsi-uri", 'i', 0, G_OPTION_ARG_FILENAME, &iscsi_uri, | ||
35 | + "iSCSI URI to connect to", "FDNUM" }, | ||
36 | + { "socket-path", 's', 0, G_OPTION_ARG_FILENAME, &opt_socket_path, | ||
37 | + "Use UNIX socket path", "PATH" }, | ||
38 | + { NULL, } | ||
39 | +}; | ||
55 | + | 40 | + |
56 | iotests.log('Starting migration to B...') | 41 | int main(int argc, char **argv) |
57 | iotests.log(vm_a.qmp('migrate', uri='exec:cat >%s' % (fifo))) | 42 | { |
58 | with iotests.Timeout(3, 'Migration does not complete'): | 43 | VusDev *vdev_scsi = NULL; |
59 | diff --git a/tests/qemu-iotests/262.out b/tests/qemu-iotests/262.out | 44 | - char *unix_fn = NULL; |
60 | index XXXXXXX..XXXXXXX 100644 | 45 | - char *iscsi_uri = NULL; |
61 | --- a/tests/qemu-iotests/262.out | 46 | - int lsock = -1, csock = -1, opt, err = EXIT_SUCCESS; |
62 | +++ b/tests/qemu-iotests/262.out | 47 | + int lsock = -1, csock = -1, err = EXIT_SUCCESS; |
63 | @@ -XXX,XX +XXX,XX @@ | 48 | |
64 | -Launching source VM... | 49 | - while ((opt = getopt(argc, argv, "u:i:")) != -1) { |
65 | -Enabling migration QMP events on A... | 50 | - switch (opt) { |
66 | -{"return": {}} | 51 | - case 'h': |
67 | Launching destination VM... | 52 | - goto help; |
68 | Enabling migration QMP events on B... | 53 | - case 'u': |
69 | {"return": {}} | 54 | - unix_fn = g_strdup(optarg); |
70 | +Launching source VM... | 55 | - break; |
71 | +Enabling migration QMP events on A... | 56 | - case 'i': |
72 | +{"return": {}} | 57 | - iscsi_uri = g_strdup(optarg); |
73 | Starting migration to B... | 58 | - break; |
74 | {"return": {}} | 59 | - default: |
75 | {"data": {"status": "setup"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} | 60 | - goto help; |
61 | - } | ||
62 | + GError *error = NULL; | ||
63 | + GOptionContext *context; | ||
64 | + | ||
65 | + context = g_option_context_new(NULL); | ||
66 | + g_option_context_add_main_entries(context, entries, NULL); | ||
67 | + if (!g_option_context_parse(context, &argc, &argv, &error)) { | ||
68 | + g_printerr("Option parsing failed: %s\n", error->message); | ||
69 | + exit(EXIT_FAILURE); | ||
70 | + } | ||
71 | + | ||
72 | + if (opt_print_caps) { | ||
73 | + g_print("{\n"); | ||
74 | + g_print(" \"type\": \"scsi\"\n"); | ||
75 | + g_print("}\n"); | ||
76 | + goto out; | ||
77 | } | ||
78 | - if (!unix_fn || !iscsi_uri) { | ||
79 | + | ||
80 | + if (!iscsi_uri) { | ||
81 | goto help; | ||
82 | } | ||
83 | |||
84 | - lsock = unix_sock_new(unix_fn); | ||
85 | - if (lsock < 0) { | ||
86 | - goto err; | ||
87 | + if (opt_socket_path) { | ||
88 | + lsock = unix_sock_new(opt_socket_path); | ||
89 | + if (lsock < 0) { | ||
90 | + exit(EXIT_FAILURE); | ||
91 | + } | ||
92 | + } else if (opt_fdnum < 0) { | ||
93 | + g_print("%s\n", g_option_context_get_help(context, true, NULL)); | ||
94 | + exit(EXIT_FAILURE); | ||
95 | + } else { | ||
96 | + lsock = opt_fdnum; | ||
97 | } | ||
98 | |||
99 | csock = accept(lsock, NULL, NULL); | ||
100 | @@ -XXX,XX +XXX,XX @@ out: | ||
101 | if (vdev_scsi) { | ||
102 | g_main_loop_unref(vdev_scsi->loop); | ||
103 | g_free(vdev_scsi); | ||
104 | - unlink(unix_fn); | ||
105 | + unlink(opt_socket_path); | ||
106 | } | ||
107 | if (csock >= 0) { | ||
108 | close(csock); | ||
109 | @@ -XXX,XX +XXX,XX @@ out: | ||
110 | if (lsock >= 0) { | ||
111 | close(lsock); | ||
112 | } | ||
113 | - g_free(unix_fn); | ||
114 | + g_free(opt_socket_path); | ||
115 | g_free(iscsi_uri); | ||
116 | |||
117 | return err; | ||
118 | @@ -XXX,XX +XXX,XX @@ err: | ||
119 | goto out; | ||
120 | |||
121 | help: | ||
122 | - fprintf(stderr, "Usage: %s [ -u unix_sock_path -i iscsi_uri ] | [ -h ]\n", | ||
123 | + fprintf(stderr, "Usage: %s [ -s socket-path -i iscsi-uri -f fd -p print-capabilities ] | [ -h ]\n", | ||
124 | argv[0]); | ||
125 | - fprintf(stderr, " -u path to unix socket\n"); | ||
126 | - fprintf(stderr, " -i iscsi uri for lun 0\n"); | ||
127 | + fprintf(stderr, " -s, --socket-path=SOCKET_PATH path to unix socket\n"); | ||
128 | + fprintf(stderr, " -i, --iscsi-uri=ISCSI_URI iscsi uri for lun 0\n"); | ||
129 | + fprintf(stderr, " -f, --fd=FILE_DESCRIPTOR file-descriptor\n"); | ||
130 | + fprintf(stderr, " -p, --print-capabilities=PRINT_CAPABILITIES denotes print-capabilities\n"); | ||
131 | fprintf(stderr, " -h print help and quit\n"); | ||
132 | |||
133 | goto err; | ||
76 | -- | 134 | -- |
77 | 2.21.0 | 135 | 2.35.1 |
78 | |||
79 | diff view generated by jsdifflib |
1 | From: Max Reitz <mreitz@redhat.com> | 1 | The GLib documentation says "a NULL-terminated array of GOptionEntrys" |
---|---|---|---|
2 | so we'd better make sure there is a terminator that lets | ||
3 | g_option_context_add_main_entries() know when the end of the array has | ||
4 | been reached. | ||
2 | 5 | ||
3 | We must not write data to inactive nodes, and a COR is certainly | 6 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
4 | something we can simply not do without upsetting anyone. So skip COR | 7 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> |
5 | operations on inactive nodes. | 8 | Message-id: 20220411150057.3009667-1-stefanha@redhat.com |
6 | |||
7 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
8 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
9 | Message-id: 20191001174827.11081-2-mreitz@redhat.com | ||
10 | Message-Id: <20191001174827.11081-2-mreitz@redhat.com> | ||
11 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 9 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
12 | --- | 10 | --- |
13 | block/io.c | 41 +++++++++++++++++++++++++++-------------- | 11 | contrib/vhost-user-blk/vhost-user-blk.c | 3 ++- |
14 | 1 file changed, 27 insertions(+), 14 deletions(-) | 12 | 1 file changed, 2 insertions(+), 1 deletion(-) |
15 | 13 | ||
16 | diff --git a/block/io.c b/block/io.c | 14 | diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c |
17 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/block/io.c | 16 | --- a/contrib/vhost-user-blk/vhost-user-blk.c |
19 | +++ b/block/io.c | 17 | +++ b/contrib/vhost-user-blk/vhost-user-blk.c |
20 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild *child, | 18 | @@ -XXX,XX +XXX,XX @@ static GOptionEntry entries[] = { |
21 | int max_transfer = MIN_NON_ZERO(bs->bl.max_transfer, | 19 | {"blk-file", 'b', 0, G_OPTION_ARG_FILENAME, &opt_blk_file, |
22 | BDRV_REQUEST_MAX_BYTES); | 20 | "block device or file path", "PATH"}, |
23 | unsigned int progress = 0; | 21 | { "read-only", 'r', 0, G_OPTION_ARG_NONE, &opt_read_only, |
24 | + bool skip_write; | 22 | - "Enable read-only", NULL } |
25 | 23 | + "Enable read-only", NULL }, | |
26 | if (!drv) { | 24 | + { NULL, }, |
27 | return -ENOMEDIUM; | 25 | }; |
28 | } | 26 | |
29 | 27 | int main(int argc, char **argv) | |
30 | + /* | ||
31 | + * Do not write anything when the BDS is inactive. That is not | ||
32 | + * allowed, and it would not help. | ||
33 | + */ | ||
34 | + skip_write = (bs->open_flags & BDRV_O_INACTIVE); | ||
35 | + | ||
36 | /* FIXME We cannot require callers to have write permissions when all they | ||
37 | * are doing is a read request. If we did things right, write permissions | ||
38 | * would be obtained anyway, but internally by the copy-on-read code. As | ||
39 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild *child, | ||
40 | while (cluster_bytes) { | ||
41 | int64_t pnum; | ||
42 | |||
43 | - ret = bdrv_is_allocated(bs, cluster_offset, | ||
44 | - MIN(cluster_bytes, max_transfer), &pnum); | ||
45 | - if (ret < 0) { | ||
46 | - /* Safe to treat errors in querying allocation as if | ||
47 | - * unallocated; we'll probably fail again soon on the | ||
48 | - * read, but at least that will set a decent errno. | ||
49 | - */ | ||
50 | + if (skip_write) { | ||
51 | + ret = 1; /* "already allocated", so nothing will be copied */ | ||
52 | pnum = MIN(cluster_bytes, max_transfer); | ||
53 | - } | ||
54 | + } else { | ||
55 | + ret = bdrv_is_allocated(bs, cluster_offset, | ||
56 | + MIN(cluster_bytes, max_transfer), &pnum); | ||
57 | + if (ret < 0) { | ||
58 | + /* | ||
59 | + * Safe to treat errors in querying allocation as if | ||
60 | + * unallocated; we'll probably fail again soon on the | ||
61 | + * read, but at least that will set a decent errno. | ||
62 | + */ | ||
63 | + pnum = MIN(cluster_bytes, max_transfer); | ||
64 | + } | ||
65 | |||
66 | - /* Stop at EOF if the image ends in the middle of the cluster */ | ||
67 | - if (ret == 0 && pnum == 0) { | ||
68 | - assert(progress >= bytes); | ||
69 | - break; | ||
70 | - } | ||
71 | + /* Stop at EOF if the image ends in the middle of the cluster */ | ||
72 | + if (ret == 0 && pnum == 0) { | ||
73 | + assert(progress >= bytes); | ||
74 | + break; | ||
75 | + } | ||
76 | |||
77 | - assert(skip_bytes < pnum); | ||
78 | + assert(skip_bytes < pnum); | ||
79 | + } | ||
80 | |||
81 | if (ret <= 0) { | ||
82 | QEMUIOVector local_qiov; | ||
83 | -- | 28 | -- |
84 | 2.21.0 | 29 | 2.35.1 |
85 | |||
86 | diff view generated by jsdifflib |
1 | From: Sergio Lopez <slp@redhat.com> | 1 | From: Liu Yiding <liuyd.fnst@fujitsu.com> |
---|---|---|---|
2 | 2 | ||
3 | virtio_notify_config() needs to acquire the global mutex, which isn't | 3 | virtiofsd has introduced killpriv_v2/no_killpriv_v2 for a while. Add |
4 | allowed from an iothread, and may lead to a deadlock like this: | 4 | description of it to docs/helper. |
5 | 5 | ||
6 | - main thead | 6 | Signed-off-by: Liu Yiding <liuyd.fnst@fujitsu.com> |
7 | * Has acquired: qemu_global_mutex. | 7 | Message-Id: <20220421095151.2231099-1-liuyd.fnst@fujitsu.com> |
8 | * Is trying the acquire: iothread AioContext lock via | ||
9 | AIO_WAIT_WHILE (after aio_poll). | ||
10 | 8 | ||
11 | - iothread | 9 | [Small documentation fixes: s/as client supports/as the client supports/ |
12 | * Has acquired: AioContext lock. | 10 | and s/. /. /. |
13 | * Is trying to acquire: qemu_global_mutex (via | ||
14 | virtio_notify_config->prepare_mmio_access). | ||
15 | |||
16 | If virtio_blk_resize() is called from an iothread, schedule | ||
17 | virtio_notify_config() to be run in the main context BH. | ||
18 | |||
19 | [Removed unnecessary newline as suggested by Kevin Wolf | ||
20 | <kwolf@redhat.com>. | ||
21 | --Stefan] | 11 | --Stefan] |
22 | 12 | ||
23 | Signed-off-by: Sergio Lopez <slp@redhat.com> | ||
24 | Reviewed-by: Kevin Wolf <kwolf@redhat.com> | ||
25 | Message-id: 20190916112411.21636-1-slp@redhat.com | ||
26 | Message-Id: <20190916112411.21636-1-slp@redhat.com> | ||
27 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 13 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
28 | --- | 14 | --- |
29 | hw/block/virtio-blk.c | 16 +++++++++++++++- | 15 | docs/tools/virtiofsd.rst | 5 +++++ |
30 | 1 file changed, 15 insertions(+), 1 deletion(-) | 16 | tools/virtiofsd/helper.c | 3 +++ |
17 | 2 files changed, 8 insertions(+) | ||
31 | 18 | ||
32 | diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c | 19 | diff --git a/docs/tools/virtiofsd.rst b/docs/tools/virtiofsd.rst |
33 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/hw/block/virtio-blk.c | 21 | --- a/docs/tools/virtiofsd.rst |
35 | +++ b/hw/block/virtio-blk.c | 22 | +++ b/docs/tools/virtiofsd.rst |
36 | @@ -XXX,XX +XXX,XX @@ | 23 | @@ -XXX,XX +XXX,XX @@ Options |
37 | #include "qemu/iov.h" | 24 | label. Server will try to set that label on newly created file |
38 | #include "qemu/module.h" | 25 | atomically wherever possible. |
39 | #include "qemu/error-report.h" | 26 | |
40 | +#include "qemu/main-loop.h" | 27 | + * killpriv_v2|no_killpriv_v2 - |
41 | #include "trace.h" | 28 | + Enable/disable ``FUSE_HANDLE_KILLPRIV_V2`` support. KILLPRIV_V2 is enabled |
42 | #include "hw/block/block.h" | 29 | + by default as long as the client supports it. Enabling this option helps |
43 | #include "hw/qdev-properties.h" | 30 | + with performance in write path. |
44 | @@ -XXX,XX +XXX,XX @@ static int virtio_blk_load_device(VirtIODevice *vdev, QEMUFile *f, | 31 | + |
45 | return 0; | 32 | .. option:: --socket-path=PATH |
33 | |||
34 | Listen on vhost-user UNIX domain socket at PATH. | ||
35 | diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/tools/virtiofsd/helper.c | ||
38 | +++ b/tools/virtiofsd/helper.c | ||
39 | @@ -XXX,XX +XXX,XX @@ void fuse_cmdline_help(void) | ||
40 | " -o announce_submounts Announce sub-mount points to the guest\n" | ||
41 | " -o posix_acl/no_posix_acl Enable/Disable posix_acl. (default: disabled)\n" | ||
42 | " -o security_label/no_security_label Enable/Disable security label. (default: disabled)\n" | ||
43 | + " -o killpriv_v2/no_killpriv_v2\n" | ||
44 | + " Enable/Disable FUSE_HANDLE_KILLPRIV_V2.\n" | ||
45 | + " (default: enabled as long as client supports it)\n" | ||
46 | ); | ||
46 | } | 47 | } |
47 | 48 | ||
48 | +static void virtio_resize_cb(void *opaque) | ||
49 | +{ | ||
50 | + VirtIODevice *vdev = opaque; | ||
51 | + | ||
52 | + assert(qemu_get_current_aio_context() == qemu_get_aio_context()); | ||
53 | + virtio_notify_config(vdev); | ||
54 | +} | ||
55 | + | ||
56 | static void virtio_blk_resize(void *opaque) | ||
57 | { | ||
58 | VirtIODevice *vdev = VIRTIO_DEVICE(opaque); | ||
59 | |||
60 | - virtio_notify_config(vdev); | ||
61 | + /* | ||
62 | + * virtio_notify_config() needs to acquire the global mutex, | ||
63 | + * so it can't be called from an iothread. Instead, schedule | ||
64 | + * it to be run in the main context BH. | ||
65 | + */ | ||
66 | + aio_bh_schedule_oneshot(qemu_get_aio_context(), virtio_resize_cb, vdev); | ||
67 | } | ||
68 | |||
69 | static const BlockDevOps virtio_block_ops = { | ||
70 | -- | 49 | -- |
71 | 2.21.0 | 50 | 2.35.1 |
72 | |||
73 | diff view generated by jsdifflib |