[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220527000312.GB15462@sequoia>
Date: Thu, 26 May 2022 19:03:12 -0500
From: Tyler Hicks <tyhicks@...ux.microsoft.com>
To: Eric Van Hensbergen <ericvh@...il.com>,
Latchesar Ionkov <lucho@...kov.net>,
Dominique Martinet <asmadeus@...ewreck.org>
Cc: Christian Schoenebeck <linux_oss@...debyte.com>,
Jianyong Wu <jianyong.wu@....com>,
v9fs-developer@...ts.sourceforge.net, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] 9p: Fix refcounting during full path walks for fid
lookups
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@...r.kernel.org
> Signed-off-by: Tyler Hicks <tyhicks@...ux.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
Powered by blists - more mailing lists