Skip to content

Commit 667a766

Browse files
jsmart-ghmartinkpetersen
authored andcommitted
scsi: lpfc: Fix debugfs root inode "lpfc" not getting deleted on driver unload.
When unloading and reloading the driver, the driver fails to recreate the lpfc root inode in the debugfs tree. The driver is incorrectly removing the lpfc root inode in lpfc_debugfs_terminate in the first driver instance that unloads and then sets the lpfc_debugfs_root global parameter to NULL. When the final driver instance unloads, the debugfs calls quietly ignore the remove on a NULL pointer. The bug is that the debugfs_remove call returns void so the driver doesn't know to correctly set the global parameter to NULL. Base the debugfs_remove of the lpfc_debugfs_root parameter on lpfc_debugfs_hba_count because this parameter tracks the fnX instance tracked per driver instance. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 82820f0 commit 667a766

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/scsi/lpfc/lpfc_debugfs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5866,8 +5866,10 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport)
58665866
atomic_dec(&lpfc_debugfs_hba_count);
58675867
}
58685868

5869-
debugfs_remove(lpfc_debugfs_root); /* lpfc */
5870-
lpfc_debugfs_root = NULL;
5869+
if (atomic_read(&lpfc_debugfs_hba_count) == 0) {
5870+
debugfs_remove(lpfc_debugfs_root); /* lpfc */
5871+
lpfc_debugfs_root = NULL;
5872+
}
58715873
}
58725874
#endif
58735875
return;

0 commit comments

Comments
 (0)