nfsroot will not remount rw and claims illegal options
Subsystems (2)
Quoted 19 lines · On Sun, 2009-10-04 at 17:48 +0000, bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGk…
http://bugzilla.kernel.org/show_bug.cgi?id=14276
--- Comment #6 from Hans de Bruin <bruinjm-qWit8jRvyhVmR6Xm/[email protected]> 2009-10-04 17:48:57 ---
hans@orion:/var/diskless/kernel/linux-2.6$ git bisect bad 53a0b9c4c99ab0085a06421f71592722e5b3fd5f is first bad commit commit 53a0b9c4c99ab0085a06421f71592722e5b3fd5f Author: Chuck Lever <[email protected]> Date: Sun Aug 9 15:09:36 2009 -0400NFS: Replace
nfs_parse_ip_address()withrpc_pton()Clean up: Use the common routine now provided in sunrpc.ko for parsing
mount
addresses.
Quoted 6 lines
Signed-off-by Chuck Lever <[email protected]>Signed-off-by Trond Myklebust <[email protected]>:040000 040000
31c3998309b2c325b7ea927498e1a7e78e0e7747513edbc936111eda9d1646db17e7240c77a32c42M fs
hans@orion:/var/diskless/kernel/linux-2.6$
OK. Switching over to email.
Chuck, can you see how the rpc_pton() might be breaking nfsroot? The cmdline is of the form
root=/dev/nfs nfsroot=10.10.0.2:/nfs/gemini,v3,tcp ro ip=::::::dhcp
Cheers
Trond
Quoted 4 lines · Trond Myklebust
Chuck, can you see how the
rpc_pton()might be breaking nfsroot? The cmdline is of the formroot=/dev/nfs nfsroot=10.10.0.2:/nfs/gemini,v3,tcp ro ip=::::::dhcp
I think I see it...
The difference is that rpc_pton4() starts with
memset(sap, 0, sizeof(struct sockaddr_in));
That clears the port number that was set in nfs_remount(), and so the comparison in nfs_compare_remount_data() fails.
Does the following patch fix the problem?
--------------------------------------------------------------------------
NFS: Fix port initialisation in nfs_remount()
From: Trond Myklebust <[email protected]>
The recent changeset 53a0b9c4c99ab0085a06421f71592722e5b3fd5f (NFS: Replace nfs_parse_ip_address() with rpc_pton()) broke nfs_remount, since the call to rpc_pton() will zero out the port number in data->nfs_server.address.
This is actually due to a bug in nfs_remount: it should be looking at the port number in nfs_server.port instead...
---
fs/nfs/super.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
fs/nfs/super.c +4 -2
@@ -1846,9 +1846,10 @@ nfs_compare_remount_data(struct nfs_server *nfss, data->acdirmin != nfss->acdirmin /HZ || data->acdirmax != nfss->acdirmax /HZ || data->timeo != (10U * nfss->client->cl_timeout->to_initval /HZ ) || + data->nfs_server.port != nfss->port || data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || -memcmp (&data->nfs_server.address, &nfss->nfs_client->cl_addr, - data->nfs_server.addrlen) != 0) + !rpc_cmp_addr (&data->nfs_server.address, + &nfss->nfs_client->cl_addr)) return -EINVAL;return 0 ;
@@ -1891,6 +1892,7 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data) data->acdirmin = nfss->acdirmin /HZ ; data->acdirmax = nfss->acdirmax /HZ ; data->timeo =10U * nfss->client->cl_timeout->to_initval /HZ ; + data->nfs_server.port = nfss->port; data->nfs_server.addrlen = nfss->nfs_client->cl_addrlen;memcpy (&data->nfs_server.address, &nfss->nfs_client->cl_addr, data->nfs_server.addrlen);
Chuck Lever
Acked-byQuoted 22 lines · Trond Myklebust
Quoted 5 lines · Trond Myklebust
Chuck, can you see how the
rpc_pton()might be breaking nfsroot? The cmdline is of the formroot=/dev/nfs nfsroot=10.10.0.2:/nfs/gemini,v3,tcp roip=::::::dhcp
I think I see it...
The difference is that
rpc_pton4()starts withmemset(sap, 0, sizeof(struct sockaddr_in));That clears the port number that was set in
nfs_remount(), and so the comparison innfs_compare_remount_data()fails.Does the following patch fix the problem?
--------------------------------------------------------------------------
NFS: Fix port initialisation innfs_remount()
From: Trond Myklebust <[email protected]>
Quoted 7 lines
The recent changeset
53a0b9c4c99ab0085a06421f71592722e5b3fd5f(NFS: Replacenfs_parse_ip_address()withrpc_pton()) brokenfs_remount, since the call torpc_pton()will zero out the port number in data-Quoted 1 line
nfs_server.address.
This is actually due to a bug in
nfs_remount: it should be looking at the port number in nfs_server.port instead...
The analysis sounds correct. After the options are parsed, nfs_server.port is the port number the user specified on the command line. The user-specified value is saved separately because later the socket address's port number can be changed via an rpcbind.
In the case of a remount, if the port value isn't changed by the new options, the client needs to know what the originally specified value was.
Quoted 1 line
Signed-off-by Trond Myklebust <[email protected]>
I don't know if this will address the presenting problem, but yes, nfs_remount() is definitely not correct.
Quoted 36 lines
---
fs/nfs/super.c| 6 ++++--1 files changed, 4 insertions(+), 2 deletions(-)fs/nfs/super.c +0
-0@@ -1846,9 +1846,10 @@ nfs_compare_remount_data(struct nfs_server *nfss, data->acdirmin != nfss->acdirmin /HZ || data->acdirmax != nfss->acdirmax /HZ || data->timeo != (10U * nfss->client->cl_timeout->to_initval /HZ) ||
fs/nfs/super.c +1
-0+ data->nfs_server.port != nfss->port ||data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen ||fs/nfs/super.c +2
-2-memcmp (&data->nfs_server.address, &nfss->nfs_client->cl_addr, - data->nfs_server.addrlen) != 0) + !rpc_cmp_addr (&data->nfs_server.address, + &nfss->nfs_client->cl_addr))return -EINVAL; return 0;fs/nfs/super.c +1
-0@@ -1891,6 +1892,7 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data) data->acdirmin = nfss->acdirmin /HZ ; data->acdirmax = nfss->acdirmax /HZ ; data->timeo =10U * nfss->client->cl_timeout->to_initval /HZ ; + data->nfs_server.port = nfss->port; data->nfs_server.addrlen = nfss->nfs_client->cl_addrlen; memcpy(&data->nfs_server.address, &nfss->nfs_client->cl_addr,data->nfs_server.addrlen);
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com