From 6a426c97ec2de0968b4cde62e5eab3df605bde33 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Thu, 17 Feb 2011 15:56:17 -0600 Subject: [PATCH] e2fsprogs: enable user namespace xattrs by default User namespace xattrs are generally useful, and I think extN is the only filesystem requiring a special mount option to enable them, when xattrs are otherwise available. So this change sets that mount option into the defaults, via a mke2fs.conf option. Note that if xattrs are config'd off, this will lead to a mostly-harmless: EXT4-fs (sdc1): (no)user_xattr options not supported message at mount time... Signed-off-by: Eric Sandeen Signed-off-by: Theodore Ts'o --- lib/ext2fs/initialize.c | 1 + misc/mke2fs.c | 19 +++++++++++++++++++ misc/mke2fs.conf | 1 + misc/mke2fs.conf.5.in | 7 +++++++ tests/mke2fs.conf.in | 1 + 5 files changed, 29 insertions(+) diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c index 5e3317314..cba245335 100644 --- a/lib/ext2fs/initialize.c +++ b/lib/ext2fs/initialize.c @@ -143,6 +143,7 @@ errcode_t ext2fs_initialize(const char *name, int flags, set_field(s_feature_compat, 0); set_field(s_feature_incompat, 0); set_field(s_feature_ro_compat, 0); + set_field(s_default_mount_opts, 0); set_field(s_first_meta_bg, 0); set_field(s_raid_stride, 0); /* default stride size: 0 */ set_field(s_raid_stripe_width, 0); /* default stripe width: 0 */ diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 87d3c262c..a5cf16b0e 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -885,6 +885,18 @@ static void edit_feature(const char *str, __u32 *compat_array) } } +static void edit_mntopts(const char *str, __u32 *mntopts) +{ + if (!str) + return; + + if (e2p_edit_mntopts(str, mntopts, ~0)) { + fprintf(stderr, _("Invalid mount option set: %s\n"), + str); + exit(1); + } +} + struct str_list { char **list; int num; @@ -1624,6 +1636,13 @@ got_size: edit_feature(tmp, &fs_param.s_feature_compat); free(tmp); + /* And which mount options as well */ + tmp = get_string_from_profile(fs_types, "default_mntopts", + "acl,user_xattr"); + edit_mntopts(tmp, &fs_param.s_default_mount_opts); + if (tmp) + free(tmp); + for (cpp = fs_types; *cpp; cpp++) { tmp = NULL; profile_get_string(profile, "fs_types", *cpp, diff --git a/misc/mke2fs.conf b/misc/mke2fs.conf index 868821d38..b32a73949 100644 --- a/misc/mke2fs.conf +++ b/misc/mke2fs.conf @@ -1,5 +1,6 @@ [defaults] base_features = sparse_super,filetype,resize_inode,dir_index,ext_attr + default_mntopts = acl,user_xattr enable_periodic_fsck = 0 blocksize = 4096 inode_size = 256 diff --git a/misc/mke2fs.conf.5.in b/misc/mke2fs.conf.5.in index cb643eb70..cb44c7f85 100644 --- a/misc/mke2fs.conf.5.in +++ b/misc/mke2fs.conf.5.in @@ -314,6 +314,13 @@ relations. It may be overridden by the command-line option to .BR mke2fs (8). .TP +.I default_mntopts +This relation specifies the set of mount options which should be enabled +by default. These may be changed at a later time with the +.B -o +command-line option to +.BR tune2fs (8). +.TP .I blocksize This relation specifies the default blocksize if the user does not specify a blocksize on the command line. diff --git a/tests/mke2fs.conf.in b/tests/mke2fs.conf.in index cdb6c952f..070d5d561 100644 --- a/tests/mke2fs.conf.in +++ b/tests/mke2fs.conf.in @@ -5,6 +5,7 @@ inode_ratio = 16384 enable_periodic_fsck = true lazy_itable_init = false + default_mntopts = ^acl [fs_types] ext3 = { -- 2.47.2