Re: [PATCH] md: Fix unexpected behaviour in is_mddev_idle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 12/1/2021 9:50 PM, Luis Chamberlain wrote:
> On Wed, Dec 01, 2021 at 11:27:12AM +0800, Li Jinlin wrote:
>> diff --git a/drivers/md/md.c b/drivers/md/md.c
>> index 5111ed966947..f47035838c43 100644
>> --- a/drivers/md/md.c
>> +++ b/drivers/md/md.c
>> @@ -8429,14 +8429,14 @@ static int is_mddev_idle(struct mddev *mddev, int init)
>>  {
>>  	struct md_rdev *rdev;
>>  	int idle;
>> -	int curr_events;
>> +	long curr_events;
> 
>>  
>>  	idle = 1;
>>  	rcu_read_lock();
>>  	rdev_for_each_rcu(rdev, mddev) {
>>  		struct gendisk *disk = rdev->bdev->bd_disk;
>> -		curr_events = (int)part_stat_read_accum(disk->part0, sectors) -
>> -			      atomic_read(&disk->sync_io);
>> +		curr_events = (long)part_stat_read_accum(disk->part0, sectors) -
>> +			      atomic64_read(&disk->sync_io);
> 
> And what makes you believe you might not have to go and change all other
> drivers to address this as well? 
The drdb driver also have same problem. I will resend this patch together with
the fix patch of drdb driver.

Thanks,
JinLin


> 
>>  static inline void md_sync_acct_bio(struct bio *bio, unsigned long nr_sectors)
>> diff --git a/include/linux/genhd.h b/include/linux/genhd.h
>> index 74c410263113..efa7884de11b 100644
>> --- a/include/linux/genhd.h
>> +++ b/include/linux/genhd.h
>> @@ -150,7 +150,7 @@ struct gendisk {
>>  	struct list_head slave_bdevs;
>>  #endif
>>  	struct timer_rand_state *random;
>> -	atomic_t sync_io;		/* RAID */
>> +	atomic64_t sync_io;		/* RAID */
>>  	struct disk_events *ev;
>>  #ifdef  CONFIG_BLK_DEV_INTEGRITY
>>  	struct kobject integrity_kobj;
>> -- 
>> 2.31.1
> 
>   Luis
> .
> 



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux