aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc.h1
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_fcoe.c10
2 files changed, 9 insertions, 2 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h
index 4fc8ed5fe067..1f424e40afdf 100644
--- a/drivers/scsi/bnx2fc/bnx2fc.h
+++ b/drivers/scsi/bnx2fc/bnx2fc.h
@@ -191,6 +191,7 @@ struct bnx2fc_hba {
191 struct bnx2fc_cmd_mgr *cmd_mgr; 191 struct bnx2fc_cmd_mgr *cmd_mgr;
192 spinlock_t hba_lock; 192 spinlock_t hba_lock;
193 struct mutex hba_mutex; 193 struct mutex hba_mutex;
194 struct mutex hba_stats_mutex;
194 unsigned long adapter_state; 195 unsigned long adapter_state;
195 #define ADAPTER_STATE_UP 0 196 #define ADAPTER_STATE_UP 0
196 #define ADAPTER_STATE_GOING_DOWN 1 197 #define ADAPTER_STATE_GOING_DOWN 1
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 93b5a0012417..902722dc4ce3 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -663,15 +663,17 @@ static struct fc_host_statistics *bnx2fc_get_host_stats(struct Scsi_Host *shost)
663 if (!fw_stats) 663 if (!fw_stats)
664 return NULL; 664 return NULL;
665 665
666 mutex_lock(&hba->hba_stats_mutex);
667
666 bnx2fc_stats = fc_get_host_stats(shost); 668 bnx2fc_stats = fc_get_host_stats(shost);
667 669
668 init_completion(&hba->stat_req_done); 670 init_completion(&hba->stat_req_done);
669 if (bnx2fc_send_stat_req(hba)) 671 if (bnx2fc_send_stat_req(hba))
670 return bnx2fc_stats; 672 goto unlock_stats_mutex;
671 rc = wait_for_completion_timeout(&hba->stat_req_done, (2 * HZ)); 673 rc = wait_for_completion_timeout(&hba->stat_req_done, (2 * HZ));
672 if (!rc) { 674 if (!rc) {
673 BNX2FC_HBA_DBG(lport, "FW stat req timed out\n"); 675 BNX2FC_HBA_DBG(lport, "FW stat req timed out\n");
674 return bnx2fc_stats; 676 goto unlock_stats_mutex;
675 } 677 }
676 BNX2FC_STATS(hba, rx_stat2, fc_crc_cnt); 678 BNX2FC_STATS(hba, rx_stat2, fc_crc_cnt);
677 bnx2fc_stats->invalid_crc_count += hba->bfw_stats.fc_crc_cnt; 679 bnx2fc_stats->invalid_crc_count += hba->bfw_stats.fc_crc_cnt;
@@ -693,6 +695,9 @@ static struct fc_host_statistics *bnx2fc_get_host_stats(struct Scsi_Host *shost)
693 695
694 memcpy(&hba->prev_stats, hba->stats_buffer, 696 memcpy(&hba->prev_stats, hba->stats_buffer,
695 sizeof(struct fcoe_statistics_params)); 697 sizeof(struct fcoe_statistics_params));
698
699unlock_stats_mutex:
700 mutex_unlock(&hba->hba_stats_mutex);
696 return bnx2fc_stats; 701 return bnx2fc_stats;
697} 702}
698 703
@@ -1340,6 +1345,7 @@ static struct bnx2fc_hba *bnx2fc_hba_create(struct cnic_dev *cnic)
1340 } 1345 }
1341 spin_lock_init(&hba->hba_lock); 1346 spin_lock_init(&hba->hba_lock);
1342 mutex_init(&hba->hba_mutex); 1347 mutex_init(&hba->hba_mutex);
1348 mutex_init(&hba->hba_stats_mutex);
1343 1349
1344 hba->cnic = cnic; 1350 hba->cnic = cnic;
1345 1351