From: Amir Goldstein <amir73il@gmail.com>
To: Linux FS Devel <linux-fsdevel@vger.kernel.org>,
miklos <mszeredi@redhat.com>
Subject: Re: Should FUSE set IO_FLUSHER for the userspace process?
Date: Sun, 18 Sep 2022 15:52:36 +0300 [thread overview]
Message-ID: <CAOQ4uxioquNfdLVZ=JV8ARpN5No29fjD-BQcfk48stODTTwrig@mail.gmail.com> (raw)
In-Reply-To: <87mtaxt05z.fsf@vostro.rath.org>
On Sun, Sep 18, 2022 at 2:12 PM Nikolaus Rath <Nikolaus@rath.org> wrote:
>
> Hi,
>
> Should the FUSE kernel driver perhaps set PR_SET_IO_FLUSHER for the FUSE
> userspace process daemon when a connection is opened?
>
This may have implications.
Not sure it is good to do that unconditionally.
Do you have a reproducer of deadlock?
Note that PR_SET_IO_FLUSHER is set for a thread - not for a process.
> If I understand correctly, this is necessary to avoid a deadlocks if the
> kernel needs to reclaim memory that has to be written back through FUSE.
>
I think the deadlock can happen also when kernel does writeback to FUSE
and then FUSE server ends up trying to do direct reclaim of memory
(not just through FUSE writeback).
In any case, I guess the problem is limited for writeback cache enabled.
> I don't think it's possible to do this in userspace, since the process
> may lack the necessary capabilities.
>
Doing something a bit more subtle would be to write the calling thread
PF_MEMALLOC_NOXX flags in the request and let kernel set the
flags of the thread reading the request, but in libfuse that is not the
worker thread is it?
Need to also check if PF_MEMALLOC_NOFS may also deadlock.
Direct reclaim of inodes can trigger a *lot* of FUSE_FORGET requests
IIRC those requests are one way, but can they block on the request
queue size limit?
Of course it is less common for the forget method to require large
memory allocations, but we cannot assume there is no deadlock
unless we make sure to prevent it.
Thanks,
Amir.
next prev parent reply other threads:[~2022-09-18 12:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-18 11:03 Should FUSE set IO_FLUSHER for the userspace process? Nikolaus Rath
2022-09-18 12:52 ` Amir Goldstein [this message]
2022-09-19 9:20 ` Miklos Szeredi
2022-10-25 15:38 ` Antonio SJ Musumeci
2022-10-26 11:58 ` Miklos Szeredi
2022-10-26 12:17 ` Miklos Szeredi
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='CAOQ4uxioquNfdLVZ=JV8ARpN5No29fjD-BQcfk48stODTTwrig@mail.gmail.com' \
--to=amir73il@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mszeredi@redhat.com \
/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).