>From 0d12e733a6dd87ed3bc4dea27126f6e814b5586b Mon Sep 17 00:00:00 2001 From: Dmitry Monakhov Date: Tue, 23 Feb 2010 22:11:47 +0300 Subject: [PATCH] ext4: deprecate obsoleted mount options v2 Declare following list of mount options as deprecated: - bsddf, miniddf - grpid, bsdgroups, nogrpid, sysvgroups Declare following list of default mount options as deprecated: - bsdgroups Changes from v1 - Mark options as deprecated instead of disabling it completely, they will be disabled after exportation period. Signed-off-by: Dmitry Monakhov --- fs/ext4/ext4.h | 2 + fs/ext4/super.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 73 insertions(+), 5 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 67859fa..66ed482 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -1185,6 +1185,8 @@ static inline void ext4_clear_inode_state(struct inode *inode, int bit) #define EXT4_DEFM_JMODE_DATA 0x0020 #define EXT4_DEFM_JMODE_ORDERED 0x0040 #define EXT4_DEFM_JMODE_WBACK 0x0060 +/* Deprecated default mount options mask */ +#define EXT4_DEFM_DEPRECATED EXT4_DEFM_BSDGROUPS /* * Default journal batch times diff --git a/fs/ext4/super.c b/fs/ext4/super.c index d5596ca..d07f506 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1114,7 +1114,7 @@ enum { Opt_block_validity, Opt_noblock_validity, Opt_inode_readahead_blks, Opt_journal_ioprio, Opt_dioread_nolock, Opt_dioread_lock, - Opt_discard, Opt_nodiscard, + Opt_discard, Opt_nodiscard, Opt_deprecated, Opt_disabled, }; static const match_table_t tokens = { @@ -1188,6 +1188,18 @@ static const match_table_t tokens = { {Opt_err, NULL}, }; +static const match_table_t default_mountopt = { + {EXT4_DEFM_DEBUG, "debug"}, + {EXT4_DEFM_BSDGROUPS, "bsdgroups"}, + {EXT4_DEFM_XATTR_USER, "user_xattr"}, + {EXT4_DEFM_ACL, "acl"}, + {EXT4_DEFM_UID16, "uid16"}, + {EXT4_DEFM_JMODE_WBACK, "journal_data_writeback"}, + {EXT4_DEFM_JMODE_DATA, "journal_data"}, + {EXT4_DEFM_JMODE_ORDERED, "journal_data_ordered"}, + {0, NULL}, +}; + static ext4_fsblk_t get_sb_block(void **data) { ext4_fsblk_t sb_block; @@ -1240,16 +1252,16 @@ static int parse_options(char *options, struct super_block *sb, switch (token) { case Opt_bsd_df: clear_opt(sbi->s_mount_opt, MINIX_DF); - break; + goto deprecated; case Opt_minix_df: set_opt(sbi->s_mount_opt, MINIX_DF); - break; + goto deprecated; case Opt_grpid: set_opt(sbi->s_mount_opt, GRPID); - break; + goto deprecated; case Opt_nogrpid: clear_opt(sbi->s_mount_opt, GRPID); - break; + goto deprecated; case Opt_resuid: if (match_int(&args[0], &option)) return 0; @@ -1622,6 +1634,21 @@ set_qf_format: case Opt_dioread_lock: clear_opt(sbi->s_mount_opt, DIOREAD_NOLOCK); break; + + case Opt_deprecated: +deprecated: + ext4_msg(sb, KERN_ERR, + "Deprecated mount option \"%s\". Will be " + "removed soon. Please contact " + "linux-ext4@vger.kernel.org if you are still " + "using it.", p); + break; + + case Opt_disabled: + ext4_msg(sb, KERN_ERR, + "Deprecated mount option \"%s\". And not " + "longer supported.", p); + return 0; default: ext4_msg(sb, KERN_ERR, "Unrecognized mount option \"%s\" " @@ -2358,7 +2385,42 @@ static int ext4_feature_set_ok(struct super_block *sb, int readonly) } return 1; } +static int handle_deprecated_defmopt(struct super_block *sb, unsigned int opt) +{ + int first = 1; + /* + * When deprecated options are found they are not cleared from + * super block by default. Just print error message and let + * user clear it manually. + */ + printk(KERN_ERR "EXT4-fs (%s) Deprecated default mount options:", + sb->s_id); + /* + * It is impossible to use simple bit traversing because, + * some options use shared bits. + */ + opt &= EXT4_DEFM_DEPRECATED; + while (opt) { + const struct match_token *mt = default_mountopt; + while (mt->pattern != NULL) { + if ((opt & mt->token) == mt->token) + break; + mt++; + } + if (mt->pattern == NULL) { + printk("%s unknown", !first ? "," : ""); + break; + } else { + printk("%s %s", !first ? "," : "", mt->pattern); + opt &= ~mt->token; + } + first = 0; + } + printk(". Please use tune2fs to disable it, or contact " + "linux-ext4@vger.kernel.org if you are still need it."); + return 0; +} static int ext4_fill_super(struct super_block *sb, void *data, int silent) __releases(kernel_lock) __acquires(kernel_lock) @@ -2443,6 +2505,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) /* Set defaults before we parse the mount options */ def_mount_opts = le32_to_cpu(es->s_default_mount_opts); + if (def_mount_opts & EXT4_DEFM_DEPRECATED) { + if (handle_deprecated_defmopt(sb, def_mount_opts)) + goto failed_mount; + } if (def_mount_opts & EXT4_DEFM_DEBUG) set_opt(sbi->s_mount_opt, DEBUG); if (def_mount_opts & EXT4_DEFM_BSDGROUPS) -- 1.6.6