xfs: ensure dentry consistency when the orphanage adopts a file
authorDarrick J. Wong <djwong@kernel.org>
Mon, 15 Apr 2024 21:54:57 +0000 (14:54 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 15 Apr 2024 21:58:57 +0000 (14:58 -0700)
commit73597e3e42b4a15030e6f93b71b53a04377ea419
treed55182f3c052cbab543fb488fa4bbdc4b7a47a65
parente6c9e75fbe792e1fb3bc7e7efce5c6bb015023c5
xfs: ensure dentry consistency when the orphanage adopts a file

When the orphanage adopts a file, that file becomes a child of the
orphanage.  The dentry cache may have entries for the orphanage
directory and the name we've chosen, so (1) make sure we abort if the
dcache has a positive entry because something's not right; and (2)
invalidate and purge negative dentries if the adoption goes through.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/scrub/orphanage.c
fs/xfs/scrub/trace.h