Bug 77042 - No way of forcing nfs localhost mounts - they always use bind
No way of forcing nfs localhost mounts - they always use bind
Status: CLOSED CANTFIX
Product: Red Hat Linux
Classification: Retired
Component: autofs (Show other bugs)
8.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Nalin Dahyabhai
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-10-31 05:23 EST by lee.essen
Modified: 2007-04-18 12:48 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-10-18 12:50:26 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description lee.essen 2002-10-31 05:23:43 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.1b) Gecko/20020721

Description of problem:
The "mount --bind" option does not support the concept of having a read-only
copy, so NFS mounting localhost is the only way to acheive this.

Unfortunately autofs (mount_nfs.so) checks to see if a mount is local and then
uses the bind option if it is.

Below is a sample patch file to adjust this behaviour so that if the hostname is
"localhost" then it's taken to mean force an NFS mount rather than using bind.

Background: I have an area which gets rsync'd onto my machine (so I need it to
be writeable), but I want to present it to users as read only in general use as
a reminder that it's not the authoritative source. 

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Create an autofs map with an entry like:  fred  -fstype=nfs  localhost:/usr/local
2. cd to the automount point (to get it mounted)
3. check the type of mount using "mount".
	

Actual Results:  You will see that the mount is done using the "bind" option.

Expected Results:  (my preferred approach)

The mount should have been completed using NFS, in that way any NFS specific
parameters to the mount command will be honoured (i.e. ro)

Additional info:

A simple patch file to do this is attached here (cut and paste may screw up the
space/tab arrangement, but it's simple enough to redo).

--- autofs-3.1.7/modules/mount_nfs.c    2002-10-31 09:26:47.000000000 +0000
+++ autofs-3.1.7/modules/mount_nfs.c    2002-10-31 09:29:06.000000000 +0000
@@ -107,6 +107,8 @@
               name, hostname);
        return 1;                       /* No such host */
       }
+      if( strcmp( hostname, "localhost" ) != 0 ) {
+       /* take this as an explicit request not to do "bind" */

       /* Probe to see if we are the local host.  Open a UDP socket and see
         if the local address is the same as the remote one */
@@ -138,6 +140,7 @@
          break;
        }
       }
+      } /* end of the localhost check */

       if ( paren )
        *paren = '(';
Comment 1 Bill Nottingham 2006-08-07 15:32:20 EDT
Red Hat Linux is no longer supported by Red Hat, Inc. If you are still
running Red Hat Linux, you are strongly advised to upgrade to a
current Fedora Core release or Red Hat Enterprise Linux or comparable.
Some information on which option may be right for you is available at
http://www.redhat.com/rhel/migrate/redhatlinux/.

Red Hat apologizes that these issues have not been resolved yet. We do
want to make sure that no important bugs slip through the cracks.
Please check if this issue is still present in a current Fedora Core
release. If so, please change the product and version to match, and
check the box indicating that the requested information has been
provided. Note that any bug still open against Red Hat Linux on will be
closed as 'CANTFIX' on September 30, 2006. Thanks again for your help.
Comment 2 Bill Nottingham 2006-10-18 12:50:26 EDT
Red Hat Linux is no longer supported by Red Hat, Inc. If you are still
running Red Hat Linux, you are strongly advised to upgrade to a
current Fedora Core release or Red Hat Enterprise Linux or comparable.
Some information on which option may be right for you is available at
http://www.redhat.com/rhel/migrate/redhatlinux/.

Closing as CANTFIX.

Note You need to log in before you can comment on or make changes to this bug.