Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 529370

Summary: NFS mount options can be lost when using bg option
Product: Red Hat Enterprise Linux 5 Reporter: Harshula Jayasuriya <harshula>
Component: nfs-utilsAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact: yanfu,wang <yanwang>
Severity: high Docs Contact:
Priority: urgent    
Version: 5.3CC: Colin.Simpson, jlayton, jwest, pep, rwheeler, syeghiay, tao, tom, yugzhang
Target Milestone: rcKeywords: Patch, ZStream
Target Release: 5.5   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-13 23:49:03 UTC Type: ---
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: 502912, 614491, 644221, 644222    
Attachments:
Description Flags
nfs-utils-preserve-mount-options-when-backgrounding.patch:Patch to fix the problem for NFSv3
none
nfs-utils-nfsv4-fix-backgrounding.patch: 2nd patch to address NFSv4. none

Description Harshula Jayasuriya 2009-10-16 12:35:09 UTC
Description of problem:

When mounting an NFS export *without* the "bg" option, try_mount() is called only once. Before calling it, the variables mount_opts and extra_opts are set up. Then try_mount() calls nfsmount(), the latter assumes that the aforementioned variables can be modified. Most significantly, it allows the variable extra_opts to be modified.

When the "bg" mount option is used *and* the first try_mount() attempt fails, it daemonizes the process and calls try_mount() again, unfortunately, we've lost the required mount options in the variable extra_opts.

Version-Release number of selected component (if applicable):
* nfs-utils-1.0.9-42.el5

How reproducible:
* Always

Steps to Reproduce:
1. Stop the NFS server's networking so that the NFS client can not reach it.
2. On the NFS client run something like: mount -v -t nfs -o rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0,noac <nfs-server>:<nfs-export> <mountpoint>
3. Wait till the initial try_mount() fails and the process is daemonized.
4. Start the NFS server's networking so the NFS client can reach it.
5. Wait till the NFS export is mounted and then cat /proc/mounts

Actual results:
* <nfs-server>:<nfs-export> <mountpoint> nfs rw,vers=3,rsize=32768,wsize=32768,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=<nfs-server> 0 0

Expected results:
* <nfs-server>:<nfs-export> <mountpoint> nfs rw,sync,vers=3,rsize=32768,wsize=32768,acregmin=0,acregmax=0,acdirmin=0,acdirmax=0,hard,noac,proto=tcp,timeo=600,retrans=2,sec=sys,addr=<nfs-server> 0 0

Additional info:
* A quick look at the upstream code shows it has the same problem.
* I have only looked at NFSv3. I'll test NFSv4 and report back.

Comment 1 Harshula Jayasuriya 2009-10-16 12:38:31 UTC
Created attachment 365046 [details]
nfs-utils-preserve-mount-options-when-backgrounding.patch:Patch to fix the problem for NFSv3

Comment 2 Harshula Jayasuriya 2009-10-20 14:27:57 UTC
I tested the "bg" option with NFSv4. nfs4mount.c needs to be patched for it to properly support backgrounding.

Comment 3 Harshula Jayasuriya 2009-10-20 14:29:01 UTC
Created attachment 365358 [details]
nfs-utils-nfsv4-fix-backgrounding.patch: 2nd patch to address NFSv4.

Comment 8 Issue Tracker 2009-12-30 10:51:39 UTC
Event posted on 2009-12-30 10:51 GMT by sprabhu

We had a different variation of this problem reported. A quick check with
the test packages confirm that the problem has been fixed.

In fstab, if we nfs mount options are written as  ‘rw,hard,intr,bg’,
background mount does not work if NFS server is not available. However, if
mount options are written as “rw,bg,hard,intr’, background mount works
properly.



Issue escalated to RHEL 5 Storage by: sprabhu.
Internal Status set to 'Waiting on Engineering'

This event sent from IssueTracker by sprabhu 
 issue 356672

Comment 13 Tamas Vincze 2010-06-17 18:54:07 UTC
NFSv4 backgrounding doesn't work at all for me.
Kernel: 2.6.18-194.3.1.el5xen (running as a guest under Xen)
nfs-utils-1.0.9-44.el5
nfs-utils-lib-1.0.8-7.6.el5

/etc/fstab entry:
files:/pub     /pub      nfs4    bg,intr     0 0

If the server is also in the middle of the boot process (it's another VM on the same machine) then I get this on the client:

Jun 16 22:00:54 ha mount[1579]: mount to NFS server 'files' failed: System Error: Connection refused (giving up).

It shouldn't give it up as the "bg" option is present.

Comment 14 Harshula Jayasuriya 2010-06-18 01:01:45 UTC
Hi Tamas,

Can you please test the patched nfs-utils package:
http://people.redhat.com/hjayasur/it343729/

Regards,
Harshula

Comment 24 Steve Dickson 2010-07-14 14:01:02 UTC
Fixed in nfs-utils-1.0.9-46.el5

Comment 26 Harshula Jayasuriya 2010-07-30 17:24:51 UTC
Pep noticed in BZ 614491, that only one of the two patches was added to the 5.5.z build. I just had a look at the 5.6 build, it has the same problem.

Comment 27 Steve Dickson 2010-08-02 13:38:19 UTC
I just updated nfs-utils-1.0.9-47.el5 to contain both patches
The build is at: https://brewweb.devel.redhat.com/taskinfo?taskID=2645581

Comment 29 Jeff Layton 2010-10-06 16:17:07 UTC
*** Bug 572293 has been marked as a duplicate of this bug. ***

Comment 36 errata-xmlrpc 2011-01-13 23:49:03 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0125.html