From: Krister Johansen <kjlx@templeofstupid.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-fsdevel@vger.kernel.org,
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: Re: [resend PATCH v2 2/2] fuse: ensure that submounts lookup their parent
Date: Tue, 10 Oct 2023 18:25:45 -0700 [thread overview]
Message-ID: <20231011012545.GA1977@templeofstupid.com> (raw)
In-Reply-To: <CAJfpegvr0cHj53jSPyBxVZnMpReq_RFhT-P1jv8eUu4pqxt9HA@mail.gmail.com>
Hi Miklos,
On Tue, Oct 10, 2023 at 10:15:38AM +0200, Miklos Szeredi wrote:
> On Tue, 10 Oct 2023 at 04:35, Krister Johansen <kjlx@templeofstupid.com> wrote:
>
> > If I manually traverse the path to the submount via something like cd
> > and ls from the initial mount namespace, it'll stay referenced until I
> > run a umount for the automounted path. I'm reasonably sure it's the
> > container setup that's causing the detaching.
>
> Okay. Can you please try the attached test patch. It's not a proper
> solution, but I think it's the right direction.
Thanks, I tested this patch and was unable to reproduce the scenario
where an OOM resulted in the submount from the guest in the guest
getting an EBADF from virtiofsd. (I did generate OOMs, though).
I am curious what you have in mind in order to move this towards a
proper fix? I shied away from the approach of stealing a nlookup from
mp_fi beacuse it wasn't clear that I could always count on the nlookup
in the parent staying positive. E.g. I was afraid I was either going to
not have enough nlookups to move to submounts, or trigger a forget from
an exiting container that leads to an EBADF from the initial mount
namespace.
-K
> diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
> index 2e4eb7cf26fb..d5f47203dfbc 100644
> --- a/fs/fuse/inode.c
> +++ b/fs/fuse/inode.c
> @@ -1524,6 +1524,18 @@ static int fuse_get_tree_submount(struct fs_context *fsc)
> return err;
> }
>
> + spin_lock(&mp_fi->lock);
> + if (mp_fi->nlookup) {
> + struct fuse_inode *fi = get_fuse_inode(d_inode(sb->s_root));
> + mp_fi->nlookup--;
> + spin_unlock(&mp_fi->lock);
> + spin_lock(&fi->lock);
> + fi->nlookup++;
> + spin_unlock(&fi->lock);
> + } else {
> + spin_unlock(&mp_fi->lock);
> + }
> +
> down_write(&fc->killsb);
> list_add_tail(&fm->fc_entry, &fc->mounts);
> up_write(&fc->killsb);
next prev parent reply other threads:[~2023-10-11 1:31 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-02 15:24 [resend PATCH v2 0/2] virtiofs submounts that are still in use forgotten by shrinker Krister Johansen
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 [this message]
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=20231011012545.GA1977@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