filesystem less than MIN_FSSIZE.
- Set DIFF_LENGTH to "number of diff lines to print from a failed test",
by default 10, set to 0 to print the full diff
+ - set IDMAPPED_MOUNTS=true to run all tests on top of idmapped mounts. While
+ this option is supported for all filesystems currently only -overlay is
+ expected to run without issues. For other filesystems additional patches
+ and fixes to the test suite might be needed.
______________________
USING THE FSQA SUITE
do not change FSTYP and MKFS_OPTIONS can be safely used with -overlay.
For example, the following multi-section config file can be used to
-run overlay tests on the same base fs, but with different mount options:
+run overlay tests on the same base fs, but with different mount options, and on
+top of idmapped mounts:
[xfs]
TEST_DEV=/dev/sda5
OVERLAY_MOUNT_OPTIONS="-o redirect_dir=off"
OVERLAY_FSCK_OPTIONS="-n -o redirect_dir=off"
+ [idmapped]
+ IDMAPPED_MOUNTS=true
+
In the example above, MOUNT_OPTIONS will be used to mount the base scratch fs,
TEST_FS_MOUNT_OPTS will be used to mount the base test fs,
OVERLAY_MOUNT_OPTIONS will be used to mount both test and scratch overlay and
# Set fsck options, use default if user not set directly.
export FSCK_OPTIONS="$OVERLAY_FSCK_OPTIONS"
[ -z "$FSCK_OPTIONS" ] && _fsck_opts
+ export IDMAPPED_MOUNTS="$IDMAPPED_MOUNTS"
}
_overlay_config_restore()
if [ -z "$dev" -o -z "$mnt" ] || \
_check_mounted_on $devname $dev $mntname $mnt; then
+ _idmapped_mount $dev $mnt
# no base fs or already mounted
return 0
elif [ $? -ne 1 ]; then
fi
_mount $* $dev $mnt
+ _idmapped_mount $dev $mnt
}
_overlay_base_test_mount()
return $?
fi
_mount -t $FSTYP `_scratch_mount_options $*`
+ _idmapped_mount $SCRATCH_DEV $SCRATCH_MNT
}
# mount scratch device with given options and _fail if mount fails
fi
}
+_move_mount()
+{
+ local mnt=$1
+ local tmp=$2
+
+ # Replace $mnt with $tmp. Use a temporary bind-mount because
+ # mount --move will fail with certain mount propagation layouts.
+ $UMOUNT_PROG $mnt || _fail "Failed to unmount $mnt"
+ _mount --bind $tmp $mnt || _fail "Failed to bind-mount $tmp to $mnt"
+ $UMOUNT_PROG $tmp || _fail "Failed to unmount $tmp"
+ rmdir $tmp
+}
+
+_idmapped_mount()
+{
+ [ "$IDMAPPED_MOUNTS" = "true" ] || return 0
+
+ local dev=$1
+ local mnt=$2
+ local status=0
+ local tmp=`mktemp -d`
+
+ local mount_rec=`findmnt -rncv -S $dev -o OPTIONS`
+ if [[ "$mount_rec" == *"idmapped"* ]]; then
+ return 0
+ fi
+
+ # We create an idmapped mount where {g,u}id 0 writes to disk as
+ # {g,u}id 10000000 and $(id -u fsgqa) + 10000000. We change ownership
+ # of $mnt so {g,u} id 0 can actually create objects in there.
+ chown 10000000:10000000 $mnt || return 1
+ $here/src/idmapped-mounts/mount-idmapped \
+ --map-mount b:10000000:0:100000000000 \
+ $mnt $tmp
+ if [ $? -ne 0 ]; then
+ rmdir $tmp
+ return 1
+ fi
+
+ # The next call ensures we don't end up stacking an idmapped mount on
+ # top of the original mount. Instead we fully replace the original
+ # mount with the idmapped mount. This will not just allow a clean mount
+ # layout it also makes unmount and remounting way simpler.
+ _move_mount $mnt $tmp
+ return $?
+}
+
_test_mount()
{
if [ "$FSTYP" == "overlay" ]; then
fi
_test_options mount
_mount -t $FSTYP $TEST_OPTIONS $TEST_FS_MOUNT_OPTS $SELINUX_MOUNT_OPTIONS $* $TEST_DEV $TEST_DIR
+ _idmapped_mount $TEST_DEV $TEST_DIR
}
_test_unmount()
if [ $USE_REMOUNT -eq 0 ]; then
if [ "$FSTYP" != "overlay" ]; then
_mount -t $FSTYP $mount_opts $device $mountpoint
+ _idmapped_mount $device $mountpoint
else
_overlay_mount $device $mountpoint
fi