The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=17b7a0c595a51eaa7e83f16e99e1555bd13a445b

commit 17b7a0c595a51eaa7e83f16e99e1555bd13a445b
Author:     John Baldwin <j...@freebsd.org>
AuthorDate: 2025-01-31 20:13:52 +0000
Commit:     John Baldwin <j...@freebsd.org>
CommitDate: 2025-01-31 20:13:52 +0000

    nvmft: Don't offline a port being removed if it is already offline
    
    This is generally harmless but can trigger spurious warnings on the
    console due to duplicate attempts to disable LUNs.
    
    Sponsored by:   Chelsio Communications
---
 sys/dev/nvmf/controller/ctl_frontend_nvmf.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sys/dev/nvmf/controller/ctl_frontend_nvmf.c 
b/sys/dev/nvmf/controller/ctl_frontend_nvmf.c
index 75b36b4834f5..fcfa8b90ebb7 100644
--- a/sys/dev/nvmf/controller/ctl_frontend_nvmf.c
+++ b/sys/dev/nvmf/controller/ctl_frontend_nvmf.c
@@ -915,7 +915,13 @@ nvmft_port_remove(struct ctl_req *req)
        TAILQ_REMOVE(&nvmft_ports, np, link);
        sx_xunlock(&nvmft_ports_lock);
 
-       ctl_port_offline(&np->port);
+       sx_slock(&np->lock);
+       if (np->online) {
+               sx_sunlock(&np->lock);
+               ctl_port_offline(&np->port);
+       } else
+               sx_sunlock(&np->lock);
+
        nvmft_port_rele(np);
        req->status = CTL_LUN_OK;
 }

Reply via email to