Commit 47fea27b authored by Yu Kuai's avatar Yu Kuai Committed by Zheng Zengkai
Browse files

block: fix kabi broken in struct hd_struct

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: default avatarYu Kuai <yukuai3@huawei.com>
Reviewed-by: default avatarJason Yan <yanaijie@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 5c250d55
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);
+0 −1
Original line number Diff line number Diff line
@@ -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;
+1 −3
Original line number Diff line number Diff line
@@ -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)