mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 09:33:31 +02:00
scsi: lpfc: Convert debugfs directory counts from atomic to unsigned int
Atomicity is not necessary for debugfs directory accounting because vport deletion and creation is already serialized. Creation has always been serialized through sysfs. Deletion is serialized via walking the lpfc_create_vport_work_array and calling fc_vport_terminate one-by-one for each NPIV port. Reported-by: Al Viro <viro@zeniv.linux.org.uk> Closes: https://lore.kernel.org/linux-fsdevel/20250702212917.GK3406663@ZenIV/ Signed-off-by: Justin Tee <justin.tee@broadcom.com> Message-ID: <20250915180811.137530-13-justintee8345@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
8221b34505
commit
a045ae21ce
|
|
@ -1332,7 +1332,7 @@ struct lpfc_hba {
|
|||
unsigned long last_ramp_down_time;
|
||||
#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
|
||||
struct dentry *hba_debugfs_root;
|
||||
atomic_t debugfs_vport_count;
|
||||
unsigned int debugfs_vport_count;
|
||||
|
||||
struct lpfc_debugfs_nvmeio_trc *nvmeio_trc;
|
||||
atomic_t nvmeio_trc_cnt;
|
||||
|
|
|
|||
|
|
@ -5752,7 +5752,7 @@ static const struct file_operations lpfc_debugfs_op_slow_ring_trc = {
|
|||
};
|
||||
|
||||
static struct dentry *lpfc_debugfs_root = NULL;
|
||||
static atomic_t lpfc_debugfs_hba_count;
|
||||
static unsigned int lpfc_debugfs_hba_count;
|
||||
|
||||
/*
|
||||
* File operations for the iDiag debugfs
|
||||
|
|
@ -6074,7 +6074,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
|
|||
/* Setup lpfc root directory */
|
||||
if (!lpfc_debugfs_root) {
|
||||
lpfc_debugfs_root = debugfs_create_dir("lpfc", NULL);
|
||||
atomic_set(&lpfc_debugfs_hba_count, 0);
|
||||
lpfc_debugfs_hba_count = 0;
|
||||
if (IS_ERR(lpfc_debugfs_root)) {
|
||||
lpfc_vlog_msg(vport, KERN_WARNING, LOG_INIT,
|
||||
"0527 Cannot create debugfs lpfc\n");
|
||||
|
|
@ -6090,13 +6090,13 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
|
|||
pport_setup = true;
|
||||
phba->hba_debugfs_root =
|
||||
debugfs_create_dir(name, lpfc_debugfs_root);
|
||||
atomic_set(&phba->debugfs_vport_count, 0);
|
||||
phba->debugfs_vport_count = 0;
|
||||
if (IS_ERR(phba->hba_debugfs_root)) {
|
||||
lpfc_vlog_msg(vport, KERN_WARNING, LOG_INIT,
|
||||
"0528 Cannot create debugfs %s\n", name);
|
||||
return;
|
||||
}
|
||||
atomic_inc(&lpfc_debugfs_hba_count);
|
||||
lpfc_debugfs_hba_count++;
|
||||
|
||||
/* Multi-XRI pools */
|
||||
debugfs_create_file("multixripools", 0644,
|
||||
|
|
@ -6268,7 +6268,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
|
|||
"0529 Cannot create debugfs %s\n", name);
|
||||
return;
|
||||
}
|
||||
atomic_inc(&phba->debugfs_vport_count);
|
||||
phba->debugfs_vport_count++;
|
||||
}
|
||||
|
||||
if (lpfc_debugfs_max_disc_trc) {
|
||||
|
|
@ -6402,10 +6402,10 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport)
|
|||
if (vport->vport_debugfs_root) {
|
||||
debugfs_remove(vport->vport_debugfs_root); /* vportX */
|
||||
vport->vport_debugfs_root = NULL;
|
||||
atomic_dec(&phba->debugfs_vport_count);
|
||||
phba->debugfs_vport_count--;
|
||||
}
|
||||
|
||||
if (atomic_read(&phba->debugfs_vport_count) == 0) {
|
||||
if (!phba->debugfs_vport_count) {
|
||||
kfree(phba->slow_ring_trc);
|
||||
phba->slow_ring_trc = NULL;
|
||||
|
||||
|
|
@ -6415,10 +6415,10 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport)
|
|||
if (phba->hba_debugfs_root) {
|
||||
debugfs_remove(phba->hba_debugfs_root); /* fnX */
|
||||
phba->hba_debugfs_root = NULL;
|
||||
atomic_dec(&lpfc_debugfs_hba_count);
|
||||
lpfc_debugfs_hba_count--;
|
||||
}
|
||||
|
||||
if (atomic_read(&lpfc_debugfs_hba_count) == 0) {
|
||||
if (!lpfc_debugfs_hba_count) {
|
||||
debugfs_remove(lpfc_debugfs_root); /* lpfc */
|
||||
lpfc_debugfs_root = NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user