]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: check for race with xfs_reclaim_inode() in xfs_ifree_cluster()
authorOmar Sandoval <osandov@fb.com>
Fri, 25 Aug 2017 17:05:26 +0000 (10:05 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Fri, 1 Sep 2017 17:55:30 +0000 (10:55 -0700)
commitf2e9ad212def50bcf4c098c6288779dd97fff0f0
tree954c96474662dac22d7901b16ab85a3882481bc8
parent799ea9e9c59949008770aab4e1da87f10e99dbe4
xfs: check for race with xfs_reclaim_inode() in xfs_ifree_cluster()

After xfs_ifree_cluster() finds an inode in the radix tree and verifies
that the inode number is what it expected, xfs_reclaim_inode() can swoop
in and free it. xfs_ifree_cluster() will then happily continue working
on the freed inode. Most importantly, it will mark the inode stale,
which will probably be overwritten when the inode slab object is
reallocated, but if it has already been reallocated then we can end up
with an inode spuriously marked stale.

In 8a17d7ddedb4 ("xfs: mark reclaimed inodes invalid earlier") we added
a second check to xfs_iflush_cluster() to detect this race, but the
similar RCU lookup in xfs_ifree_cluster() needs the same treatment.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_icache.c
fs/xfs/xfs_inode.c