• Guilherme G. Piccoli's avatar
    nvme: Fix cntlid validation when not using NVMEoF · d61a256f
    Guilherme G. Piccoli authored
    [ Upstream commit a89fcca8 ]
    
    Commit 1b1031ca ("nvme: validate cntlid during controller initialisation")
    introduced a validation for controllers with duplicate cntlid that runs
    on nvme_init_subsystem(). The problem is that the validation relies on
    ctrl->cntlid, and this value is assigned (from id_ctrl value) after the
    call for nvme_init_subsystem() in nvme_init_identify() for non-fabrics
    scenario. That leads to ctrl->cntlid always being 0 in case we have a
    physical set of controllers in the same subsystem.
    
    This patch fixes that by loading the discovered cntlid id_ctrl value into
    ctrl->cntlid before the subsystem initialization, only for the non-fabrics
    case. The patch was tested with emulated nvme devices (qemu) having two
    controllers in a single subsystem. Without the patch, we couldn't make
    it work failing in the duplicate check; when running with the patch, we
    could see the subsystem holding both controllers.
    
    For the fabrics case we see ctrl->cntlid has a more intricate relation
    with the admin connect, so we didn't change that.
    
    Fixes: 1b1031ca ("nvme: validate cntlid during controller initialisation")
    Signed-off-by: default avatarGuilherme G. Piccoli <gpiccoli@canonical.com>
    Reviewed-by: Sagi Grimberg's avatarSagi Grimberg <sagi@grimberg.me>
    Signed-off-by: Sagi Grimberg's avatarSagi Grimberg <sagi@grimberg.me>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    d61a256f
Name
Last commit
Last update
Documentation Loading commit data...
LICENSES Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.clang-format Loading commit data...
.cocciconfig Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...