From: Yu Kuai yukuai3@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I57S8D CVE: NA
--------------------------------
Use reserved fields to fix kabi broken for field 'stat_time'. However, for the field 'bd_stat_lock', spinlock_t can be up to 64 bytes, thus reserved fields is not enough. And struct 'hd_struct' is internal of other sutrct, thus declare a wrapper is infeasible. In order to fix kabi broken for 'bd_stat_lock', use 'dev->mutex' instead.
Signed-off-by: Yu Kuai yukuai3@huawei.com Reviewed-by: Jason Yan yanaijie@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- block/genhd.c | 4 ++-- block/partitions/core.c | 1 - include/linux/genhd.h | 4 +--- 3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/block/genhd.c b/block/genhd.c index 16ad881172d0..cc114dd0265b 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -1312,10 +1312,10 @@ static void part_get_stat_info(struct hd_struct *hd, struct disk_stats *stat,
if (queue_is_mq(q)) { part_stat_lock(); - spin_lock(&hd->bd_stat_lock); + mutex_lock(&part_to_dev(hd)->mutex); part_set_stat_time(hd); *inflight = blk_mq_in_flight_with_stat(q, hd); - spin_unlock(&hd->bd_stat_lock); + mutex_unlock(&part_to_dev(hd)->mutex); part_stat_unlock(); } else { *inflight = part_in_flight(hd); diff --git a/block/partitions/core.c b/block/partitions/core.c index 92c723c19bb0..8f32f3cd0ede 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -416,7 +416,6 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno, p->partno = partno; p->read_only = get_disk_ro(disk) | test_bit(partno, disk->user_ro_bitmap); p->stat_time = 0; - spin_lock_init(&p->bd_stat_lock);
if (info) { struct partition_meta_info *pinfo; diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 07122c79210c..05927a1c6b5b 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -63,8 +63,6 @@ struct hd_struct { seqcount_t nr_sects_seq; #endif unsigned long stamp; - spinlock_t bd_stat_lock; - u64 stat_time; struct disk_stats __percpu *dkstats; struct percpu_ref ref;
@@ -78,7 +76,7 @@ struct hd_struct { #endif struct rcu_work rcu_work;
- KABI_RESERVE(1) + KABI_USE(1, u64 stat_time) KABI_RESERVE(2) KABI_RESERVE(3) KABI_RESERVE(4)