[PATCH 08/11] vfs: inode cache conversion to hash-bl
Al Viro
viro at zeniv.linux.org.uk
Thu Dec 7 06:42:00 UTC 2023
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.
More information about the Linux-security-module-archive
mailing list