]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
xfs: xfs_attr_inactive leaves inconsistent attr fork state behind
authorDave Chinner <dchinner@redhat.com>
Thu, 28 May 2015 21:40:08 +0000 (07:40 +1000)
committerSasha Levin <sasha.levin@oracle.com>
Tue, 9 Jun 2015 17:43:52 +0000 (13:43 -0400)
commitbebd294bf63ec67763215d868a48e274c53590d5
tree1941f8e753001ac66103c4e39a0418b223a23377
parent4941509f057cc50ba8420ac5f5e6ffdf8715c02a
xfs: xfs_attr_inactive leaves inconsistent attr fork state behind

[ Upstream commit 6dfe5a049f2d48582050339d2a6b6fda36dfd14c ]

xfs_attr_inactive() is supposed to clean up the attribute fork when
the inode is being freed. While it removes attribute fork extents,
it completely ignores attributes in local format, which means that
there can still be active attributes on the inode after
xfs_attr_inactive() has run.

This leads to problems with concurrent inode writeback - the in-core
inode attribute fork is removed without locking on the assumption
that nothing will be attempting to access the attribute fork after a
call to xfs_attr_inactive() because it isn't supposed to exist on
disk any more.

To fix this, make xfs_attr_inactive() completely remove all traces
of the attribute fork from the inode, regardless of it's state.
Further, also remove the in-core attribute fork structure safely so
that there is nothing further that needs to be done by callers to
clean up the attribute fork. This means we can remove the in-core
and on-disk attribute forks atomically.

Also, on error simply remove the in-memory attribute fork. There's
nothing that can be done with it once we have failed to remove the
on-disk attribute fork, so we may as well just blow it away here
anyway.

cc: <stable@vger.kernel.org> # 3.12 to 4.0
Reported-by: Waiman Long <waiman.long@hp.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
fs/xfs/libxfs/xfs_attr_leaf.c
fs/xfs/libxfs/xfs_attr_leaf.h
fs/xfs/xfs_attr_inactive.c
fs/xfs/xfs_inode.c