Bug 450646
Summary: | /sbin/mount.nfs fails with read-only /etc | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 5 | Reporter: | Istvan Marko <istvan+rhbugs> | ||||||
Component: | nfs-utils | Assignee: | Steve Dickson <steved> | ||||||
Status: | CLOSED ERRATA | QA Contact: | |||||||
Severity: | medium | Docs Contact: | |||||||
Priority: | low | ||||||||
Version: | 5.2 | CC: | bmr, cward, jscotka, ondrejv, pasteur, tao | ||||||
Target Milestone: | rc | ||||||||
Target Release: | --- | ||||||||
Hardware: | All | ||||||||
OS: | Linux | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2009-09-02 10:03:19 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: | 457524 | ||||||||
Attachments: |
|
Description
Istvan Marko
2008-06-10 05:57:03 UTC
I can reproduce this as well. The problem is at line 541 of utils/mount/mount.c: if (!nomtab) { add_mtab(spec, mount_point, nfs_mount_vers == 4 ? "nfs4" : "nfs", flags, extra_opts, 0, 0); } It should probably read somehing like if (!nomtab && mtab_is_writable()) { add_mtab(spec, mount_point, nfs_mount_vers == 4 ? "nfs4" : "nfs", flags, extra_opts, 0, 0); } Created attachment 319735 [details]
Patch against mount.c which resolves the problem.
Hi,
Please find the attached patch which resolves my problem.
I have verified it and it works OK.
Can this go into the mainstream?
Thanks.
Ondrej
The patch doesn't seem unreasonable to me, although I wonder if it's better to place the call to mtab_is_writable() inside add_mtab(), as this would be more in keeping with what is currently done for update_mtab() in support/nfs/fstab.c: update_mtab (const char *dir, nfs_mntent_t *instead) { mntFILE *mfp, *mftmp; const char *fnam = MOUNTED; struct mntentchn mtabhead; /* dummy */ struct mntentchn *mc, *mc0, *absent = NULL; if (mtab_does_not_exist() || !mtab_is_writable()) return; I.e. make the check on the mtab file inside the routine that updates it, rather than in each caller of that function. Well yes, you are right. But if you want to do it this way I would do it cleanly in 2 steps: 1. remove the condition "if(!nomtab)" from mount.c so that add_mtab is called every time (even when -n option is passed) 2. add this: if (nomtab || !mtab_is_writable()) return; in the add_mtab function. This way it would look more like the update_mtab_entry() from mount.c in the util-linux package which is providing the /bin/mount command. But essentially you are right - your solution would do as well. Agreed - I think this would be the best approach. It keeps things consistent with other parts of the code & seems more logical/clean to me. Created attachment 322880 [details]
Patch for RO /etc/mtab
Fixed in nfs-utils-1.0.9-42.el5 ~~ Attention - RHEL 5.4 Beta Released! ~~ RHEL 5.4 Beta has been released! There should be a fix present in the Beta release that addresses this particular request. Please test and report back results here, at your earliest convenience. RHEL 5.4 General Availability release is just around the corner! If you encounter any issues while testing Beta, please describe the issues you have encountered and set the bug into NEED_INFO. If you encounter new issues, please clone this bug to open a new issue and request it be reviewed for inclusion in RHEL 5.4 or a later update, if it is not of urgent severity. Please do not flip the bug status to VERIFIED. Only post your verification results, and if available, update Verified field with the appropriate value. Questions can be posted to this bug or your customer or partner representative. I can confirm that nfs-utils-1.0.9-42 package shipped in RHEL 5.4 Beta fixes this issue (tested with both nfs and nfs4). 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/RHSA-2009-1321.html |