Bug 959211 - mount.nfs fails when using SLE12-SP1 kernel
mount.nfs fails when using SLE12-SP1 kernel
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Basesystem
Other Other
: P5 - None : Normal (vote)
: ---
Assigned To: Neil Brown
E-mail List
Depends on:
  Show dependency treegraph
Reported: 2015-12-15 17:09 UTC by Takashi Iwai
Modified: 2016-02-18 06:05 UTC (History)
2 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Takashi Iwai 2015-12-15 17:09:25 UTC
I booted SLE12-SP1 kernel on TW system for checking NFS bugs, then I noticed that mount.nfs fails like:

% mount dist.suse.de:/dist /dist
mount.nfs: an incorrect mount option was specified

The strace shows that it gets EINVAL from mount syscall.
  mount("dist.suse.de:/dist", "/dist", "nfs", MS_RDONLY, "vers=4.2,addr=,clien"...) = -1 EINVAL (Invalid argument)

I know SLE12-SP1 kernel is no supported kernel for TW, but it's still inconvenient and looks buggy to me.
Comment 1 Neil Brown 2015-12-15 22:29:39 UTC
Certainly looks like a bug somewhere.
The "MS_READONLY" looks a bit odd.

Can you run the 'strace' with '-s 200' or similar so we get all of the mount options?
I'll try my self at some stage....
Comment 2 Takashi Iwai 2015-12-16 07:07:04 UTC
(In reply to Neil Brown from comment #1)
> Certainly looks like a bug somewhere.
> The "MS_READONLY" looks a bit odd.

It's likely because I invoked with -r option, sorry for confusion.  But the result is same no matter whether with or without -r option.
> Can you run the 'strace' with '-s 200' or similar so we get all of the mount
> options?

  mount("dist.suse.de:/dist", "/dist", "nfs", 0, "vers=4.2,addr=,clientaddr=") = -1 EINVAL (Invalid argument)

It seems that SLE12-SP1 kernel doesn't support NFS 4.2 while mount.nfs tries to use it?
Comment 3 Takashi Iwai 2015-12-16 16:23:31 UTC
I confirmed that the latest Linus tree shows the same problem when built without CONFIG_NFS_V4_2.

Without CONFIG_NFS_V4_2, the kernel returns -EINVAL when vers=4.2 is passed (which is default).  Meanwhile, mount.nfs has a fallback mechanism in nfs_autonegotiate(), but it happens only when EPROTONOSUPPORT is returned.

So, a hackish kernel patch like below makes the fallback working:

--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -187,7 +187,7 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
 		goto error;
 	if (cl_init->minorversion > NFS4_MAX_MINOR_VERSION) {
-		err = -EINVAL;
+		err = -EPROTONOSUPPORT; /* let mount.nfs negotiate */
 		goto error;

But it might be better to fix nfs-utils side instead.
Comment 4 Neil Brown 2016-02-18 06:05:14 UTC
This has been fixed upstream and in Base:System

It should flow through in due course.