lkml.org 
[lkml]   [2001]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] 2.4.9-ac13 - parse_options() in reiserfs still broken
Hello!

I'm a bit disappointed that the bug with option parsing in reiserfs wasn't
fixed in 2.4.9-ac13. It's a serious issue that prevents mounting
reiserfs partitions on system startup (except root partition).

Anyway, I'm using this opportunity to send a better patch. The only
difference is that the faulty code has been actually identified and fixed
(do-while becomes while), not just worked around by a sanity check.

"pos" is initialized with "options", not NULL, because kgetopt()
effectively does it anyway, but the value of "pos" is now used earlier.

I also included fixes for the typos that I encountered while fixing and
testing my patch.

The patch has been tested by multiple mounting and unmounting a reiserfs
partition with specific (notail) and generic (ro) flags in different
combinations.

Simplification of kgetopt() is possible, but I'm intentionally avoiding
code changes other that the most urgent fix.

The patch is also available here:
http://www.red-bean.com/~proski/linux/reiserfs-parse.diff

---------------------------------------------------
--- linux.orig/fs/reiserfs/super.c
+++ linux/fs/reiserfs/super.c
@@ -144,8 +144,8 @@ static int kgetopt (char * options, opt_
int len_arg;

ptr1 = (*pos ? *pos : options);
- ptr2 = NULL; /* here we will put pounter on '=' */
- ptr3 = NULL; /* here we will put pounter on ',' */
+ ptr2 = NULL; /* here we will put pointer on '=' */
+ ptr3 = NULL; /* here we will put pointer on ',' */

if (!options)
return -1;
@@ -164,7 +164,7 @@ static int kgetopt (char * options, opt_
}
}
if (!option_exists) {
- printk ("reiserfs kgetopt: there is not option %s\n", ptr1);
+ printk ("reiserfs kgetopt: unrecognized option %s\n", ptr1);
return -1;
}
if (ptr2) {
@@ -213,7 +213,7 @@ static int parse_options (
{
int c;
char * arg = NULL;
- char * pos = NULL;
+ char * pos = options;
char * p = NULL;
arg_desc_t hash[] = {
{"rupasov", FORCE_RUPASOV_HASH},
@@ -227,7 +227,7 @@ static int parse_options (
/* use default configuration: create tails, journaling on, no
conversion to newest format */
return 1;
- do {
+ while (*pos != '\0') {
opt_desc_t opts[] = {
{"notail", 0, 0, NOTAIL},
{"conv", 0, 0, REISERFS_CONVERT},
@@ -251,7 +251,7 @@ static int parse_options (
return 0;
}
}
- } while (*pos != '\0');
+ }
return 1;
}

---------------------------------------------------
Regards,
Pavel Roskin

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:03    [W:0.621 / U:1.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site