summaryrefslogtreecommitdiffstats
path: root/utils/mount
Commit message (Collapse)AuthorAgeFilesLines
...
* Currently the "-s" option is ignored by the text-based mount interface. ToChuck Lever2008-07-151-0/+15
| | | | | | | | | | | | notify the kernel that sloppy mount option parsing is needed, add "sloppy" to the string of mount options passed to the kernel. The 2.6.23 - 2.6.26 kernels will fail the mount if "sloppy" is present, as they won't recognize it. To prevent them from ever seeing this option, have the mount command check the kernel version before appending the option. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Clean up: add the traditional pre-processor safety check in headers underChuck Lever2008-07-158-10/+34
| | | | | | | | | | utils/mount to prevent them from being included multiple times. For headers that already have this, use a more unique macro name to reduce the probability that some other header may use the same macro. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Moved the kernel version-ing code into a new version.hChuck Lever2008-07-154-21/+55
| | | | | | | header file which allows the code to be shared Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Introduce a new DNS resolver function in utils/mount/network.c that usesChuck Lever2008-07-152-19/+61
| | | | | | | | | getaddrinfo(3), which supports AF_INET6, to resolve host names. Replace the guts of nfs_gethostbyname() with a call to the new function. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* The text-based mount command displays the rather inexplicable "mount:Chuck Lever2008-07-152-4/+10
| | | | | | | | | | | | | internal error" whenever it encounters a problem that is entirely unexpected by its designers. Let's beef that error message up to include instructions about reporting the problem, and fix the error code returned by the mount option rewriting logic so that also will no longer report "internal error". An error in there should generally only occur if there was an invalid mount option specified. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Ported the create_mtab() routine from util-linux-ng as wellChristiaan Welvaart2008-07-153-34/+86
| | | | | | | | some add_mtab() updates to better hand the instances where /etc/mtab does not exist or is not writable Signed-off-by: Christiaan Welvaart <cjw@daneel.dyndns.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* Fix error reporting when probe_bothports() fails while rewriting mountChuck Lever2008-06-062-4/+8
| | | | | | | options. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Clean up: instead of passing so many arguments to all the helpers, haveChuck Lever2008-06-061-111/+132
| | | | | | | | nfsmount_string build a data structure that contains all the arguments, and pass a pointer to that instead. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Steinar Gunderson reports:Chuck Lever2008-06-061-13/+38
| | | | | | | | | | | | | | | | | "It seems retry= is now additive with the text-based mount interface. In particular, "mount -o retry=0" still gives a two-minute timeout." Correct the bug and make retry= option parsing more robust. If parsing the retry option fails, the option is ignored and a default timeout is used. Note that currently the kernel parser ignores the "retry=" option if the value is a number. If the value contains other characters, the kernel will choke. A subsequent patch to the kernel will allow any characters as the value of the retry option (excepting of course ","). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Make the text-based mount path check whether statd is running if the "lock"Neil Brown2008-06-061-4/+27
| | | | | | | | option is in effect. This echoes similar logic in the legacy mount path. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* If mount.nfs is not installed setuid, an attempt to perform a "user"NeilBrown2008-05-081-0/+6
| | | | | | | | | | or "users" mount will fail with a fairly obscure error message, typically about getting "permission denied" from the server. This patch gives a more helpful message in that case. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* The prev_bg_host stuff made sense when NFS didn't have its own mountJeff Layton2008-05-071-14/+0
| | | | | | | | | handler. Now though, each mount.nfs invocation is really a one-shot affair, and this check no longer works. It also leaked memory. Remove it. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* The bg option is essentially ignored with nfs4 currently. nfs4mount()Jeff Layton2008-05-071-2/+8
| | | | | | | | | will never exit with EX_BG, so the mount will never be backgrounded. Fix it so that when bg is specified that we error out with EX_BG as soon as possible after the first failed mount attempt. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Currently nfs4mount() sets the retry value to 10000 on both fg and bgJeff Layton2008-05-072-5/+17
| | | | | | | | | | | | mounts. It should be 2 for fg and 10000 for bg. nfsmount() sets it properly, but there is a potential corner case. If someone explicitly sets retry=10000 on a fg mount, then it will be reset to 2. Fix this by having retry default to -1 for both flavors, and then reset if needed after the mount options have been parsed. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Change how mount.nfs handles EACCES errors. Currently,Jeff Layton2008-04-141-1/+0
| | | | | | | | | | | EACCES is a non-fatal error which means the mount will be retied. This caused mounts to hang for 2mins when the client does not have permission to access the export. In a strict interpretation, the error that should be returned is EPERM, but this is not always the case. So due to the fuzzy interpretation, of EPERM and EACCES, EACCESS is now a fatal error Signed-off-by: Steve Dickson <steved@redhat.com>
* Correct a spelling error in a mount.nfs error messageLi Yewang2008-04-091-1/+1
| | | | | Signed-off-by: Li Yewang <lyw@cn.fujitsu.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* There were 2 things wrong with auth flavour ordering:bc Wong2008-03-181-5/+8
| | | | | | | | | | | | | | | | | | | | | | - Mountd used to advertise AUTH_NULL as the first flavour on the list, which means that it prefers AUTH_NULL to anything else (as per RFC 2623 section 2.7). - Mount.nfs used to scan the returned list in reverse order, and stopping at the first AUTH_NULL or AUTH_SYS encountered. If a server advertises (AUTH_SYS, AUTH_NULL), it will by default choose AUTH_NULL and have degraded access. I've fixed mount.nfs to scan from the beginning. For mountd, it does not advertise AUTH_NULL anymore. This is necessary to avoid backward compatibility issue. If AUTH_NULL appears in the list, either the new or the old client will choose that over AUTH_SYS. Tested the server/client combination against the previous versions, as well as Solaris and FreeBSD. Signed-off-by: bc Wong <bcwong@cisco.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Recently #include directives for autoconf's config.h file were added inChuck Lever2008-03-116-2/+24
| | | | | | | | | | | | | | | | | utils/mount/error.c and utils/mount/mount.c, but appropriate HAVE_CONFIG_H checks were not added at the same time. In addition, several other .c files under utils/mount reference autoconf-generated HAVE_ macros, but don't appear to include config.h Also, Heinz-Ado Arnolds <arnolds@MPA-Garching.MPG.DE> reports that this patch is needed to ensure START_STATD is properly defined in utils/mount/network.c. Otherwise start_statd() is always a no-op, even if the configure script defines an appropriate statd start-up script. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Cc: Heinz-Ado Arnolds <arnolds@MPA-Garching.MPG.DE> Signed-off-by: Steve Dickson <steved@dickson.boston.devel.redhat.com>
* Fixed a segfault in the mount.nfs commandSteinar H. Gunderson2008-03-101-1/+1
| | | | | Signed-off-by: Steinar H. Gunderson <sgunderson@bigfoot.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* The mount(5) man page states that the noquota, quota, usrquota andSteinar H. Gunderson2008-03-101-0/+4
| | | | | | | | | | | grpquota options are ignored. (They are, however, used by the quota tools, so having them in fstab can be useful.) Make mount.nfs ignore them properly, matching the man page. There are a few aliases (like usrjquota) that are parsed by quota, but as these are not documented nor seem to be widely used, they are not included. Signed-off-by: Steinar H. Gunderson <sgunderson@bigfoot.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* As part of migrating from nfs@lists.sf.net to linux-nfs@vger.kernel.org,Chuck Lever2008-03-052-6/+0
| | | | | | | | | | | update the mailing list address used to report bugs in nfs-utils. Removed the BUGS section in the mount.nfs and umount.nfs man pages since they weren't consistent with the contents of the BUGS sections in others in nfs-utils. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Added in relatime mount option so mount.nfs staysSteve Dickson2008-01-242-1/+10
| | | | | | compatible with the mount command in util-linux-ng Signed-off-by: Steve Dickson <steved@redhat.com>
* The kernel doesn't support the underlying parts needed for changing theSteve Dickson2008-01-161-3/+0
| | | | | | | MNT program number. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* The kernel hasn't supported the underlying parts needed for changing theSteve Dickson2008-01-161-3/+0
| | | | | | | NFS program number for a very long time. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Address an inconsistency: the mount.nfs command uses the glibc routinesSteve Dickson2008-01-161-5/+7
| | | | | | | | | | | | to manipulate /etc/mtab (setmntent) but, everything else in nfs-utils uses a local private version (nfs_setmntent). The local version does some extra mangling of the mtab entries. We should check what util-linux does these days to be sure, but for now, let's make the mount.nfs command use the nfs_ variants of setmntent(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* add_mtab() calls unlock_mtab() twice in one of its error exit paths.Steve Dickson2008-01-161-1/+0
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* When mount.nfs reports that statd isn't running, it suggests using the "-oSteve Dickson2008-01-161-1/+1
| | | | | | | nolocks" option, which doesn't exist. It should say "-o nolock". Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Redress some nits in the description of the timeo optionSteve Dickson2008-01-091-9/+13
| | | | | | | in the nfs(5) man page. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Get rid of the "-i" option for mount.nfs[4] and always use the text-Steve Dickson2008-01-041-17/+4
| | | | | | | based mount(2) system call for kernel version 2.6.23 and later. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Incorporated Chuck Lever's and Don Domingo's changes to theSteve Dickson2008-01-041-485/+1208
| | | | | | | | nfs(5) manual page. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Don Domingo <ddomingo@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* When following a list of mount versions to probe -Steve Dickson2007-11-031-1/+1
| | | | | | | | | | | | | | | | | | | | e.g. probe_mnt1_first or probe_mnt3_first - probe_both will first probe the appropriate NFS version and then, if that succeeds, probe the actual mount version. However instead of probing the target mount version, it probes the "most appropriate" mount version for the given NFS version. This results in it probing: NFSv2, MOUNTv1 twice rather than NFSv2, MOUNTv1 NFSv2, MOUNTv2 as would be more correct. This patch removes the "choose most correct" step and just use the current mouint version for the probe_vers array. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* This means that if mountd is run with "--no-nfs-version 3",Steve Dickson2007-11-031-4/+0
| | | | | | | | | | | | | | | | It will first probe for NFS version 3, which will succeed (assuming the kernel supported NFSv3), then it will check the matching mountd version (3) and probe_port on discovering that isn't supported will try other versions, find "1" is supported will succeed. This leaves up using mount version 1 for an NFSv3 mount, which doesn't work and leads to a SIGSEGV There is no case where trying other versions is needed the request one is not supported, so simply remove that code. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* text-based mount.nfs: Fix po_rightmost() enum return valuesChuck Lever2007-10-122-32/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Neil observed that po_rightmost() now returns enum values from both enum { PO_NOT_FOUND = 0, PO_FOUND = 1, } and enum { PO_KEY2_RIGHTMOST = 1, PO_KEY1_RIGHTMOST = -1, } It would be cleaner to use a single enum for po_rightmost()'s return value. We take the next logical step and create specific types for the return values in order to ensure we don't mix the enum values, and to document explicitly what return values callers can expect. This could have been a simpler patch, but I think the end result is a cleaner overall parser API. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* Fix version fallback for unmount.Neil Brown2007-10-122-28/+16
| | | | | | | | | | | | | | | | Previously, if the mtab record didn't mention a version, unmount would assume a v3 umount and send an UNMOUNT request accordingly. This is wrong. So remove the 'v3' assumption, and allow probe_port to continue when it gets a version number mis-match. Also there was some overloading of the meaning of pm_vers==0 relating to v4 mounts. As do_nfs_umount is never called for v4, rename it to do_nfs_umount23, and remove v4 handling from there and from nfs_call_umount. Signed-off-by: Neil Brown <neilb@suse.de>
* Don't fail an unmount just because we couldn't contact the NFS server.Neil Brown2007-10-111-2/+1
| | | | | | | If we fail to talk to the NFS server when unmounted a v2 or v3 mount, still do the unmount, but allow the error to propagate up. Signed-off-by: Neil Brown <neilb@suse.de>
* text-based mount.nfs: Plug "fg" and "bg" processing into nfsmount_string()Chuck Lever2007-10-111-13/+13
| | | | | | | | We have all the pre-requisites now, so add "fg" and "bg" mount processing to text-based NFS mounts. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* text-based mount.nfs: Add functions to handle background mountingChuck Lever2007-10-111-0/+89
| | | | | | | | | | Add helper functions that handle background mounts; one each for foreground processing (to try the request, and determine when to fork); and one for background processing (retry the request multiple times as a forked background daemon). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* text-based mount.nfs: add function to do foreground retriesChuck Lever2007-10-111-0/+51
| | | | | | | | | | | | Make the differences between the foreground and background mount logic explicit by creating separate functions to handle each -- think of them as separate scripts for doing a foreground or a background mount. NFS foreground mounts are supposed to retry for a little while before giving up. Add a function to handle this. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* text-based mount.nfs: sort between permanent and temporary errorsChuck Lever2007-10-111-0/+21
| | | | | | | | | | | | | The text-based mount.nfs program must distinguish between different types of errors returned from the kernel. Permanent errors, like bad mount options, should cause an immediate failure. Temporary errors, such as a connection timeout, should result in a retry of some type. Add a function that sorts between the two types of errors. The list of permanent errors can be adjusted later if needed. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* text-based mount.nfs: Use helpers for invoking mount(2) system callChuck Lever2007-10-111-14/+2
| | | | | | | | Expose support for NFS version and transport protocol fallback for NFSv2/3 mounts. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* text-based mount.nfs: Implement falling back to NFSv2 and UDPChuck Lever2007-10-111-2/+64
| | | | | | | | | | | | | | | | | If the initial user-specified options fail (with EOPNOTSUPP or EPROTONOSUPPORT) then the server has rejected the requested NFS version or transport protocol. In that case, probe the server, then construct a fresh set of mount options that ask for the specific mountd and NFS version and transport protocol that the server supports. Rewrite the mount options based on the results of the probe, then try the request again. An additional kernel patch is required to cause the kernel to return EOPNOTSUPP when an rpcbind fails during a NULL request. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* text-based mount.nfs: Add rewrite_mount_options() functionChuck Lever2007-10-111-0/+130
| | | | | | | | Introduce a function for probing the server for what it supports, and then rewriting the mount options using the probe results. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* text-based mount.nfs: add a few useful parser return codesChuck Lever2007-10-112-2/+7
| | | | | | | | I forgot to add symbolic return codes for po_rightmost(). Add return codes for PO_KEY1_RIGHTMOST and PO_KEY2_RIGHTMOST. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* text-based mount.nfs: Create helpers for invoking mount(2) system callChuck Lever2007-10-091-0/+74
| | | | | | | | | | Add simple helper functions that invoke the mount(2) system call for text-based mounts. These look the same right now, but the NFSv2/v3 helper will become more complex over the following patches as we implement version and transport protocol fallback. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* text-based mount.nfs: Remove unused top level functionsChuck Lever2007-10-091-129/+0
| | | | | | | nfsmount_s() and nfs4mount_s() are no longer used, so eliminate them. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* text-based mount.nfs: combine nfsmount_s() and nfs4mount_s() pathsChuck Lever2007-10-093-10/+65
| | | | | | | | | The top-level logic that handles text-based mount options is mostly the same for NFS and NFSv4 mounts. To improve maintainability, let's combine the nfsmount_s() and nfs4mount_s() functions. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* text-based mount.nfs: refactor mandatory mount option processingChuck Lever2007-10-091-0/+23
| | | | | | | | We're about to combine nfsmount_s() and nfs4mount_s(). Refactor the version-specific mount option processing into a separate function. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* text-based mount.nfs: rename fix_up_mounthost_opt()Chuck Lever2007-10-091-4/+4
| | | | | | | Spell out _option, just like other mount-option specific functions. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* text-based mount.nfs: Fix mounthost= processingChuck Lever2007-09-291-0/+27
| | | | | | | | | | | | | | | | | | | | | The 'mounthost=' option names a host where the mountd service is running. The option is used to direct clients to use a different host for the mountd procotol than the host where the NFS service is running. The nfs(5) man page shows that the 'mounthost=' option takes a name, not an address. The kernel's text-based mount option parsing logic expects an IPv4 address. This is necessary because the kernel cannot itself resolve hostnames to addresses. Resolve the hostname and pass in a new mount option that contains the resolved address, 'mountaddr=', to the kernel. This requires a patch to the kernel to recognize the new 'mountaddr=' option, and to change the 'mounthost=' parsing logic to treat the value of this option as a simple string. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* text-based mount.nfs: Clean up helper functions that are no longer usedChuck Lever2007-09-291-99/+0
| | | | | | | | Remove older string parsing functions in the text-based mount.nfs implementation that are now no longer used. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>