]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: reset child dir '..' entry when unlinking child
authorDarrick J. Wong <djwong@kernel.org>
Mon, 12 Jul 2021 19:58:48 +0000 (12:58 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 15 Jul 2021 16:58:42 +0000 (09:58 -0700)
commit35c2cec33759e143b1bfaf0bb59c630fb7cfbbda
tree479434143b7ae13788612b55a30a339b9998cec9
parent9e4175fdf9c0fcd931b7a43c1f09c322e4e50e3f
xfs: reset child dir '..' entry when unlinking child

While running xfs/168, I noticed a second source of post-shrink
corruption errors causing shutdowns.

Let's say that directory B has a low inode number and is a child of
directory A, which has a high number.  If B is empty but open, and
unlinked from A, B's dotdot link continues to point to A.  If A is then
unlinked and the filesystem shrunk so that A is no longer a valid inode,
a subsequent AIL push of B will trip the inode verifiers because the
dotdot entry points outside of the filesystem.

To avoid this problem, reset B's dotdot entry to the root directory when
unlinking directories, since the root directory cannot be removed.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
fs/xfs/xfs_inode.c