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

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



On Sun, Apr 11, 2021 at 08:40:12PM -0400, Theodore Ts'o wrote:
> 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.

So we can detect it pretty reliably at runtime by trying whether we can
create an idmapped mount on the given filesystem. That is enough for the
idmapped mount tests here but of course has at least two drawbacks:
1. there might be scenarios where we get false negatives
   (e.g. open_tree() could fail for a lack of permissions or sm else,
   kernel might be compiled without userns support etc. pp)
2. it's heavy in so far as we have to do the whole exercise of creating
   a detached mount
So having a reliable way to detect whether or not the underlying fs
supports it could be worth it (My hope was for the fsinfo() API to grow
this "feature check" ability but oh well.).

One possibility might be to extend fstatfs() and steal one u32 from the
padding that is currently in there?

> 
> 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.)

I wonder if this wouldn't be nice to have independent of whether or not
there is another way to detect it?
I'm would think that people like to see all new ext4 features listed in
there. Even if this is technically a generic vfs feature.

Christian



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux