[LTP] [PATCH] syscall/fcntl33.c: fix test on FUSE fs

Alexey Kodanev alexey.kodanev@oracle.com
Wed Apr 20 12:55:38 CEST 2016


Hi,
On 19.04.2016 21:01, Cyril Hrubis wrote:
>   
>   static void do_test(int i)
>   {
> -	pid_t cpid;
> +	fd = SAFE_OPEN(cleanup, "file", O_RDONLY);
> +
> +	pid_t cpid = tst_fork();
>   
> -	cpid = tst_fork();
>   	if (cpid < 0)
>   		tst_brkm(TBROK | TERRNO, cleanup, "fork() failed");
>   
> -	if (cpid == 0)
> +	if (cpid == 0) {
> +		SAFE_CLOSE(NULL, fd);
>   		do_child(i);
> -
> -	fd = SAFE_OPEN(cleanup, "file", O_RDONLY);
> +	}
> Looks good.
>
> Another possible solution would be to use checkpoints and wait in the
> child before we call tst_process_state_wait() and wake it up from parent
> just before we call the fcntl(). But that would be more complicated than
> this.

Yes, it would be a more portable alternative instead of waiting for a 
sleep state in a child.

Applied the original patch which has a simpler fix.

Thanks,
Alexey




More information about the ltp mailing list