On 15/01/2020 09:33, Filipe Manana wrote:
> On Wed, Jan 15, 2020 at 9:04 AM Graham Cobb <g.btrfs@xxxxxxxxxxx> wrote:
>>
>> OK, I have bisected the problem with scrub resume being broken by the
>> scrub ioctl ABI being changed.
[snip]
>
> Try this:
>
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index 3a4bd5cd67fa..611dfe8cdbb1 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -4253,8 +4253,10 @@ static long btrfs_ioctl_scrub(struct file
> *file, void __user *arg)
> &sa->progress, sa->flags & BTRFS_SCRUB_READONLY,
> 0);
>
> - if (ret == 0 && copy_to_user(arg, sa, sizeof(*sa)))
> - ret = -EFAULT;
> + if (copy_to_user(arg, sa, sizeof(*sa))) {
> + if (!ret)
> + ret = -EFAULT;
> + }
>
> if (!(sa->flags & BTRFS_SCRUB_READONLY))
> mnt_drop_write_file(file);
>
> I'll later send a patch with a changelog to the list.
> Thanks.
Thanks Filipe. I have tested that the patch builds and works with my
reproducer on a 5.4 kernel.
Later I will build a distro kernel with the patch and try my monthly
scrub-with-interruptions script. That will take a day or two.