]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_fsr: fix SWAPEXT failures under selinux
authorEric Sandeen <sandeen@redhat.com>
Fri, 18 Oct 2013 22:30:18 +0000 (22:30 +0000)
committerRich Johnston <rjohnston@sgi.com>
Mon, 18 Nov 2013 00:52:46 +0000 (18:52 -0600)
commit1adfe5c6296d3ea6c182f31a6728fc94af9146f7
tree80e07afbbd62da3201fc9e4d0eef42152fac20f9
parent275077754611e5a15672624e674265b54f1cb7ed
xfs_fsr: fix SWAPEXT failures under selinux

If we run xfs_fsr on a system which creates selinux extended
attributes, the temp file created by xfs_fsr may have a
large-ish local extended attribute as soon as it is created.

If the target file has NON-local extended attributes, it may
have a fork offset larger than the temp file, because i.e.
FMT_EXTENTS attributes take up less space.  We currently
have no mechanism to grow the temp file's fork offset.
So in this case, the SWAPEXT ioctl will fail.

(With systems using selinux and lots of xattrs, this becomes
fairly common in the real world.)

After testing the target file for a non-local extent, and
checking to see if the temp forkoff needs to be grown on the
first pass, we can add a large attr to knock all attributes on
the temp file out of local format, and grow the fork offset for
this particular case.

This passes xfstest 227, and also resolves issues seen on
a metadata image provided by Gabriel.

Reported-by: Gabriel VLASIU <gabriel@vlasiu.net>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
fsr/xfs_fsr.c