qemu-patch-raspberry4/block
Michal Privoznik 535b8d00c1 nvme: Set number of queues later in nvme_init()
When creating the admin queue in nvme_init() the variable that
holds the number of queues created is modified before actual
queue creation. This is a problem because if creating the queue
fails then the variable is left in inconsistent state. This was
actually observed when I tried to hotplug a nvme disk. The
control got to nvme_file_open() which called nvme_init() which
failed and thus nvme_close() was called which in turn called
nvme_free_queue_pair() with queue being NULL. This lead to an
instant crash:

  #0  0x000055d9507ec211 in nvme_free_queue_pair (bs=0x55d952ddb880, q=0x0) at block/nvme.c:164
  #1  0x000055d9507ee180 in nvme_close (bs=0x55d952ddb880) at block/nvme.c:729
  #2  0x000055d9507ee3d5 in nvme_file_open (bs=0x55d952ddb880, options=0x55d952bb1410, flags=147456, errp=0x7ffd8e19e200) at block/nvme.c:781
  #3  0x000055d9507629f3 in bdrv_open_driver (bs=0x55d952ddb880, drv=0x55d95109c1e0 <bdrv_nvme>, node_name=0x0, options=0x55d952bb1410, open_flags=147456, errp=0x7ffd8e19e310) at block.c:1291
  #4  0x000055d9507633d6 in bdrv_open_common (bs=0x55d952ddb880, file=0x0, options=0x55d952bb1410, errp=0x7ffd8e19e310) at block.c:1551
  #5  0x000055d950766881 in bdrv_open_inherit (filename=0x0, reference=0x0, options=0x55d952bb1410, flags=32768, parent=0x55d9538ce420, child_role=0x55d950eaade0 <child_file>, errp=0x7ffd8e19e510) at block.c:3063
  #6  0x000055d950765ae4 in bdrv_open_child_bs (filename=0x0, options=0x55d9541cdff0, bdref_key=0x55d950af33aa "file", parent=0x55d9538ce420, child_role=0x55d950eaade0 <child_file>, allow_none=true, errp=0x7ffd8e19e510) at block.c:2712
  #7  0x000055d950766633 in bdrv_open_inherit (filename=0x0, reference=0x0, options=0x55d9541cdff0, flags=0, parent=0x0, child_role=0x0, errp=0x7ffd8e19e908) at block.c:3011
  #8  0x000055d950766dba in bdrv_open (filename=0x0, reference=0x0, options=0x55d953d00390, flags=0, errp=0x7ffd8e19e908) at block.c:3156
  #9  0x000055d9507cb635 in blk_new_open (filename=0x0, reference=0x0, options=0x55d953d00390, flags=0, errp=0x7ffd8e19e908) at block/block-backend.c:389
  #10 0x000055d950465ec5 in blockdev_init (file=0x0, bs_opts=0x55d953d00390, errp=0x7ffd8e19e908) at blockdev.c:602

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Message-id: 927aae40b617ba7d4b6c7ffe74e6d7a2595f8e86.1562770546.git.mprivozn@redhat.com
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
(cherry picked from commit 95667c3be0)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2019-10-03 13:41:38 -05:00
..
Makefile.objs configure: adding support to lzfse library. 2018-12-14 11:52:40 +01:00
accounting.c block/accounting: introduce latency histogram 2018-03-19 14:58:37 -05:00
backup.c block/backup: disable copy_range for compressed backup 2019-10-01 16:58:28 -05:00
blkdebug.c block: Advertise BDRV_REQ_NO_FALLBACK in filter drivers 2019-03-26 11:37:51 +01:00
blklogwrites.c block: Purify .bdrv_refresh_filename() 2019-02-25 15:11:27 +01:00
blkreplay.c trivial: Make bios files and source files non-executable 2018-09-25 17:26:18 +02:00
blkverify.c block: Purify .bdrv_refresh_filename() 2019-02-25 15:11:27 +01:00
block-backend.c block: Add bdrv_get_request_alignment() 2019-04-01 08:46:52 -05:00
bochs.c avoid TABs in files that only contain a few 2019-01-11 15:46:56 +01:00
cloop.c block: Require auto-read-only for existing fallbacks 2018-11-05 15:09:55 +01:00
commit.c block: Freeze the backing chain for the duration of the commit job 2019-03-12 20:30:14 +01:00
copy-on-read.c block: Advertise BDRV_REQ_NO_FALLBACK in filter drivers 2019-03-26 11:37:51 +01:00
create.c block/create: Do not abort if a block driver is not available 2019-10-01 16:58:28 -05:00
crypto.c block: Make bdrv_{copy_on_read,crypto_luks,replication} static 2019-03-19 15:49:29 +01:00
crypto.h block/crypto: Simplify block_crypto_{open,create}_opts_init() 2018-06-29 14:20:56 +02:00
curl.c curl: Check curl_multi_add_handle()'s return code 2019-10-01 16:58:28 -05:00
dirty-bitmap.c bitmaps: Fix typo in function name 2019-03-12 12:05:49 -04:00
dmg-bz2.c dmg: Move libbz2 code to dmg-bz2.so 2016-10-07 14:14:06 +02:00
dmg-lzfse.c block: adding lzfse decompressing support as a module. 2018-12-14 11:52:40 +01:00
dmg.c dmg: don't skip zero chunk 2019-01-04 11:15:09 +00:00
dmg.h dmg: including dmg-lzfse module inside dmg block driver. 2018-12-14 11:52:40 +01:00
file-posix.c block/file-posix: Unaligned O_DIRECT block-status 2019-09-17 14:34:13 -05:00
file-win32.c avoid TABs in files that only contain a few 2019-01-11 15:46:56 +01:00
gluster.c block/gluster: limit the transfer size to 512 MiB 2019-04-02 12:04:44 +02:00
io.c block: Add BDRV_REQ_NO_FALLBACK 2019-03-26 11:37:51 +01:00
iscsi-opts.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
iscsi.c block/iscsi: Restrict Linux-specific code 2019-03-11 16:33:49 +01:00
linux-aio.c avoid TABs in files that only contain a few 2019-01-11 15:46:56 +01:00
mirror.c mirror: Only mirror granularity-aligned chunks 2019-10-01 16:58:28 -05:00
nbd-client.c nbd/client: Trace server noncompliance on structured reads 2019-04-01 08:58:04 -05:00
nbd-client.h nbd: Restrict connection_co reentrance 2019-02-25 15:03:19 +01:00
nbd.c nbd/client: Lower min_block for block-status, unaligned size 2019-03-30 20:52:19 -05:00
nfs.c block/nfs: tear down aio before nfs_close 2019-10-01 16:58:28 -05:00
null.c block/null: Generate filename even with latency-ns 2019-02-25 15:11:27 +01:00
nvme.c nvme: Set number of queues later in nvme_init() 2019-10-03 13:41:38 -05:00
parallels.c block/parallels: use QEMU_IOVEC_INIT_BUF 2019-02-22 09:42:13 +00:00
parallels.h Clean up includes 2018-02-09 05:05:11 +01:00
qapi.c qapi: drop x- from x-block-latency-histogram-set 2019-03-12 20:30:08 +01:00
qcow.c Block layer patches: 2019-02-26 19:04:47 +00:00
qcow2-bitmap.c block/qcow2-bitmap: Allow resizes with persistent bitmaps 2019-03-12 14:57:38 -04:00
qcow2-cache.c qcow2: External file I/O 2019-03-08 12:26:46 +01:00
qcow2-cluster.c qcow2: Implement data-file-raw create option 2019-03-08 12:26:46 +01:00
qcow2-refcount.c qcow2: Support external data file in qemu-img check 2019-03-08 12:26:46 +01:00
qcow2-snapshot.c qcow2: Return error for snapshot operation with data file 2019-03-08 12:26:46 +01:00
qcow2.c qcow2: Fix the calculation of the maximum L2 cache size 2019-10-01 16:58:28 -05:00
qcow2.h block/qcow2-bitmap: Allow resizes with persistent bitmaps 2019-03-12 14:57:38 -04:00
qed-check.c block: convert bdrv_check callback to coroutine_fn 2018-03-09 15:17:47 +01:00
qed-cluster.c qed: protect table cache with CoMutex 2017-07-17 11:34:11 +08:00
qed-l2-cache.c qed: protect table cache with CoMutex 2017-07-17 11:34:11 +08:00
qed-table.c block/qed: use qemu_iovec_init_buf 2019-02-22 09:42:13 +00:00
qed.c Block layer patches: 2019-02-26 19:04:47 +00:00
qed.h qed: protect table cache with CoMutex 2017-07-17 11:34:11 +08:00
quorum.c block: Purify .bdrv_refresh_filename() 2019-02-25 15:11:27 +01:00
raw-format.c block: Advertise BDRV_REQ_NO_FALLBACK in filter drivers 2019-03-26 11:37:51 +01:00
rbd.c block: Add strong_runtime_opts to BlockDriver 2019-02-25 15:11:27 +01:00
replication.c block: Make bdrv_{copy_on_read,crypto_luks,replication} static 2019-03-19 15:49:29 +01:00
sheepdog.c block: Add strong_runtime_opts to BlockDriver 2019-02-25 15:11:27 +01:00
snapshot.c block/snapshot: remove bdrv_snapshot_delete_by_id_or_name 2019-02-25 15:03:18 +01:00
ssh.c block: Add strong_runtime_opts to BlockDriver 2019-02-25 15:11:27 +01:00
stream.c block: freeze the backing chain earlier in stream_start() 2019-04-02 12:04:44 +02:00
throttle-groups.c throttle-groups: fix restart coroutine iothread race 2019-01-24 10:02:28 +00:00
throttle.c block: Add strong_runtime_opts to BlockDriver 2019-02-25 15:11:27 +01:00
trace-events nbd/client: Trace server noncompliance on structured reads 2019-04-01 08:58:04 -05:00
vdi.c block: Eliminate the S_1KiB, S_2KiB, ... macros 2019-02-01 13:46:45 +01:00
vhdx-endian.c block/vhdx: Don't take address of fields in packed structs 2018-11-05 15:09:54 +01:00
vhdx-log.c block: Use bdrv_refresh_filename() to pull 2019-02-25 15:11:25 +01:00
vhdx.c block/vhdx: Don't take address of fields in packed structs 2018-11-05 15:09:54 +01:00
vhdx.h qemu/queue.h: leave head structs anonymous unless necessary 2019-01-11 15:46:55 +01:00
vmdk.c vmdk: Support version=3 in VMDK descriptor files 2019-03-19 15:49:29 +01:00
vpc.c vpc: Return 0 from vpc_co_create() on success 2019-10-01 16:58:28 -05:00
vvfat.c block: Add strong_runtime_opts to BlockDriver 2019-02-25 15:11:27 +01:00
vxhs.c block: Add strong_runtime_opts to BlockDriver 2019-02-25 15:11:27 +01:00
win32-aio.c file-win32: Switch to byte-based callbacks 2018-05-15 16:11:41 +02:00
write-threshold.c qapi: Drop qapi_event_send_FOO()'s Error ** argument 2018-08-28 18:21:38 +02:00