]> 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)
commiteee951e0fd911fd05a27dc2357c55e70243d0f7a
tree954c96474662dac22d7901b16ab85a3882481bc8
parent00d3704f2251c9f3905fd4cabf8b109732a667a9
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 b39d3b18442f ("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