From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: Marc Singer <elf@buici.com>, linux-kernel@vger.kernel.org
Subject: Re: NFS and kernel 2.6.x
Date: Mon, 19 Apr 2004 12:39:57 -0400 [thread overview]
Message-ID: <1082392797.2559.54.camel@lade.trondhjem.org> (raw)
In-Reply-To: <1082256704.3619.68.camel@lade.trondhjem.org>
[-- Attachment #1: Type: text/plain, Size: 832 bytes --]
On Sat, 2004-04-17 at 22:51, Trond Myklebust wrote:
> On Sat, 2004-04-17 at 12:19, Russell King wrote:
>
> > Firstly, as far as I can see, args[] is uninitialised. If match_token
> > doesn't touch args[] then we pass match_int some uninitialised kernel
> > memory.
> >
> > Secondly, we seem to exit if match_int doesn't parse a number. Not
> > all options in "tokens" have a number associated with them, including
> > ones like "tcp".
>
> Agreed. The correct fix should be something like the appended patch. It
> depends on all tokens that do take an integer argument being listed
> first in the enum.
>
> Comments?
It turned out there were a few extra issues that weren't fixed by the
previous patch. Thanks to boris@macbeth.rhoen.de for helping debug them.
Hopefully this will be the final set of fixes.
Cheers,
Trond
[-- Attachment #2: Type: text/plain, Size: 2951 bytes --]
nfsroot.c | 33 +++++++++++++++++++++------------
1 files changed, 21 insertions(+), 12 deletions(-)
diff -u --recursive --new-file --show-c-function linux-2.6.6-01-soft/fs/nfs/nfsroot.c linux-2.6.6-02-fix_nfsroot/fs/nfs/nfsroot.c
--- linux-2.6.6-01-soft/fs/nfs/nfsroot.c 2004-04-17 23:01:09.000000000 -0400
+++ linux-2.6.6-02-fix_nfsroot/fs/nfs/nfsroot.c 2004-04-19 12:08:31.000000000 -0400
@@ -117,11 +117,16 @@ static int mount_port __initdata = 0; /
***************************************************************************/
enum {
+ /* Options that take integer arguments */
Opt_port, Opt_rsize, Opt_wsize, Opt_timeo, Opt_retrans, Opt_acregmin,
- Opt_acregmax, Opt_acdirmin, Opt_acdirmax, Opt_soft, Opt_hard, Opt_intr,
+ Opt_acregmax, Opt_acdirmin, Opt_acdirmax,
+ /* Options that take no arguments */
+ Opt_soft, Opt_hard, Opt_intr,
Opt_nointr, Opt_posix, Opt_noposix, Opt_cto, Opt_nocto, Opt_ac,
Opt_noac, Opt_lock, Opt_nolock, Opt_v2, Opt_v3, Opt_udp, Opt_tcp,
- Opt_broken_suid, Opt_err,
+ Opt_broken_suid,
+ /* Error token */
+ Opt_err
};
static match_table_t tokens = {
@@ -146,9 +151,13 @@ static match_table_t tokens = {
{Opt_noac, "noac"},
{Opt_lock, "lock"},
{Opt_nolock, "nolock"},
+ {Opt_v2, "nfsvers=2"},
{Opt_v2, "v2"},
+ {Opt_v3, "nfsvers=3"},
{Opt_v3, "v3"},
+ {Opt_udp, "proto=udp"},
{Opt_udp, "udp"},
+ {Opt_tcp, "proto=tcp"},
{Opt_tcp, "tcp"},
{Opt_broken_suid, "broken_suid"},
{Opt_err, NULL}
@@ -162,25 +171,21 @@ static match_table_t tokens = {
static int __init root_nfs_parse(char *name, char *buf)
{
- char *p;
+ char *p, *path = name;
substring_t args[MAX_OPT_ARGS];
int option;
if (!name)
return 1;
- if (name[0] && strcmp(name, "default")){
- strlcpy(buf, name, NFS_MAXPATHLEN);
- return 1;
- }
while ((p = strsep (&name, ",")) != NULL) {
int token;
if (!*p)
continue;
token = match_token(p, tokens, args);
- /* %u tokens only */
- if (match_int(&args[0], &option))
+ /* %u tokens only. Beware if you add new tokens! */
+ if (token < Opt_soft && match_int(&args[0], &option))
return 0;
switch (token) {
case Opt_port:
@@ -265,6 +270,13 @@ static int __init root_nfs_parse(char *n
return 0;
}
}
+
+ /*
+ * Copy the NFS remote path to the output buffer.
+ * Relies on strsep() having converted the delimiting ',' to '\0'.
+ */
+ if (path[0] != '\0' && strcmp(path, "default") != 0)
+ strlcpy(buf, path, NFS_MAXPATHLEN);
return 1;
}
@@ -283,9 +295,6 @@ static int __init root_nfs_name(char *na
nfs_data.flags = NFS_MOUNT_NONLM; /* No lockd in nfs root yet */
nfs_data.rsize = NFS_DEF_FILE_IO_BUFFER_SIZE;
nfs_data.wsize = NFS_DEF_FILE_IO_BUFFER_SIZE;
- nfs_data.bsize = 0;
- nfs_data.timeo = 7;
- nfs_data.retrans = 3;
nfs_data.acregmin = 3;
nfs_data.acregmax = 60;
nfs_data.acdirmin = 30;
next prev parent reply other threads:[~2004-04-19 16:41 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-16 1:14 Charles Shannon Hendrix
2004-04-16 1:31 ` Trond Myklebust
2004-04-16 1:53 ` Andrew Morton
2004-04-16 2:54 ` Trond Myklebust
2004-04-16 4:59 ` Phil Oester
2004-04-16 5:29 ` Trond Myklebust
2004-04-16 7:13 ` Paul Wagland
2004-04-16 14:44 ` Marcelo Tosatti
2004-04-16 14:46 ` Marcelo Tosatti
2004-04-16 15:50 ` Trond Myklebust
2004-04-16 15:55 ` Dave Gilbert (Home)
2004-04-16 16:13 ` Trond Myklebust
2004-04-16 19:07 ` Daniel Egger
2004-04-17 4:56 ` Chris Friesen
2004-04-17 9:56 ` Daniel Egger
2004-04-17 5:24 ` Trond Myklebust
2004-04-17 14:15 ` Daniel Egger
2004-04-16 19:11 ` Charles Shannon Hendrix
2004-04-17 16:44 ` Matthias Urlichs
2004-04-17 18:15 ` Trond Myklebust
2004-04-17 18:32 ` Marc Singer
2004-04-17 18:58 ` Trond Myklebust
2004-04-17 19:01 ` Marc Singer
2004-04-17 19:09 ` Trond Myklebust
2004-04-17 19:19 ` Russell King
2004-04-18 2:51 ` Trond Myklebust
2004-04-19 16:39 ` Trond Myklebust [this message]
2004-04-19 21:10 ` Trond Myklebust
2004-04-17 22:22 ` Marc Singer
2004-04-18 0:57 ` Trond Myklebust
2004-04-18 5:01 ` Marc Singer
2004-04-18 6:36 ` Chris Friesen
2004-04-18 7:56 ` Russell King
2004-04-18 17:31 ` Marc Singer
2004-04-17 19:01 ` Daniel Egger
2004-04-17 20:22 ` Marc Singer
2004-04-18 11:14 ` Daniel Egger
2004-04-19 9:06 ` Helge Hafting
2004-04-16 9:03 ` Jamie Lokier
2004-04-16 15:55 ` Trond Myklebust
2004-04-16 18:48 ` Jamie Lokier
2004-04-16 19:06 ` Trond Myklebust
2004-04-16 19:39 ` Jamie Lokier
2004-04-17 22:32 ` Trond Myklebust
2004-04-18 3:26 ` Jamie Lokier
2004-04-18 7:03 ` Trond Myklebust
2004-04-18 23:22 ` Jamie Lokier
2004-04-19 15:38 ` Trond Myklebust
2004-04-19 16:19 ` Trond Myklebust
2004-04-20 0:09 ` Jamie Lokier
[not found] ` <20040416190126.GB408@widomaker.com>
[not found] ` <1082144608.2581.156.camel@lade.trondhjem.org>
[not found] ` <20040417000353.GA3750@widomaker.com>
2004-04-17 5:28 ` Trond Myklebust
2004-04-17 17:55 ` Charles Shannon Hendrix
2004-04-17 18:55 ` Trond Myklebust
[not found] <1Lql8-6O3-1@gated-at.bofh.it>
[not found] ` <1LquO-6TK-5@gated-at.bofh.it>
[not found] ` <1LqOg-76p-19@gated-at.bofh.it>
[not found] ` <1LrKo-7Sn-21@gated-at.bofh.it>
[not found] ` <1LtM3-12d-5@gated-at.bofh.it>
[not found] ` <1Luf2-1kK-1@gated-at.bofh.it>
[not found] ` <1LDBL-uY-3@gated-at.bofh.it>
2004-04-16 20:31 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1082392797.2559.54.camel@lade.trondhjem.org \
--to=trond.myklebust@fys.uio.no \
--cc=elf@buici.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk+lkml@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®