Re: JFS resize=0 problem in 2.6.0

From: Dave Kleikamp
Date: Mon Jan 05 2004 - 12:11:29 EST


Sorry for not replying sooner. I was on vacation.

On Sun, 2003-12-28 at 09:30, lkml@xxxxxxxxx wrote:
> Let me know if I'm missing the goal of the code here, but lines 261-273
> of linux-2.6.0/fs/jfs/super.c are:
>
> case Opt_resize:
> {
> char *resize = args[0].from;
> if (!resize || !*resize) { /* LINE 264 HERE */
> *newLVSize = sb->s_bdev->bd_inode->i_size >>
> sb->s_blocksize_bits;
> if (*newLVSize == 0)
> printk(KERN_ERR
> "JFS: Cannot determine volume size\n");
> } else
> *newLVSize = simple_strtoull(resize, &resize, 0);
> break;
> }
>
> It seems to me that line 264 is attempting to test for the mount
> paramater "resize=0", and when it comes across this, resize to the full
> size of the volume. However, this doesn't work. I believe it should
> test for the char '0' (*resize=='0'), not against literal zero.

Originally, the code accepted "resize" or "resize=" as an indication
that it should resize to the block device size. Recently, the parsing
code was cleaned up to use the match_token() function, and "resize"
without an argument is no longer accepted.

The following patch should allow the resize option without an argument,
as well as allowing resize=0 to indicate the same thing.

diff -ur linux-2.6.0/fs/jfs/super.c linux/fs/jfs/super.c
--- linux-2.6.0/fs/jfs/super.c 2004-01-05 10:54:19.000000000 -0600
+++ linux/fs/jfs/super.c 2004-01-05 10:54:36.000000000 -0600
@@ -203,7 +203,7 @@

enum {
Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize,
- Opt_errors, Opt_ignore, Opt_err,
+ Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err,
};

static match_table_t tokens = {
@@ -211,6 +211,7 @@
{Opt_nointegrity, "nointegrity"},
{Opt_iocharset, "iocharset=%s"},
{Opt_resize, "resize=%u"},
+ {Opt_resize_nosize, "resize"},
{Opt_errors, "errors=%s"},
{Opt_ignore, "noquota"},
{Opt_ignore, "quota"},
@@ -261,7 +262,7 @@
case Opt_resize:
{
char *resize = args[0].from;
- if (!resize || !*resize) {
+ if (!resize || !*resize || resize == 0) {
*newLVSize = sb->s_bdev->bd_inode->i_size >>
sb->s_blocksize_bits;
if (*newLVSize == 0)
@@ -271,6 +272,15 @@
*newLVSize = simple_strtoull(resize, &resize, 0);
break;
}
+ case Opt_resize_nosize:
+ {
+ *newLVSize = sb->s_bdev->bd_inode->i_size >>
+ sb->s_blocksize_bits;
+ if (*newLVSize == 0)
+ printk(KERN_ERR
+ "JFS: Cannot determine volume size\n");
+ break;
+ }
case Opt_errors:
{
char *errors = args[0].from;

Thanks,
Shaggy
--
David Kleikamp
IBM Linux Technology Center

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