]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
scsi: lpfc: Update log message when ndlp kref get is unsuccessful
authorJustin Tee <justin.tee@broadcom.com>
Thu, 12 Feb 2026 21:29:56 +0000 (13:29 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 24 Feb 2026 18:06:50 +0000 (13:06 -0500)
If kref_get_unless_zero on ndlp->kref is unsuccessful, then there's no
point to log kref_read(&ndlp->kref) because it will of course be zero.
In such cases, ndlp->vport would also be an invalid pointer.  Thus, use
pr_info() instead of lpfc_printf_vlog() to log when a kref get is
attempted on an ndlp with a zero kref.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://patch.msgid.link/20260212213008.149873-2-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_hbadisc.c

index 8aaf05d7bb0af40fa99a0dc5d766f44cf0776eeb..e4b32bbfe7511c5530b9d7b565c675ead2a15db1 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term *
+ * Copyright (C) 2017-2026 Broadcom. All Rights Reserved. The term *
  * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.     *
  * Copyright (C) 2004-2016 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
@@ -6599,11 +6599,6 @@ lpfc_nlp_get(struct lpfc_nodelist *ndlp)
        unsigned long flags;
 
        if (ndlp) {
-               lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE,
-                       "node get:        did:x%x flg:x%lx refcnt:x%x",
-                       ndlp->nlp_DID, ndlp->nlp_flag,
-                       kref_read(&ndlp->kref));
-
                /* The check of ndlp usage to prevent incrementing the
                 * ndlp reference count that is in the process of being
                 * released.
@@ -6611,9 +6606,8 @@ lpfc_nlp_get(struct lpfc_nodelist *ndlp)
                spin_lock_irqsave(&ndlp->lock, flags);
                if (!kref_get_unless_zero(&ndlp->kref)) {
                        spin_unlock_irqrestore(&ndlp->lock, flags);
-                       lpfc_printf_vlog(ndlp->vport, KERN_WARNING, LOG_NODE,
-                               "0276 %s: ndlp:x%px refcnt:%d\n",
-                               __func__, (void *)ndlp, kref_read(&ndlp->kref));
+                       pr_info("0276 %s: NDLP x%px has zero reference count. "
+                               "Exiting\n", __func__, ndlp);
                        return NULL;
                }
                spin_unlock_irqrestore(&ndlp->lock, flags);