From: Tyler Hicks <tyhicks@linux.microsoft.com>
To: Eric Van Hensbergen <ericvh@gmail.com>,
Latchesar Ionkov <lucho@ionkov.net>,
Dominique Martinet <asmadeus@codewreck.org>
Cc: Christian Schoenebeck <linux_oss@crudebyte.com>,
Jianyong Wu <jianyong.wu@arm.com>,
v9fs-developer@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 9p: Fix refcounting during full path walks for fid lookups
Date: Thu, 26 May 2022 19:03:12 -0500 [thread overview]
Message-ID: <20220527000312.GB15462@sequoia> (raw)
In-Reply-To: <20220525182530.266068-1-tyhicks@linux.microsoft.com>
On 2022-05-25 13:25:30, Tyler Hicks wrote:
> Decrement the refcount of the parent dentry's fid after walking
> each path component during a full path walk for a lookup. Failure to do
> so can lead to fids that are not clunked until the filesystem is
> unmounted, as indicated by this warning:
>
> 9pnet: found fid 3 not clunked
>
> The improper refcounting after walking resulted in open(2) returning
> -EIO on any directories underneath the mount point when using the virtio
> transport. When using the fd transport, there's no apparent issue until
> the filesytem is unmounted and the warning above is emitted to the logs.
>
> In some cases, the user may not yet be attached to the filesystem and a
> new root fid, associated with the user, is created and attached to the
> root dentry before the full path walk is performed. Increment the new
> root fid's refcount to two in that situation so that it can be safely
> decremented to one after it is used for the walk operation. The new fid
> will still be attached to the root dentry when
> v9fs_fid_lookup_with_uid() returns so a final refcount of one is
> correct/expected.
>
> Include a small readability improvement by using a new variable when
> dealing with the root fid as it requires special handling not necessary
> with non-root fids.
>
> Fixes: 6636b6dcc3db ("9p: add refcount to p9_fid struct")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tyler Hicks <tyhicks@linux.microsoft.com>
This patch was doing a little too much code cleanup when it should have
just been fixing the bug. v2 has a patch just focused on fixing the bug
followed by additional patches for code cleanup:
https://lore.kernel.org/lkml/20220527000003.355812-1-tyhicks@linux.microsoft.com/
Sorry for the churn but v1 wasn't sitting well with me.
Tyler
prev parent reply other threads:[~2022-05-27 0:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-25 18:25 [PATCH] 9p: Fix refcounting during full path walks for fid lookups Tyler Hicks
2022-05-27 0:03 ` Tyler Hicks [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=20220527000312.GB15462@sequoia \
--to=tyhicks@linux.microsoft.com \
--cc=asmadeus@codewreck.org \
--cc=ericvh@gmail.com \
--cc=jianyong.wu@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=lucho@ionkov.net \
--cc=v9fs-developer@lists.sourceforge.net \
/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