summaryrefslogtreecommitdiff
path: root/drivers/s390/block/dasd_proc.c
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2015-01-28 20:44:17 +0300
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2015-01-29 11:19:27 +0300
commit8ea55c95c372a7a51fa50cb7c75240bfbe8bd337 (patch)
treea7a496ce7f0f0ae9a417d50acb44fb9fe1229ff9 /drivers/s390/block/dasd_proc.c
parente6d60b368b45b9be3aa068f8e5fa98c3487c9d4e (diff)
downloadlinux-8ea55c95c372a7a51fa50cb7c75240bfbe8bd337.tar.xz
s390/dasd: add locking for global_profile access
Access to DASDs global statistics is done without locking which can lead to inconsistent data. Add locking to fix this. Also move the relevant structs in a global dasd_profile struct. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Reviewed-by: Stefan Haberland <stefan.haberland@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/block/dasd_proc.c')
-rw-r--r--drivers/s390/block/dasd_proc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/s390/block/dasd_proc.c b/drivers/s390/block/dasd_proc.c
index 78ac905a5b7f..76410084c48f 100644
--- a/drivers/s390/block/dasd_proc.c
+++ b/drivers/s390/block/dasd_proc.c
@@ -219,7 +219,8 @@ static int dasd_stats_proc_show(struct seq_file *m, void *v)
"/proc/dasd/statistics'\n");
return 0;
}
- prof = &dasd_global_profile_data;
+ spin_lock_bh(&dasd_global_profile.lock);
+ prof = dasd_global_profile.data;
/* prevent counter 'overflow' on output */
for (factor = 1; (prof->dasd_io_reqs / factor) > 9999999;
@@ -255,6 +256,7 @@ static int dasd_stats_proc_show(struct seq_file *m, void *v)
dasd_statistics_array(m, prof->dasd_io_time3, factor);
seq_printf(m, "# of req in chanq at enqueuing (1..32) \n");
dasd_statistics_array(m, prof->dasd_io_nr_req, factor);
+ spin_unlock_bh(&dasd_global_profile.lock);
#else
seq_printf(m, "Statistics are not activated in this kernel\n");
#endif