Re: [PATCH v3] btrfs: Test proper interaction between skip_balance and paused balance

Nikolay Borisov
2021-11-10T11:18:29Z

On 10.11.21 г. 12:53, Eryu Guan wrote:
> On Wed, Nov 10, 2021 at 12:07:37PM +0200, Nikolay Borisov wrote:
>> <snip>
>>
>>
>>>> +# titled "btrfs: allow device add if balance is paused"
>>>
>>> It is a new feature, not a bug fix? The kernel patch won't backport to
>>> the stable kernels. Then on older kernels, this test has to exit with
>>> _notrun().
>>> Is there any way to achieve this? There isn't any sysfs interface that
>>> will help and, so far we haven't used the kernel version to achieve
>>> something like this.
>>>
>>
>> No, and this is outside the remit of xfstest. Anyone who is running
>> xfstest should ensure incompatible tests are excluded.
>
> I don't think that's the case, we perfer test case detect required env
> to run the test and _notrun if any condition not met. For regression
> test for bug fix, we want the test to fail on old/un-patched kernel, but
> for new features we need a way to tell if the kernel in test has the
> feature or not.

There isn't really an easy way to test for the presence of this feature.
The closest I could think of is modify btrfs' exclusive_operation sysfs
to show "balance paused" and in the test simply run a dummy balance and
pause it and check whether "balance" or "balance paused" is the state of
the exclusive op. However this means for this test to also rely on the
presence of the exclusive_operation sysfs file. However, I don't like
this because adding a device to balance is independent of the
exclusive_operation sysfs i.e it only has an informative role.

>
> Thanks,
> Eryu
>