Skip to contentSkip to conversation

hugetlbfs: fix error reporting in case of invalid mount options

PATCH In review René Scharfe 2 participants 4 messages Jun 7, 2003 HugeTLB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hugetlbfs: fix error reporting in case of invalid mount options

Hi Linus,

there is not much point in trying to print the mount options after hugetlbfs_parse_options() went over them.

Since it employs strsep(), it cuts the option string into pieces by replacing all commas with NUL characters. A following printk() will always show the first option, only, which could be confusing.

The patch below changes hugetlbfs to not try to echo the string of mount options in case of an error at all. It wouldn't tell us anything we didn't know before, anyway.

René

fs/hugetlbfs/inode.c renamed from fs/hugetlbfs/inode.c~ +1 -1
diff -u ./fs/hugetlbfs/inode.c~ ./fs/hugetlbfs/inode.c
@@ -525,7 +525,7 @@
 
 	ret = hugetlbfs_parse_options(data, &config);
 	if (ret) {
-		printk("hugetlbfs: invalid mount options: %s.\n", data);
+		printk(KERN_ERR "hugetlbfs: invalid mount options.\n");
 		return ret;
 	}
 	sb->s_blocksize = PAGE_CACHE_SIZE;
#1 lore raw
Quoted 8 lines · Ren? Scharfe

there is not much point in trying to print the mount options after hugetlbfs_parse_options() went over them.
Since it employs strsep(), it cuts the option string into pieces by replacing all commas with NUL characters. A following printk() will always show the first option, only, which could be confusing. The patch below changes hugetlbfs to not try to echo the string of mount options in case of an error at all. It wouldn't tell us anything we didn't know before, anyway.

Let's nuke it entirely. All other fs's barf without printk()'ing at all and kick -EINVAL back to the caller.

-- wli

#2 lore raw
Quoted 2 lines · On Sat, 7 Jun 2003 09:35:21 -0700 William Lee Irwin III <[email protected]>…

Let's nuke it entirely. All other fs's barf without printk()'ing at all and kick -EINVAL back to the caller.

Mmmkay, even better. Patch below.

René

fs/hugetlbfs/inode.c renamed from fs/hugetlbfs/inode.c~ +2 -3
diff -u ./fs/hugetlbfs/inode.c~ ./fs/hugetlbfs/inode.c
@@ -524,10 +524,9 @@
 	struct hugetlbfs_config config;
 
 	ret = hugetlbfs_parse_options(data, &config);
-	if (ret) {
-		printk("hugetlbfs: invalid mount options: %s.\n", data);
+	if (ret)
 		return ret;
-	}
+
 	sb->s_blocksize = PAGE_CACHE_SIZE;
 	sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
 	sb->s_magic = HUGETLBFS_MAGIC;
#3 lore raw
Quoted 2 lines · On Sat, 7 Jun 2003 09:35:21 -0700 William Lee Irwin III <[email protected]>…
Quoted 2 lines

Let's nuke it entirely. All other fs's barf without printk()'ing at all and kick -EINVAL back to the caller.

Quoted 1 line · Ren? Scharfe

Mmmkay, even better. Patch below.

Looks good to me. Linus, please apply.

-- wli