c
// Add this flag to the appropriate structure
atomic_t shost_valid = ATOMIC_INIT(1);

1 struct lpfc_nodelist *
2 lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did)
3 {
4     struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
5     struct lpfc_nodelist *ndlp = NULL;
6     unsigned long iflags;
7     
8     if (!atomic_read(&shost_valid)) {
9         return NULL;
10     }
11     
12     spin_lock_irqsave(shost->host_lock, iflags);
13     if (atomic_read(&shost_valid)) {
14         ndlp = __lpfc_findnode_did(vport, did);
15     }
16     spin_unlock_irqrestore(shost->host_lock, iflags);
17     
18     return ndlp;
19 }

// In lpfc_vport_delete, set the flag before removing the host
649     atomic_set(&shost_valid, 0);
650     fc_remove_host(shost);
651     scsi_remove_host(shost);
