Message ID | 1243591249.11172.106.camel@localhost.localdomain |
---|---|
State | Accepted |
Commit | 8379ea31e991ed2098660954d25f64386adee65c |
Headers | show |
On Fri, 2009-05-29 at 13:00 +0300, Artem Bityutskiy wrote: > From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> > Subject: [PATCH] UBIFS: allow sync option in rootflags > MIME-Version: 1.0 > Content-Type: text/plain; charset=utf-8 > Content-Transfer-Encoding: 8bit > > 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> > --- > fs/ubifs/super.c | 40 +++++++++++++++++++++++++++++++++++----- > 1 files changed, 35 insertions(+), 5 deletions(-) Please, use this patch as a band-aid so far. Not sure it'll land upstream in this form.
Hi Artem, On Fri, May 29, 2009 at 01:03:47PM +0300, Artem Bityutskiy wrote: > Please, use this patch as a band-aid so far. Not sure it'll > land upstream in this form. Sure, thanks a lot! It works fine and it is now integrated to the kernel of my custom board. Cheers,
On Fri, 2009-05-29 at 15:20 +0200, Aurélien GÉRÔME wrote: > Hi Artem, > > On Fri, May 29, 2009 at 01:03:47PM +0300, Artem Bityutskiy wrote: > > Please, use this patch as a band-aid so far. Not sure it'll > > land upstream in this form. > > Sure, thanks a lot! > It works fine and it is now integrated to the kernel of my custom > board. Glad it helped. Please, watch the UBIFS back-port trees for fixes fixes. We find and fix bugs still. Also note, there is a known UBIFS&NOR flash issue related to power cuts. Watch the "UBIFS Corrupt during power failure". Hopefully Eric will come with more data and we could fix that.
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index d4ab0fc..3513cad 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -940,6 +940,27 @@ static const match_table_t tokens = { }; /** + * parse_standard_option - parse a standard mount option. + * @option: the option to parse + * + * Normally, standard mount options like "sync" are passed to file-systems as + * flags. However, when a "rootflags=" kernel boot parameter is used, they may + * be present in the options string. This function tries to deal with this + * situation and parse standard options. Returns 0 if the option was not + * recognized, and the corresponding integer flag if it was. + * + * UBIFS is only interested in the "sync" option, so do not check for anything + * else. + */ +static int parse_standard_option(const char *option) +{ + ubifs_msg("parse %s", option); + if (!strcmp(option, "sync")) + return MS_SYNCHRONOUS; + return 0; +} + +/** * ubifs_parse_options - parse mount parameters. * @c: UBIFS file-system description object * @options: parameters to parse @@ -1015,9 +1036,19 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options, break; } default: - ubifs_err("unrecognized mount option \"%s\" " - "or missing value", p); - return -EINVAL; + { + unsigned long flag; + struct super_block *sb = c->vfs_sb; + + flag = parse_standard_option(p); + if (!flag) { + ubifs_err("unrecognized mount option \"%s\" " + "or missing value", p); + return -EINVAL; + } + sb->s_flags |= flag; + break; + } } } @@ -1908,6 +1939,7 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent) INIT_LIST_HEAD(&c->orph_list); INIT_LIST_HEAD(&c->orph_new); + c->vfs_sb = sb; c->highest_inum = UBIFS_FIRST_INO; c->lhead_lnum = c->ltail_lnum = UBIFS_LOG_LNUM; @@ -1939,8 +1971,6 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent) if (err) goto out_bdi; - c->vfs_sb = sb; - sb->s_fs_info = c; sb->s_magic = UBIFS_SUPER_MAGIC; sb->s_blocksize = UBIFS_BLOCK_SIZE;