f2fs: fix incorrect parsing with option string
Subsystems (2)
PATCH 1/1 f2fs: fix incorrect parsing with option string
Previously 'background_gc={on***,off***}' is being parsed as correct option, with this patch we cloud fix the trivial bug in mount process.
--- fs/f2fs/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/super.c +2 -2
@@ -258,9 +258,9 @@ static int parse_options(struct super_block *sb, char *options)if (!name)return -ENOMEM ; -if (!strncmp (name,"on" ,2 )) +if (!strncmp (name,"on" ,strlen (name)))set_opt (sbi,BG_GC ); -else if (!strncmp (name,"off" ,3 )) +else if (!strncmp (name,"off" ,strlen (name)))clear_opt (sbi,BG_GC );else {kfree (name);
Signature · 10 lines
1.7.9.5 ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech
Hi,
2014-03-17 (월), 17:40 +0800, Chao Yu:
Quoted 13 lines
Previously 'background_gc={on***,off***}' is being parsed as correct option, with this patch we cloud fix the trivial bug in mount process.
Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/f2fs/super.c +0
-0
fs/f2fs/super.c static int parse_options(struct super_block *sb, char *options) · line 261
Quoted 5 lines
fs/f2fs/super.c +1
-1@@ -258,9 +258,9 @@ static int parse_options(struct super_block *sb, char *options)if (!name)return -ENOMEM ; -if (!strncmp (name,"on" ,2 )) +if (!strncmp (name,"on" ,strlen (name)))
What about 'background_gc=o'?
Need to check strlen(name) == 2...
Thanks,
Quoted 6 lines
fs/f2fs/super.c +1
-1set_opt (sbi,BG_GC ); - else if (!strncmp(name, "off", 3)) + else if (!strncmp(name, "off", strlen(name)))clear_opt (sbi,BG_GC ); else {kfree (name);
Signature · 7 lines
Jaegeuk Kim Samsung -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi,
Quoted 25 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Tuesday, March 18, 2014 8:33 AM
To: Chao Yu
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [f2fs-dev] [PATCH] f2fs: fix incorrect parsing with option stringHi,
2014-03-17 (월), 17:40 +0800, Chao Yu:
Quoted 14 lines
Previously 'background_gc={on***,off***}' is being parsed as correct option, with this patch we cloud fix the trivial bug in mount process.
Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/f2fs/super.c +0
-0@@ -258,9 +258,9 @@ static int parse_options(struct super_block *sb, char *options)
Quoted 7 lines
fs/f2fs/super.c static int parse_options(struct super_block *sb, char *options) · line 261
Quoted 4 lines
fs/f2fs/super.c +1
-1if (!name)return -ENOMEM ; -if (!strncmp (name,"on" ,2 )) +if (!strncmp (name,"on" ,strlen (name)))What about 'background_gc=o'?
Need to check strlen(name) == 2...
Oh, you're right. I will fix it and send v2 patch. Thanks for your review. :)
Quoted 12 lines
Thanks,
fs/f2fs/super.c static int parse_options(struct super_block *sb, char *options) · line 266
Quoted 6 lines
fs/f2fs/super.c +1
-1set_opt (sbi,BG_GC ); - else if (!strncmp(name, "off", 3)) + else if (!strncmp(name, "off", strlen(name)))clear_opt (sbi,BG_GC ); else {kfree (name);--
Jaegeuk Kim
Samsung