[LTP] [PATCH 2/2] mount_setattr01: add open_tree_attr variant

Andrea Cervesato andrea.cervesato@suse.com
Fri Aug 29 14:06:01 CEST 2025


Hi!

On 8/29/25 1:08 AM, Wei Gao wrote:
>> -	otfd = (int)TST_RET;
>> +	if (tst_variant)
>> +		otfd = open_tree_variant1(attr);
>> +	else
>> +		otfd = open_tree_variant2(attr);
> I am not sure this is perfect way loop the function, add function point into struct tcase
> is better in my opinion.
That's actually an overkill, considering we already have one variable 
deciding what variant we are going to execute. To add a pointer in tcase 
it means to define a type, declare a pointer, initialize it and to use it.
>>   
>> -	TST_EXP_PASS_SILENT(mount_setattr(otfd, "", AT_EMPTY_PATH, &attr, sizeof(attr)),
>> -		"%s set", tc->name);
>> -	if (!TST_PASS)
>> -		goto out1;
>> +	if (otfd == -1)
>> +		goto out2;
>>   
>>   	TST_EXP_PASS_SILENT(move_mount(otfd, "", AT_FDCWD, OT_MNTPOINT, MOVE_MOUNT_F_EMPTY_PATH));
> I suppose we can also check mounts option take effect or not like:
> https://patchwork.ozlabs.org/project/ltp/patch/20250828225157.982-1-wegao@suse.com/

Also this would require a map between mount attrs and strings which are 
going to be converted back again. It would make sense if we were testing 
move_mount, but we already have the attr information via tcase and statvfs.

- Andrea


More information about the ltp mailing list