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

Richard Palethorpe rpalethorpe@suse.de
Mon Apr 11 11:17:09 CEST 2022


Hello Li,

Li Wang <liwang@redhat.com> writes:

> 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?

I suppose we could save thread A or B's TID and then check it. I think
that should be in a seperate patch.

>
>   
>  > +                       tst_atomic_store(1, &pair->exit);
>  > +                       usleep(100000);
>
>  Why do we need usleep?
>
> Seems not very needed. 

+1

-- 
Thank you,
Richard.


More information about the ltp mailing list