[LTP] [PATCH 3/3] quotactl06: Fix TESTDIR1 cleanup if setup() exits early

xuyang2018.jy@fujitsu.com xuyang2018.jy@fujitsu.com
Fri Mar 4 11:00:33 CET 2022


Hi Martin
> On 04. 03. 22 2:38, xuyang2018.jy@fujitsu.com wrote:
>> Hi Martin
>>> When setup() exits with TCONF before TESTDIR1 gets created, cleanup() will
>>> trigger TWARN when it tries to delete it. Check whether the directory exists
>>> before calling SAFE_RMDIR().
>>>
>>> Signed-off-by: Martin Doucha<mdoucha@suse.cz>
>>> ---
>>>    testcases/kernel/syscalls/quotactl/quotactl06.c | 4 +++-
>>>    1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/testcases/kernel/syscalls/quotactl/quotactl06.c b/testcases/kernel/syscalls/quotactl/quotactl06.c
>>> index 8e9a17393..d470486d5 100644
>>> --- a/testcases/kernel/syscalls/quotactl/quotactl06.c
>>> +++ b/testcases/kernel/syscalls/quotactl/quotactl06.c
>>> @@ -207,7 +207,9 @@ static void setup(void)
>>>    static void cleanup(void)
>>>    {
>>>    	SAFE_UNLINK(USRPATH);
>> It seems we also should check USRPATH whether existed.
>
> If I understand correctly, the file will be created by mount(), even
> before setup() gets executed. So if the file doesn't exist during
> cleanup(), the error will be valid.
The USRPATH file is generated by quotacheck command.

Best Regards
Yang Xu
>


More information about the ltp mailing list