[PATCH -RFC] ext4: add feature file to advertise that ext4 supports idmapped mounts

Theodore Ts'o
2021-04-14T20:47:31Z

On Mon, Apr 12, 2021 at 06:41:20PM -0400, Theodore Ts'o wrote:
> In the ideal world, if the kernel wasn't compiled with the necessary
> CONFIG options enabled, it's desirable of the test can detect that
> fact and skip running the test instead failing and forcing the person
> running the test to try to figure out whether this is a legitmate file
> system bug or a just a test setup bug.

So it would make it easier for me to manage running xfstests on ext4
if I had added something like this to ext4 and sent it to Linus before
v5.12 is released. What do folks think?

- Ted

commit 20619aefe69d39e76083d8f8598653c2dca9b47e
Author: Theodore Ts'o <tytso@mit.edu>
Date: Wed Apr 14 16:42:47 2021 -0400

ext4: add feature file to advertise that ext4 supports idmapped mounts

This makes it easier for automated test suites to know whether it know
whether we should test the functionality of the new idmapped mounts
feature introduced in v5.12-rc1.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
index a3d08276d441..101bf700c16b 100644
--- a/fs/ext4/sysfs.c
+++ b/fs/ext4/sysfs.c
@@ -313,6 +313,9 @@ EXT4_ATTR_FEATURE(verity);
#endif
EXT4_ATTR_FEATURE(metadata_csum_seed);
EXT4_ATTR_FEATURE(fast_commit);
+#ifdef CONFIG_USER_NS
+EXT4_ATTR_FEATURE(idmapped_mount);
+#endif

static struct attribute *ext4_feat_attrs[] = {
ATTR_LIST(lazy_itable_init),
@@ -330,6 +333,9 @@ static struct attribute *ext4_feat_attrs[] = {
#endif
ATTR_LIST(metadata_csum_seed),
ATTR_LIST(fast_commit),
+#ifdef CONFIG_USER_NS
+ ATTR_LIST(idmapped_mount),
+#endif
NULL,
};
ATTRIBUTE_GROUPS(ext4_feat);