c
// In lpfc_findnode_did
struct lpfc_nodelist *lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did)
{
    struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
    struct lpfc_nodelist *ndlp;
    unsigned long iflags;
    int ref_count;

    // Acquire a reference to prevent deletion during access
    ref_count = atomic_inc_return(&vport->ref_count);

    spin_lock_irqsave(shost->host_lock, iflags);
    ndlp = __lpfc_findnode_did(vport, did);
    spin_unlock_irqrestore(shost->host_lock, iflags);

    // Release the reference
    atomic_dec_return(&vport->ref_count);

    return ndlp;
}

// In lpfc_vport_delete
int lpfc_vport_delete(struct fc_vport *fc_vport)
{
    // ...

    // Check if there are any active references
    if (atomic_read(&vport->ref_count) > 0) {
        // Cannot delete while references are held
        return -EBUSY;
    }

    // Proceed with deletion
    // ...
}
