linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bernd Schubert <bernd.schubert@fastmail.fm>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: Yafang Shao <laoar.shao@gmail.com>,
	miklos@szeredi.hu, linux-fsdevel@vger.kernel.org,
	josef@toxicpanda.com, kernel-team@meta.com
Subject: Re: [PATCH v2 0/2] fuse: add timeout option for requests
Date: Tue, 6 Aug 2024 22:08:34 +0200	[thread overview]
Message-ID: <291bb7de-181b-4338-93ce-2d56a99f717c@fastmail.fm> (raw)
In-Reply-To: <CAJnrk1ah5KP97A6o6kGa+CJE_hwdM1knTfniiwEqsyMGW0A3ew@mail.gmail.com>



On 8/6/24 20:37, Joanne Koong wrote:
> On Tue, Aug 6, 2024 at 11:26 AM Joanne Koong <joannelkoong@gmail.com> wrote:
>>
>> On Tue, Aug 6, 2024 at 10:11 AM Bernd Schubert
>> <bernd.schubert@fastmail.fm> wrote:
>>>
>>> On 8/6/24 18:23, Joanne Koong wrote:
>>>
>>>>>
>>>>> This is very interesting. These logs (and the ones above with the
>>>>> lxcfs server running concurrently) are showing that the read request
>>>>> was freed but not through the do_fuse_request_end path. It's weird
>>>>> that fuse_simple_request reached fuse_put_request without
>>>>> do_fuse_request_end having been called (which is the only place where
>>>>> FR_FINISHED gets set and wakes up the wait events in
>>>>> request_wait_answer).
>>>>>
>>>>> I'll take a deeper look tomorrow and try to make more sense of it.
>>>>
>>>> Finally realized what's happening!
>>>> When we kill the cat program, if the request hasn't been sent out to
>>>> userspace yet when the fatal signal interrupts the
>>>> wait_event_interruptible and wait_event_killable in
>>>> request_wait_answer(), this will clean up the request manually (not
>>>> through the fuse_request_end() path), which doesn't delete the timer.
>>>>
>>>> I'll fix this for v3.
>>>>
>>>> Thank you for surfacing this and it would be much appreciated if you
>>>> could test out v3 when it's submitted to make sure.
>>>
>>> It is still just a suggestion, but if the timer would have its own ref,
>>> any oversight of another fuse_put_request wouldn't be fatal.
>>>
>>
>> Thanks for the suggestion. My main concerns are whether it's worth the
>> extra (minimal?) performance penalty for something that's not strictly
>> needed and whether it ends up adding more of a burden to keep track of
>> the timer ref (eg in error handling like the case above where the
>> fatal signal is for a request that hasn't been sent to userspace yet,
>> having to account for the extra timer ref if the timer callback didn't
>> execute). I don't think adding a timer ref would prevent fatal crashes
>> on fuse_put_request oversights (unless we also mess up not releasing a
>> corresponding timer ref  :))
> 
> I amend this last sentence - I just realized your point about the
> fatal crashes is that if we accidentally miss a fuse_put_request
> altogether, we'd also miss releasing the timer ref in that path, which
> means the timer callback would be the one releasing the last ref.
> 

Yeah, that is what I meant. It is a bit defensive coding, but I don't
have a strong opinion about it.


Thanks,
Bernd

      reply	other threads:[~2024-08-06 20:08 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-30  0:23 [PATCH v2 0/2] fuse: add timeout option for requests Joanne Koong
2024-07-30  0:23 ` [PATCH v2 1/2] fuse: add optional kernel-enforced timeout " Joanne Koong
2024-08-04 22:46   ` Bernd Schubert
2024-08-05  4:45     ` Joanne Koong
2024-08-05 13:05       ` Bernd Schubert
2024-08-05  4:52   ` Joanne Koong
2024-08-05 13:26     ` Bernd Schubert
2024-08-05 22:10       ` Joanne Koong
2024-08-06 15:43         ` Bernd Schubert
2024-08-06 17:08           ` Joanne Koong
2024-08-05  7:32   ` Jingbo Xu
2024-08-05 22:53     ` Joanne Koong
2024-08-06  2:45       ` Jingbo Xu
2024-08-06 16:43         ` Joanne Koong
2024-08-06 15:50       ` Bernd Schubert
2024-07-30  0:23 ` [PATCH v2 2/2] fuse: add default_request_timeout and max_request_timeout sysctls Joanne Koong
2024-07-30  7:49   ` kernel test robot
2024-07-30  9:14   ` kernel test robot
2024-08-05  7:38   ` Jingbo Xu
2024-08-06  1:26     ` Joanne Koong
2024-07-30  5:59 ` [PATCH v2 0/2] fuse: add timeout option for requests Yafang Shao
2024-07-30 18:16   ` Joanne Koong
2024-07-31  2:13     ` Yafang Shao
2024-07-31 17:52       ` Joanne Koong
2024-07-31 18:46         ` Joanne Koong
2024-08-01  2:47           ` Yafang Shao
2024-08-02 19:05             ` Joanne Koong
2024-08-04  7:46               ` Yafang Shao
2024-08-05  5:05                 ` Joanne Koong
2024-08-06 16:23                   ` Joanne Koong
2024-08-06 17:11                     ` Bernd Schubert
2024-08-06 18:26                       ` Joanne Koong
2024-08-06 18:37                         ` Joanne Koong
2024-08-06 20:08                           ` Bernd Schubert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=291bb7de-181b-4338-93ce-2d56a99f717c@fastmail.fm \
    --to=bernd.schubert@fastmail.fm \
    --cc=joannelkoong@gmail.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@meta.com \
    --cc=laoar.shao@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).