]> git.ipfire.org Git - thirdparty/linux.git/commit
xfs: don't double-lock when deleting a self-referential directory
authorDarrick J. Wong <djwong@kernel.org>
Mon, 27 Jul 2026 05:23:15 +0000 (22:23 -0700)
committerCarlos Maiolino <cem@kernel.org>
Mon, 3 Aug 2026 08:17:34 +0000 (10:17 +0200)
commit5fc643fb86599e29b38e7b2c2680b4b15bf8f772
treeb3151a64cf241d47c82bf7f2a7535d9644b099dd
parent97efed1091a50e4dbf31307015138b43a972d2e4
xfs: don't double-lock when deleting a self-referential directory

LOLLM notices that the dirtree scrubber can detect a directory that
refers to itself.  In this case, it's not correct for the directory tree
repair code to try to iolock/ilock both sc->ip and dp, because they're
the same inode.  Fix this by detecting that corner case and handling it
appropriately.

Cc: stable@vger.kernel.org # v6.10
Fixes: 3f31406aef493b ("xfs: fix corruptions in the directory tree")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/scrub/dirtree_repair.c