]>
Commit | Line | Data |
---|---|---|
8a38e1da TL |
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
2 | From: Emanuele Giuseppe Esposito <eesposit@redhat.com> | |
3 | Date: Thu, 27 Oct 2022 03:27:26 -0400 | |
4 | Subject: [PATCH] block/block-backend: blk_set_enable_write_cache is IO_CODE | |
5 | ||
6 | blk_set_enable_write_cache() is defined as GLOBAL_STATE_CODE | |
7 | but can be invoked from iothreads when handling scsi requests. | |
8 | This triggers an assertion failure: | |
9 | ||
10 | 0x00007fd6c3515ce1 in raise () from /lib/x86_64-linux-gnu/libc.so.6 | |
11 | 0x00007fd6c34ff537 in abort () from /lib/x86_64-linux-gnu/libc.so.6 | |
12 | 0x00007fd6c34ff40f in ?? () from /lib/x86_64-linux-gnu/libc.so.6 | |
13 | 0x00007fd6c350e662 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6 | |
14 | 0x000056149e2cea03 in blk_set_enable_write_cache (wce=true, blk=0x5614a01c27f0) | |
15 | at ../src/block/block-backend.c:1949 | |
16 | 0x000056149e2d0a67 in blk_set_enable_write_cache (blk=0x5614a01c27f0, | |
17 | wce=<optimized out>) at ../src/block/block-backend.c:1951 | |
18 | 0x000056149dfe9c59 in scsi_disk_apply_mode_select (p=0x7fd6b400c00e "\004", | |
19 | page=<optimized out>, s=<optimized out>) at ../src/hw/scsi/scsi-disk.c:1520 | |
20 | mode_select_pages (change=true, len=18, p=0x7fd6b400c00e "\004", r=0x7fd6b4001ff0) | |
21 | at ../src/hw/scsi/scsi-disk.c:1570 | |
22 | scsi_disk_emulate_mode_select (inbuf=<optimized out>, r=0x7fd6b4001ff0) at | |
23 | ../src/hw/scsi/scsi-disk.c:1640 | |
24 | scsi_disk_emulate_write_data (req=0x7fd6b4001ff0) at ../src/hw/scsi/scsi-disk.c:1934 | |
25 | 0x000056149e18ff16 in virtio_scsi_handle_cmd_req_submit (req=<optimized out>, | |
26 | req=<optimized out>, s=0x5614a12f16b0) at ../src/hw/scsi/virtio-scsi.c:719 | |
27 | virtio_scsi_handle_cmd_vq (vq=0x7fd6bab92140, s=0x5614a12f16b0) at | |
28 | ../src/hw/scsi/virtio-scsi.c:761 | |
29 | virtio_scsi_handle_cmd (vq=<optimized out>, vdev=<optimized out>) at | |
30 | ../src/hw/scsi/virtio-scsi.c:775 | |
31 | virtio_scsi_handle_cmd (vdev=0x5614a12f16b0, vq=0x7fd6bab92140) at | |
32 | ../src/hw/scsi/virtio-scsi.c:765 | |
33 | 0x000056149e1a8aa6 in virtio_queue_notify_vq (vq=0x7fd6bab92140) at | |
34 | ../src/hw/virtio/virtio.c:2365 | |
35 | 0x000056149e3ccea5 in aio_dispatch_handler (ctx=ctx@entry=0x5614a01babe0, | |
36 | node=<optimized out>) at ../src/util/aio-posix.c:369 | |
37 | 0x000056149e3cd868 in aio_dispatch_ready_handlers (ready_list=0x7fd6c09b2680, | |
38 | ctx=0x5614a01babe0) at ../src/util/aio-posix.c:399 | |
39 | aio_poll (ctx=0x5614a01babe0, blocking=blocking@entry=true) at | |
40 | ../src/util/aio-posix.c:713 | |
41 | 0x000056149e2a7796 in iothread_run (opaque=opaque@entry=0x56149ffde500) at | |
42 | ../src/iothread.c:67 | |
43 | 0x000056149e3d0859 in qemu_thread_start (args=0x7fd6c09b26f0) at | |
44 | ../src/util/qemu-thread-posix.c:504 | |
45 | 0x00007fd6c36b9ea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0 | |
46 | 0x00007fd6c35d9aef in clone () from /lib/x86_64-linux-gnu/libc.so.6 | |
47 | ||
48 | Changing GLOBAL_STATE_CODE in IO_CODE is allowed, since GSC callers are | |
49 | allowed to call IO_CODE. | |
50 | ||
51 | Resolves: #1272 | |
52 | ||
53 | Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> | |
54 | Message-Id: <20221027072726.2681500-1-eesposit@redhat.com> | |
55 | Reviewed-by: Kevin Wolf <kwolf@redhat.com> | |
56 | Reviewed-by: Hanna Reitz <hreitz@redhat.com> | |
57 | Tested-by: Antoine Damhet <antoine.damhet@shadow.tech> | |
58 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | |
59 | (cherry picked from commit be8da05b5ed8fb546731b9edb997f303f272bad8) | |
60 | Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> | |
61 | --- | |
62 | block/block-backend.c | 2 +- | |
63 | 1 file changed, 1 insertion(+), 1 deletion(-) | |
64 | ||
65 | diff --git a/block/block-backend.c b/block/block-backend.c | |
66 | index d4a5df2ac2..1b563e628b 100644 | |
67 | --- a/block/block-backend.c | |
68 | +++ b/block/block-backend.c | |
69 | @@ -1946,7 +1946,7 @@ bool blk_enable_write_cache(BlockBackend *blk) | |
70 | ||
71 | void blk_set_enable_write_cache(BlockBackend *blk, bool wce) | |
72 | { | |
73 | - GLOBAL_STATE_CODE(); | |
74 | + IO_CODE(); | |
75 | blk->enable_write_cache = wce; | |
76 | } | |
77 |