Re: [PATCH v12 2/6] generic/632: add fstests for idmapped mounts

Theodore Ts'o
2021-04-12T00:40:27Z

On Sun, Apr 11, 2021 at 05:32:23PM +0200, Christian Brauner wrote:
> Ah, ok I didn't know this needed to go in there. I thinke the following
> might be enough. Are you able to simply apply it on top?
>
> diff --git a/common/rc b/common/rc
> index 351996fc..bd913d13 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -2047,6 +2047,16 @@ _require_mount_setattr()
> # test whether idmapped mounts are supported
> _require_idmapped_mounts()
> {
> + case "$FSTYP" in
> + xfs)
> + ;;
> + ext4)
> + ;;
> + *)
> + _notrun "Filesystem $FSTYP does not support idmapped mounts yet"
> + ;;
> + esac
> +

Is there any way we can ask the kernel which file systems support
idmapped mounts? That way, the tests will do the right thing when run
on older LTS kernels, and if a distribution backports idmapped support
for some file system into their kernel, again, the right thing can
happen automatically.

If you can't do this by checking to see if the file system will
support a particular mount option, or some other run-time test, for
ext4 we can signal this by checking for the existence of a file in
/sys/fs/ext4/features, such as /sys/fs/ext4/features/fast_commit.
(Grep for EXT4_ATTR_FEATURE and ATTR_LIST in fs/ext4/sysfs.c; it
requires adding two lines to advertise a new ext4 feature.)

- Ted