Re: INFO: task hung in io_queue_file_removal

From: Jens Axboe
Date: Sun Mar 22 2020 - 16:17:50 EST


On 3/21/20 8:06 PM, Hillf Danton wrote:
>
> On Sat, 21 Mar 2020 14:03:24 -0600 Jens Axboe wrote:
>>
>> On 3/21/20 6:38 AM, Hillf Danton wrote:
>>>
>>> Flush work before waiting for completion.
>>>
>>> --- a/fs/io_uring.c
>>> +++ b/fs/io_uring.c
>>> @@ -5823,8 +5823,8 @@ static bool io_queue_file_removal(struct
>>>
>>> if (pfile == &pfile_stack) {
>>> percpu_ref_switch_to_atomic(&data->refs, io_atomic_switch);
>>> - wait_for_completion(&done);
>>> flush_work(&data->ref_work);
>>> + wait_for_completion(&done);
>>> return false;
>>> }
>>>
>>> --
>>>
>>> And perhaps a tiny cleanup: no deed to wait for completion as
>>> flushing work itself will wait until the work is done.
>>
>> Care to send this version as a real patch? Seems kind of pointless to
>> just do the above change with that in mind. And then at the same time
>> turn ->done into ->do_file_put or something, and make it a bool.
>
> Have trouble making a patch with the ideas in your mind all folded in so
> it may be better that you do it this time leaving me a chance to learn
> a lesson.

Maybe my explanation wasn't quite clear! What I meant was that since
we're no longer using pfile->done, turn that ->done into a ->needs_kfree
or something, and make that a bool. So basically the same patch as the
one you posted, just making that naming (and type) change as well.

Does that help? Would prefer if you sent a patch, you already did
99% of the hard work.

--
Jens Axboe