Skip to contentSkip to conversation

migration to selinux + xfs_fsr oddity....

DISCUSSION Eric Sandeen 2 participants 2 messages May 5, 2009 – May 12, 2009

lore
Share & tools
lore
#0 lore raw

This came up in RH Bugzilla #498860, "xfs_fsr fails to complete"

The reporter had an existing xfs filesystem from another Linux OS, and was using it under Fedora now. He had some files for which xfs_fsr bails out with EINVAL:

XFS_IOC_SWAPEXT failed: fragfile: Invalid argument

It's failing this check in xfs_swap_extents():

        /*
         * If the target has extended attributes, the tmp file
         * must also in order to ensure the correct data fork
         * format.
         */
        if ( XFS_IFORK_Q(ip) != XFS_IFORK_Q(tip) ) {
                error = XFS_ERROR(EINVAL);
                goto error0;
        }

because the original filesystem had no selinux xattrs, but the new/temp file created during xfs_fsr got the selinux xattr, so failed this test.

It can be demonstrated like this on a machine w/ selinux:

# mkfs.xfs -dfile,name=fsfile,size=32m
# mkdir test
# mount -o loop,context="unconfined_u:object_r:user_tmp_t:s0" fsfile test
# for I in `seq 10 -1 0`; do  dd if=/dev/zero of=test/fragfile bs=4k count=1
seek=$I conv=notrunc oflag=sync; done
# umount test
# mount -o loop fsfile test
# xfs_fsr test/fragfile
XFS_IOC_SWAPEXT failed: fragfile: Invalid argument

I'm not sure if this is the sort of thing to maybe just caveat & document, or try to work around ... somehow? Maybe detect this case a bit better and print something more helpful about what has gone wrong?

(As an aside ... looking at the above test and others related, and thinking about a few random reports that xfs_fsr corrupted a file, I can't help but think that maybe we are winding up with incompatible formats for the original and donor inodes in some cases...)

-Eric

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw
Quoted 7 lines · Eric Sandeen

This came up in RH Bugzilla #498860, "xfs_fsr fails to complete"

The reporter had an existing xfs filesystem from another Linux OS, and was using it under Fedora now. He had some files for which xfs_fsr bails out with EINVAL:

XFS_IOC_SWAPEXT failed: fragfile: Invalid argument

As analyzed in the bugzilla this is a problem when selinux attributes are created underneath due to selinux.

Either we relax the attribute fork check an allow the new inode to have an attribute fork despite the old one not having one, or we need to create a fake xattr on the file to be defragmented.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs