[LTP] [PATCH v1] fzsync: break inf loop with flag vs pthread_cancel

Li Wang liwang@redhat.com
Mon Apr 11 11:01:41 CEST 2022


Hi Richard, Edward,

On Mon, Apr 11, 2022 at 4:33 PM Richard Palethorpe <rpalethorpe@suse.de>
wrote:


> > Looking at tst_fzsync_run_a, if anything goes wrong in other places
> > (thread_b) and break with setting 'pair->exit' to 1 to end the looping.
> > It doesn't work for thread_a because tst_atomic_store(exit, &pair->exit)
> > will reset it back to 0 (int exit = 0).
>
> I don't think we have ever handled thread B breaking gracefully?
>

Right, that exist before Edward's patch :).



>
> If B breaks and it calls tst_fzsync_pair_cleanup then it will try to
> join to itself and we will probably get EDEADLK.
>

Exactly, maybe do something to make tst_fzsync_pair_cleanup
avoid joining to itself when the invoke come from B?



> > +                       tst_atomic_store(1, &pair->exit);
> > +                       usleep(100000);
>
> Why do we need usleep?
>

Seems not very needed.


-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20220411/2a9b0a8c/attachment.htm>


More information about the ltp mailing list