Bug 1625032

Summary: [nfsd] fail to disable major NFS version 4 using "vers4=n" in /etc/nfs.conf since nfs-utils-1.3.0-0.59.el7
Product: Red Hat Enterprise Linux 7 Reporter: Yongcheng Yang <yoyang>
Component: nfs-utilsAssignee: Alice Mitchell <ajmitchell>
Status: CLOSED ERRATA QA Contact: Yongcheng Yang <yoyang>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 7.6CC: ajmitchell, jiyin, rhandlin, steved, swhiteho, xzhou
Target Milestone: rcKeywords: Patch, Regression, Reproducer
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: nfs-utils-1.3.0-0.61.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1633329 (view as bug list) Environment:
Last Closed: 2018-10-30 11:48:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1633329    
Attachments:
Description Flags
Differentiate between printing 4.0 and 4
none
Supress 4.0 flag unless kernel supports it
none
Patch the bug in the same style as upstream none

Description Yongcheng Yang 2018-09-04 03:06:35 UTC
Description of problem:

Setting "vers4=n/off" (disabling the major NFS version 4) in nfs.conf doesn't work now.

Refer to rpc.nfsd(8), "vers3/vers4" in the [nfsd] section of the /etc/nfs.conf file is to enable or disable a major NFS version 3 or 4 (which are normally enabled by default).

However, just found the "vers4=n" doesn't work since nfs-utils-1.3.0-0.59.el7 recently.


Version-Release number of selected component (if applicable):
nfs-utils-1.3.0-0.59.el7

How reproducible:
always

Steps to Reproduce:
1. echo -e "[nfsd]\n vers4=n" > /etc/nfs.conf
2. systemctl restart nfs
3. cat /proc/fs/nfsd/versions


Actual results:
[root ~]# cat /etc/nfs.conf
[nfsd]
 vers4=n
[root ~]# systemctl restart nfs
[root ~]# cat /proc/fs/nfsd/versions 
-2 +3 -4 -4.1 -4.2
[root ~]# rpm -q nfs-utils
nfs-utils-1.3.0-0.54.el7.x86_64    <<<<   good in -54.el7
[root ~]# yum update -y nfs-utils-1.3.0-0.55.el7.x86_64.rpm >/dev/null
[root ~]# rpm -q nfs-utils
nfs-utils-1.3.0-0.55.el7.x86_64    <<<<   good in -55.el7
[root ~]# systemctl restart nfs
[root ~]# echo $?
0
[root ~]# cat /proc/fs/nfsd/versions 
-2 +3 -4 -4.1 -4.2
[root ~]# yum update -y nfs-utils-1.3.0-0.57.el7.x86_64.rpm >/dev/null
[root ~]# rpm -q nfs-utils
nfs-utils-1.3.0-0.57.el7.x86_64    <<<<   good in -57.el7
[root ~]# systemctl restart nfs
[root ~]# echo $?
0
[root ~]# cat /proc/fs/nfsd/versions 
-2 +3 -4 -4.1 -4.2
[root ~]# yum update -y nfs-utils-1.3.0-0.59.el7.x86_64.rpm >/dev/null
[root ~]# rpm -q nfs-utils
nfs-utils-1.3.0-0.59.el7.x86_64
[root ~]# systemctl restart nfs
[root ~]# echo $?
0
[root ~]# cat /proc/fs/nfsd/versions 
-2 +3 +4 +4.1 +4.2
     ^^^^^^^^^^^^^^  <<<<<<  start getting failed since -59.el7
[root ~]# 
[root ~]# yum update -y nfs-utils >/dev/null
[root ~]# rpm -q nfs-utils
nfs-utils-1.3.0-0.60.el7.x86_64
[root ~]# systemctl restart nfs
[root ~]# echo $?
0
[root ~]# cat /proc/fs/nfsd/versions 
-2 +3 +4 +4.1 +4.2
     ^^^^^^^^^^^^^^  <<<<<<  still fails in the latest -60.el7


Expected results:
"vers4=n/off" in nfs.conf works


Additional info:

Looks like the RHEL8 also has this problem (i.e. Bug 1591609). However, as this function can work in rhel7.5 and starts getting failed recently, I'm just adding "Regression" for now.

Sorry for didn't report this problem earlier. I thought the kernel fix Bug 1614603 might resolve this problem. But it turns out to be not related.

Comment 5 Alice Mitchell 2018-09-14 14:28:51 UTC
Created attachment 1483344 [details]
Differentiate between printing 4.0 and 4

Found a small bug in the changes between the listed versions, the code to print out the list of versions was factored out but had a slight flaw in that when it was meant to print +4.0 it would print +4

This path seems to fix the issue:
nfs.conf: [nfsd] vers4=n
Before: -2 +3 +4 +4.1 +4.2
After: -2 +3 -4 -4.1 -4.2

Comment 6 Alice Mitchell 2018-09-14 17:28:40 UTC
Created attachment 1483380 [details]
Supress 4.0 flag unless kernel supports it

This is a better fix, it now passes through both major and minor +/-4 flags, and does not try to set 4.0 on kernels less than 4.11.0 (copied from upstream head)

Comment 8 Alice Mitchell 2018-09-19 18:28:26 UTC
The upstream already has fixes that give the same results, just implemented differently. I can submit a patch that makes them the same, but it amounts to just code simplification and not adding any features.

Comment 9 Steve Dickson 2018-09-19 18:37:53 UTC
(In reply to Justin Mitchell from comment #8)
> The upstream already has fixes that give the same results, just implemented
> differently. I can submit a patch that makes them the same, but it amounts
> to just code simplification and not adding any features.

Yes, I would like to keep upstream and rhel nfs-utils as close as
possible because it will make it easier to back port things
down the line.... What would it take to make rhel7 look the the
current upstream?

Comment 10 Alice Mitchell 2018-09-20 21:56:49 UTC
Created attachment 1485327 [details]
Patch the bug in the same style as upstream

I was wrong that this had been solved upstream, it also suffered from this case, so new upstream patch sent and new patch here which uses the same method and so stays closer to upstream.

Comment 12 Steve Dickson 2018-09-26 16:44:27 UTC
commit d68be5d6ae5086d6b4ad84507d0d14011df40aa2 
Author: Justin Mitchell <jumitche>
Date:   Wed Sep 26 10:37:17 2018 -0400

    nfs.conf: fail to disable major NFS version 4 using "vers4=n" in /etc/nfs.conf

Comment 14 Bob Handlin 2018-09-27 12:28:01 UTC
blocker+ set. RE: regression.

Comment 16 Yongcheng Yang 2018-09-28 01:38:08 UTC
Have verified this problem is fixed by nfs-utils-1.3.0-0.61.el7 now:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[root ~]# rpm -q nfs-utils
nfs-utils-1.3.0-0.60.el7.x86_64
[root ~]# cat /etc/nfs.conf
[nfsd]
 vers4=off
[root ~]# systemctl restart nfs
[root ~]# cat /proc/fs/nfsd/versions 
-2 +3 +4 +4.1 +4.2
^^^^^^^^^^^^^^^^^^ <<<<<<<<<<<<<<<<<<<<<<<<< reproduced in -60.el7
[root ~]# 
[root ~]# rpm -U nfs-utils-1.3.0-0.61.el7.x86_64.rpm 
[root ~]# rpm -q nfs-utils
nfs-utils-1.3.0-0.61.el7.x86_64
[root ~]# systemctl restart nfs
[root ~]# cat /proc/fs/nfsd/versions 
-2 +3 -4 -4.0 -4.1 -4.2
^^^^^^^^^^^^^^^^^^^^^^^^ <<<<<<<<<<<<<<<<<<< works now in -61.el7
[root ~]# echo "" > /etc/nfs.conf
[root ~]# systemctl restart nfs
[root ~]# cat /proc/fs/nfsd/versions 
-2 +3 +4 +4.1 +4.2
^^^^^^^^^^^^^^^^^^ <<<<<<<<<<<<<<<<<<<< check the default config
[root ~]# 

Moving to VERIFIED now. Thanks for it!

Comment 18 errata-xmlrpc 2018-10-30 11:48:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3311