Re: [PATCH] Btrfs: always copy scrub arguments back to user space

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

 



On 16/01/2020 14:12, David Sterba wrote:
> On Thu, Jan 16, 2020 at 11:29:20AM +0000, fdmanana@xxxxxxxxxx wrote:
>> From: Filipe Manana <fdmanana@xxxxxxxx>
>>
>> If scrub returns an error we are not copying back the scrub arguments
>> structure to user space. This prevents user space to know how much progress
>> scrub has done if an error happened - this includes -ECANCELED which is
>> returned when users ask for scrub to stop. A particular use case, which is
>> used in btrfs-progs, is to resume scrub after it is canceled, in that case
>> it relies on checking the progress from the scrub arguments structure and
>> then use that progress in a call to resume scrub.
>>
>> So fix this by always copying the scrub arguments structure to user space,
>> overwriting the value returned to user space with -EFAULT only if copying
>> the structure failed to let user space know that either that copying did
>> not happen, and therefore the structure is stale, or it happened partially
>> and the structure is probably not valid and corrupt due to the partial
>> copy.
>>
>> Reported-by: Graham Cobb <g.btrfs@xxxxxxxxxxx>
>> Link: https://lore.kernel.org/linux-btrfs/d0a97688-78be-08de-ca7d-bcb4c7fb397e@xxxxxxxxxxx/
>> Fixes: 06fe39ab15a6a4 ("Btrfs: do not overwrite scrub error with fault error in scrub ioctl")
>> Signed-off-by: Filipe Manana <fdmanana@xxxxxxxx>
> 
> Added to 5.5-rc queue, thanks.

Just to let you know... As promised I have built a Debian Testing kernel
(5.3) with this patch applied. My btrfs-scrub-slowly script has now run
successfully to completion with 32 cancel/resume cycles (runs for 30
mins then takes 10 min break).

If it is useful, feel free to add:

Tested-by: Graham Cobb <g.btrfs@xxxxxxxxxxx>

Thanks Felipe!





[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux