[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231207064200.GY1674809@ZenIV>
Date: Thu, 7 Dec 2023 06:42:00 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Dave Chinner <david@...morbit.com>
Cc: linux-fsdevel@...r.kernel.org, linux-block@...r.kernel.org,
linux-cachefs@...hat.com, dhowells@...hat.com,
gfs2@...ts.linux.dev, dm-devel@...ts.linux.dev,
linux-security-module@...r.kernel.org, selinux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 08/11] vfs: inode cache conversion to hash-bl
On Wed, Dec 06, 2023 at 05:05:37PM +1100, Dave Chinner wrote:
> + /*
> + * There are some callers that come through here without synchronisation
> + * and potentially with multiple references to the inode. Hence we have
> + * to handle the case that we might race with a remove and insert to a
> + * different list. Coda, in particular, seems to have a userspace API
> + * that can directly trigger "unhash/rehash to different list" behaviour
> + * without any serialisation at all.
> + *
> + * Hence we have to handle the situation where the inode->i_hash_head
> + * might point to a different list than what we expect, indicating that
> + * we raced with another unhash and potentially a new insertion. This
> + * means we have to retest the head once we have everything locked up
> + * and loop again if it doesn't match.
> + */
coda_replace_fid() is an old headache, but it's thankfully unique - nobody else
does that kind of shit (just rechecked).
Note that coda_replace_fid() is not going to have the sucker racing with
removal from another source, and I'm 100% sure that they really want
some serialization for handling those requests.
remove_inode_hash() is misused there - "in the middle of hash key change"
is not the same state as "unhashed".
Any races between insert and unhash are bugs, not something to support.
Powered by blists - more mailing lists