ZTS: Fix xattr_004_pos failure, don't use tmpfs
Previously, xattr_004_pos would create files with xattrs on both tmpfs and ext2, and then copy them to zfs to verify that their xattrs were preserved. However tmpfs doesn't support xattrs. This was never noticed until Fedora 33. In Fedora 32 and older, /tmp was on the root partition (like ext4), whereas on Fedora 33 /tmp is actually tmpfs. That caused this test to fail on Fedora 33. This fix updates the test to only create the file on ext2, not tmpfs. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Tony Hutter <hutter2@llnl.gov> Closes #11133
This commit is contained in:
parent
973ba682f5
commit
f829227f49
|
@ -33,11 +33,11 @@
|
|||
#
|
||||
# DESCRIPTION:
|
||||
#
|
||||
# Creating files on ufs|ext and tmpfs, and copying those files to ZFS with
|
||||
# appropriate cp flags, the xattrs will still be readable.
|
||||
# Create files on ufs|ext, copy those files to ZFS with appropriate cp flags,
|
||||
# and verify the xattrs will still be readable.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create files in ufs|ext and tmpfs with xattrs
|
||||
# 1. Create files in ufs|ext with xattrs
|
||||
# 2. Copy those files to zfs
|
||||
# 3. Ensure the xattrs can be read and written
|
||||
# 4. Do the same in reverse.
|
||||
|
@ -54,7 +54,7 @@ function cleanup {
|
|||
fi
|
||||
}
|
||||
|
||||
log_assert "Files from $NEWFS_DEFAULT_FS,tmpfs with xattrs copied to zfs retain xattr info."
|
||||
log_assert "Files from $NEWFS_DEFAULT_FS with xattrs copied to zfs retain xattr info."
|
||||
log_onexit cleanup
|
||||
|
||||
# Create a ufs|ext file system that we can work in
|
||||
|
@ -63,28 +63,23 @@ block_device_wait
|
|||
log_must eval "new_fs $ZVOL_DEVDIR/$TESTPOOL/$TESTFS/zvol > /dev/null 2>&1"
|
||||
|
||||
log_must mkdir /tmp/$NEWFS_DEFAULT_FS.$$
|
||||
log_must mkdir /tmp/tmpfs.$$
|
||||
if is_illumos; then
|
||||
log_must mount $ZVOL_DEVDIR/$TESTPOOL/$TESTFS/zvol \
|
||||
/tmp/$NEWFS_DEFAULT_FS.$$
|
||||
|
||||
# Create files in ufs and tmpfs, and set some xattrs on them.
|
||||
# Create files in ufs, and set some xattrs on them.
|
||||
log_must touch /tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$
|
||||
log_must touch /tmp/tmpfs-file.$$
|
||||
|
||||
log_must runat /tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$ \
|
||||
cp /etc/passwd .
|
||||
log_must runat /tmp/tmpfs-file.$$ cp /etc/group .
|
||||
|
||||
# copy those files to ZFS
|
||||
log_must cp -@ /tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$ \
|
||||
$TESTDIR
|
||||
log_must cp -@ /tmp/tmpfs-file.$$ $TESTDIR
|
||||
|
||||
# ensure the xattr information has been copied correctly
|
||||
log_must runat $TESTDIR/$NEWFS_DEFAULT_FS-file.$$ \
|
||||
diff passwd /etc/passwd
|
||||
log_must runat $TESTDIR/tmpfs-file.$$ diff group /etc/group
|
||||
|
||||
log_must umount /tmp/$NEWFS_DEFAULT_FS.$$
|
||||
else
|
||||
|
@ -94,21 +89,15 @@ else
|
|||
log_must mount ${options:+""} \
|
||||
$ZVOL_DEVDIR/$TESTPOOL/$TESTFS/zvol /tmp/$NEWFS_DEFAULT_FS.$$
|
||||
|
||||
# Create files in ext and tmpfs, and set some xattrs on them.
|
||||
# Create files in ext, and set some xattrs on them.
|
||||
# Use small values for xattrs for ext compatibility.
|
||||
log_must touch /tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$
|
||||
|
||||
echo "TEST XATTR" >/tmp/xattr1
|
||||
echo "1234567890" >/tmp/xattr2
|
||||
|
||||
log_must set_xattr_stdin xattr1 \
|
||||
/tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$ </tmp/xattr1
|
||||
|
||||
if is_linux; then
|
||||
log_must touch /tmp/tmpfs-file.$$
|
||||
log_must set_xattr_stdin xattr2 /tmp/tmpfs-file.$$ </tmp/xattr2
|
||||
fi
|
||||
|
||||
# copy those files to ZFS
|
||||
if is_freebsd; then
|
||||
# cp does not preserve extattrs on FreeBSD
|
||||
|
@ -119,7 +108,6 @@ else
|
|||
log_must cp -a \
|
||||
/tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$ \
|
||||
$TESTDIR
|
||||
log_must cp -a /tmp/tmpfs-file.$$ $TESTDIR
|
||||
fi
|
||||
|
||||
# ensure the xattr information has been copied correctly
|
||||
|
@ -129,15 +117,7 @@ else
|
|||
log_must rm $TESTDIR/$NEWFS_DEFAULT_FS-file.$$
|
||||
log_must rm /tmp/xattr1 /tmp/xattr1.$$
|
||||
|
||||
if is_linux; then
|
||||
log_must eval "get_xattr xattr2 $TESTDIR/tmpfs-file.$$ \
|
||||
>/tmp/xattr2.$$"
|
||||
log_must diff /tmp/xattr2.$$ /tmp/xattr2
|
||||
log_must rm /tmp/tmpfs-file.$$
|
||||
log_must rm /tmp/xattr2 /tmp/xattr2.$$
|
||||
fi
|
||||
|
||||
log_must umount /tmp/$NEWFS_DEFAULT_FS.$$
|
||||
fi
|
||||
|
||||
log_pass "Files from $NEWFS_DEFAULT_FS,tmpfs with xattrs copied to zfs retain xattr info."
|
||||
log_pass "Files from $NEWFS_DEFAULT_FS with xattrs copied to zfs retain xattr info."
|
||||
|
|
Loading…
Reference in New Issue