From: Krister Johansen <kjlx@templeofstupid.com>
To: Miklos Szeredi <miklos@szeredi.hu>, linux-fsdevel@vger.kernel.org
Cc: Miklos Szeredi <mszeredi@redhat.com>,
linux-kernel@vger.kernel.org,
German Maglione <gmaglione@redhat.com>,
Greg Kurz <groug@kaod.org>, Max Reitz <mreitz@redhat.com>,
Bernd Schubert <bernd.schubert@fastmail.fm>
Subject: [resend PATCH v2 0/2] virtiofs submounts that are still in use forgotten by shrinker
Date: Mon, 2 Oct 2023 08:24:29 -0700 [thread overview]
Message-ID: <cover.1696043833.git.kjlx@templeofstupid.com> (raw)
Hi,
I recently ran into a situation where a virtiofs client began
encountering EBADF after the client / guest system had an OOM. After
reproducing the issue and debugging, the problem is caused by a
virtiofsd submount having the nodeid of its root dentry fogotten. This
occurs because it borrows the reference for this dentry from the parent
that is passed into the function.
In this particular case, the submount had been bind mounted into a
container's mount namespace. The reference count on the original parent
dentry was 0, making it eligible for eviction. However, because this
dentry was also the last reference the fuse client knew it had, it sent
a forget message to the server. This caused all future references to
the FUSE node-id from virtiofsd perspective to become invalid.
Subsequent attempts to use the node-id for operations against the
submount's root received an EBADF from the server.
This pair of patches modifies the virtiofs submount code to perform a
lookup on the nodeid that forms the root of the submount. The patch
before this pulls the revalidate lookup code into a helper function that
can be used both in revalidate and submount superblock fill.
Tested via:
- fstests for virtiofs
- fstests for fuse (against passthrough_ll)
- manual testing to watch how refcounts change between client and server
in response to filesytem access, umount, and eviction by the shrinker.
This resend has rebased against the latest tip of fuse/for-next and
massaged the commit messages in the patches, but hasn't made any
functional modifications since the original v2.
There's also been an issue opened with the project that uses this
functionality. More details on that can be found at [1].
Changes since v1:
- Cleanups to pacify test robot
Changes since RFC:
- Modified fuse_fill_super_submount to always fail if dentry cannot be
revalidated. (Feedback from Bernd Schubert)
- Fixed up an edge case where looked up but subsequently declared
invalid dentries were not correctly tracking nlookup. (Error was
introduced in my RFC).
Thanks,
-K
[1] https://github.com/kata-containers/kata-containers/issues/8040
Krister Johansen (2):
fuse: revalidate: move lookup into a separate function
fuse: ensure that submounts lookup their parent
fs/fuse/dir.c | 85 +++++++++++++++++++++++++++++++++---------------
fs/fuse/fuse_i.h | 6 ++++
fs/fuse/inode.c | 43 ++++++++++++++++++++----
3 files changed, 101 insertions(+), 33 deletions(-)
--
2.25.1
next reply other threads:[~2023-10-02 15:24 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-02 15:24 Krister Johansen [this message]
2023-10-02 15:24 ` [resend PATCH v2 1/2] fuse: revalidate: move lookup into a separate function Krister Johansen
2023-10-02 15:24 ` [resend PATCH v2 2/2] fuse: ensure that submounts lookup their parent Krister Johansen
2023-10-06 17:13 ` Bernd Schubert
2023-10-07 0:41 ` Krister Johansen
2023-10-09 12:52 ` Bernd Schubert
2023-10-09 17:15 ` Krister Johansen
2023-10-09 18:43 ` Bernd Schubert
2023-10-10 2:35 ` Krister Johansen
2023-10-09 19:45 ` Miklos Szeredi
2023-10-10 2:35 ` Krister Johansen
2023-10-10 8:15 ` Miklos Szeredi
2023-10-11 1:25 ` Krister Johansen
2023-10-11 7:07 ` Miklos Szeredi
2023-10-11 16:32 ` Krister Johansen
2023-10-11 18:27 ` Miklos Szeredi
2023-10-18 1:33 ` Krister Johansen
2023-10-18 1:33 ` [PATCH v3] fuse: share lookup state between submount and its parent Krister Johansen
2023-10-19 12:39 ` Miklos Szeredi
2023-10-20 21:33 ` Krister Johansen
2023-10-20 21:34 ` [PATCH v4] " Krister Johansen
2023-10-02 22:18 ` [resend PATCH v2 0/2] virtiofs submounts that are still in use forgotten by shrinker Bernd Schubert
2023-10-03 16:48 ` Krister Johansen
2023-10-03 22:54 ` Bernd Schubert
2023-10-04 13:58 ` Krister Johansen
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=cover.1696043833.git.kjlx@templeofstupid.com \
--to=kjlx@templeofstupid.com \
--cc=bernd.schubert@fastmail.fm \
--cc=gmaglione@redhat.com \
--cc=groug@kaod.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=mreitz@redhat.com \
--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).