Re: [RFC PATCH 1/6] vfs, coda: Fix the lack of locking in FID replacement inode rehashing

From: Matthew Wilcox
Date: Thu Apr 18 2019 - 12:11:48 EST


On Thu, Apr 18, 2019 at 03:06:07PM +0100, David Howells wrote:
> Fix this by moving the core part of the code to fs/inode.c and providing it
> with a set() function akin to iget5(). We can then take the inode cache
> lock whilst performing the move.

> @@ -123,6 +132,8 @@ void coda_replace_fid(struct inode *inode, struct CodaFid *oldfid,
>
> BUG_ON(!coda_fideq(&cii->c_fid, oldfid));
>
> + rehash_inode(inode, hash, coda_reset_inode, newfid);
> +
> /* replace fid and rehash inode */
> /* XXX we probably need to hold some lock here! */
> remove_inode_hash(inode);

Don't you also need to delete the remove_inode_hash() and
__insert_inode_hash() calls?