]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
nvmet-loop: do not alloc admin tag set during reset
authorMaurizio Lombardi <mlombard@redhat.com>
Thu, 14 May 2026 08:32:54 +0000 (10:32 +0200)
committerKeith Busch <kbusch@kernel.org>
Wed, 20 May 2026 18:45:44 +0000 (11:45 -0700)
commit233bbeb4a47cbead8c0471c0b8daec141033eae4
treee87c4db9955b1bbd5975726fb6ba8e663452de8a
parentf702badaf7d31dc3dea6c66da92b5f35fadd89dc
nvmet-loop: do not alloc admin tag set during reset

Currently, resetting a loopback controller unconditionally invokes
nvme_alloc_admin_tag_set() inside nvme_loop_configure_admin_queue().
Doing so drops the old queue and allocates a new one. Consequently,
this reverts the admin queue's timeout (q->rq_timeout) back to the
module default (NVME_ADMIN_TIMEOUT), completely wiping out any custom
timeout values the user may have configured via sysfs and potentially
racing against the sysfs nvme_admin_timeout_store() function
that may dereference the admin_q pointer during the RESETTING state.

Decouple the admin tag set lifecycle from the admin queue
configuration and destruction paths, which are executed during resets;
Specifically:

* Move nvme_alloc_admin_tag_set() into nvme_loop_create_ctrl() so it
  is only allocated once during the initial controller creation.

* Defer the destruction of the admin tag set to
  nvme_loop_delete_ctrl_host() and the terminal error-handling
  paths of nvme_loop_reset_ctrl_work() and
  nvme_loop_create_ctrl().

Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@kernel.org>
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/target/loop.c