qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PULL 15/30] hw/block/nvme: support multiple namespaces


From: Max Reitz
Subject: Re: [PULL 15/30] hw/block/nvme: support multiple namespaces
Date: Wed, 4 Nov 2020 11:06:22 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0

On 27.10.20 11:49, Klaus Jensen wrote:
> From: Klaus Jensen <k.jensen@samsung.com>
> 
> This adds support for multiple namespaces by introducing a new 'nvme-ns'
> device model. The nvme device creates a bus named from the device name
> ('id'). The nvme-ns devices then connect to this and registers
> themselves with the nvme device.
> 
> This changes how an nvme device is created. Example with two namespaces:
> 
>   -drive file=nvme0n1.img,if=none,id=disk1
>   -drive file=nvme0n2.img,if=none,id=disk2
>   -device nvme,serial=deadbeef,id=nvme0
>   -device nvme-ns,drive=disk1,bus=nvme0,nsid=1
>   -device nvme-ns,drive=disk2,bus=nvme0,nsid=2
> 
> The drive property is kept on the nvme device to keep the change
> backward compatible, but the property is now optional. Specifying a
> drive for the nvme device will always create the namespace with nsid 1.
> 
> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
> Reviewed-by: Keith Busch <kbusch@kernel.org>
> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
> ---
>  hw/block/nvme-ns.h    |  74 +++++++++++++
>  hw/block/nvme.h       |  46 ++++----
>  hw/block/nvme-ns.c    | 167 ++++++++++++++++++++++++++++
>  hw/block/nvme.c       | 249 +++++++++++++++++++++++++++---------------
>  hw/block/meson.build  |   2 +-
>  hw/block/trace-events |   6 +-
>  6 files changed, 428 insertions(+), 116 deletions(-)
>  create mode 100644 hw/block/nvme-ns.h
>  create mode 100644 hw/block/nvme-ns.c

Hi,

Coverity reports that nvme_exit() still contains a

    g_free(n->namespaces);

call, which becomes wrong with this commit (because @namespaces is now
an array).

(This leads to qemu crashing when deleting an NVMe device.)

Max




reply via email to

[Prev in Thread] Current Thread [Next in Thread]