Re: disk revalidation updates and OOM

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

 




On 3/17/20 8:42 PM, Christoph Hellwig wrote:
> On Tue, Mar 17, 2020 at 04:50:11PM +0800, He Zhe wrote:
>>>> With my build fix applied, the issue is triggered since 142fe8f.
>>>> And I can see the endless loop of invalidate and revalidate...
>>> Thanks.  Can you test the patch below that restores the previous
>>> rather odd behavior of not clearing the capacity to 0 if partition
>>> scanning is not enabled?
>> This fixes the issue. I also validated it on v5.6-rc6.
> Can you check this slight variant that only skips the capacity
> change for removable devices given that IIRC you reported the problem
> with a legacy ide-cd device?

Tested. This also works.

Zhe

>
>
> diff --git a/fs/block_dev.c b/fs/block_dev.c
> index 69bf2fb6f7cd..3212ac85d493 100644
> --- a/fs/block_dev.c
> +++ b/fs/block_dev.c
> @@ -1520,10 +1520,14 @@ int bdev_disk_changed(struct block_device *bdev, bool invalidate)
>  	if (ret)
>  		return ret;
>  
> -	if (invalidate)
> -		set_capacity(disk, 0);
> -	else if (disk->fops->revalidate_disk)
> -		disk->fops->revalidate_disk(disk);
> +	if (invalidate) {
> +		if (!(disk->flags & GENHD_FL_REMOVABLE) ||
> +		    disk_part_scan_enabled(disk))
> +			set_capacity(disk, 0);
> +	} else {
> +		if (disk->fops->revalidate_disk)
> +			disk->fops->revalidate_disk(disk);
> +	}
>  
>  	check_disk_size_change(disk, bdev, !invalidate);
>  




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux