aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-05-29 05:34:52 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-06-02 04:08:07 -0400
commit8379ea31e991ed2098660954d25f64386adee65c (patch)
tree1232942ea268f7d6a4231f841a819564050e4c66 /fs/ubifs
parent428ff9d2e37d3a82af0f56b476f70c244cf550d1 (diff)
UBIFS: allow sync option in rootflags
When passing UBIFS parameters via kernel command line, the sync option will be passed to UBIFS as a string, not as an MS_SYNCHRONOUS flag. Teach UBIFS interpreting this flag. Reported-by: Aurélien GÉRÔME <ag@debian.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/super.c40
1 files changed, 35 insertions, 5 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 42b818daa162..d10fc88c7bbd 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -940,6 +940,27 @@ static const match_table_t tokens = {
940}; 940};
941 941
942/** 942/**
943 * parse_standard_option - parse a standard mount option.
944 * @option: the option to parse
945 *
946 * Normally, standard mount options like "sync" are passed to file-systems as
947 * flags. However, when a "rootflags=" kernel boot parameter is used, they may
948 * be present in the options string. This function tries to deal with this
949 * situation and parse standard options. Returns 0 if the option was not
950 * recognized, and the corresponding integer flag if it was.
951 *
952 * UBIFS is only interested in the "sync" option, so do not check for anything
953 * else.
954 */
955static int parse_standard_option(const char *option)
956{
957 ubifs_msg("parse %s", option);
958 if (!strcmp(option, "sync"))
959 return MS_SYNCHRONOUS;
960 return 0;
961}
962
963/**
943 * ubifs_parse_options - parse mount parameters. 964 * ubifs_parse_options - parse mount parameters.
944 * @c: UBIFS file-system description object 965 * @c: UBIFS file-system description object
945 * @options: parameters to parse 966 * @options: parameters to parse
@@ -1015,9 +1036,19 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
1015 break; 1036 break;
1016 } 1037 }
1017 default: 1038 default:
1018 ubifs_err("unrecognized mount option \"%s\" " 1039 {
1019 "or missing value", p); 1040 unsigned long flag;
1020 return -EINVAL; 1041 struct super_block *sb = c->vfs_sb;
1042
1043 flag = parse_standard_option(p);
1044 if (!flag) {
1045 ubifs_err("unrecognized mount option \"%s\" "
1046 "or missing value", p);
1047 return -EINVAL;
1048 }
1049 sb->s_flags |= flag;
1050 break;
1051 }
1021 } 1052 }
1022 } 1053 }
1023 1054
@@ -1908,6 +1939,7 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
1908 INIT_LIST_HEAD(&c->orph_list); 1939 INIT_LIST_HEAD(&c->orph_list);
1909 INIT_LIST_HEAD(&c->orph_new); 1940 INIT_LIST_HEAD(&c->orph_new);
1910 1941
1942 c->vfs_sb = sb;
1911 c->highest_inum = UBIFS_FIRST_INO; 1943 c->highest_inum = UBIFS_FIRST_INO;
1912 c->lhead_lnum = c->ltail_lnum = UBIFS_LOG_LNUM; 1944 c->lhead_lnum = c->ltail_lnum = UBIFS_LOG_LNUM;
1913 1945
@@ -1939,8 +1971,6 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
1939 if (err) 1971 if (err)
1940 goto out_bdi; 1972 goto out_bdi;
1941 1973
1942 c->vfs_sb = sb;
1943
1944 sb->s_fs_info = c; 1974 sb->s_fs_info = c;
1945 sb->s_magic = UBIFS_SUPER_MAGIC; 1975 sb->s_magic = UBIFS_SUPER_MAGIC;
1946 sb->s_blocksize = UBIFS_BLOCK_SIZE; 1976 sb->s_blocksize = UBIFS_BLOCK_SIZE;