summaryrefslogtreecommitdiffstats
path: root/utils/mount
Commit message (Collapse)AuthorAgeFilesLines
...
* mount options can be lost when using bg optionHarshula Jayasuriya2009-11-162-2/+8
| | | | | | | | | | | | | | | | | | 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. See https://bugzilla.redhat.com/show_bug.cgi?id=529370 for details. Signed-off-by: Harshula Jayasuriya <harshula@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Assume v2/v3 if mount-related options are presentChuck Lever2009-11-161-0/+12
| | | | | | | | Don't try NFSv4 if any MNT protocol related options were presented by the user. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount: Fix po_join() call site in nfs_try_mount_v4()Chuck Lever2009-11-031-1/+2
| | | | | | | Make sure the copied options string is freed in case po_join() fails. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Assume v2/v3 if mount-related options are presentChuck Lever2009-11-031-14/+35
| | | | | | | | Don't try NFSv4 if any MNT protocol related options were presented by the user. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Made some aesthetic changes to the code that setsSteve Dickson2009-11-032-8/+10
| | | | | | the defaults that were a result of the code review. Signed-off-by: Steve Dickson <steved@redhat.com>
* Retry v4 mounts with a v3 mount when the versionSteve Dickson2009-11-031-2/+9
| | | | | | | | is not explicitly specified and the mount fails with ENOENT. The will help deal with Linux servers that do not automatically export a pseudo root Signed-off-by: Steve Dickson <steved@redhat.com>
* Added wrappers around the setting of default valuesSteve Dickson2009-10-272-15/+45
| | | | | | | from the config file which will be compiled out when the config file is not enabled. Signed-off-by: Steve Dickson <steved@redhat.com>
* Added the defaultproto and defaultvers variable to the mountSteve Dickson2009-10-221-4/+18
| | | | | | configuration file. Signed-off-by: Steve Dickson <steved@redhat.com>
* Use the default protocol and version values, when theySteve Dickson2009-10-222-3/+22
| | | | | | | are set in the configuration file, to start the negation with the server Signed-off-by: Steve Dickson <steved@redhat.com>
* Introducing the parsing of both 'defaultvers' and 'defaultproto'Steve Dickson2009-10-223-2/+59
| | | | | | | | | | | config variables which will be used to set the the default version and network protocol. A global variable will be set for each option with the corresponding value. The value will be used as the initial value in the server negation. Signed-off-by: Steve Dickson <steved@redhat.com>
* Make sure all protocol version options are checked in check_vers()Steve Dickson2009-10-091-3/+1
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* Make the network transports value in the mountSteve Dickson2009-10-091-3/+4
| | | | | | | config file case sensitive, since they are in the mount command's parsing code. Signed-off-by: Steve Dickson <steved@redhat.com>
* There are a number of different mount options that can beSteve Dickson2009-10-091-0/+20
| | | | | | | | used to set the protocol version on the command line. The config file code needs to know about each option so the command line value will override the config file value. Signed-off-by: Steve Dickson <steved@redhat.com>
* mount: Support negotiation between v4, v3, and v2Chuck Lever2009-09-291-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When negotiating between v3 and v2, mount.nfs first tries v3, then v2. Take the same approach for v4: try v4 first, then v3, then v2, in order to get the highest NFS version both the client and server support. No MNT request is needed for v4. Since we want to avoid an rpcbind query for the v4 attempt, just go straight for mount(2) without a MNT request or rpcbind negotiation first. If the server reports that v4 is not supported, try lower versions. The decisions made by the fg/bg retry loop have nothing to do with version negotation. To avoid a layering violation, mount.nfs's multi-version negotiation strategy is wholly encapsulated within nfs_try_mount(). Thus, code duplication between nfsmount_fg(), nfsmount_parent(), and nfsmount_child() is avoided. For now, negotiating version 4 is supported only on kernels that can handle the vers=4 option on type "nfs" file systems. At some point we could also allow mount.nfs to switch to an "nfs4" file system in this case. Since mi->version == 0 can now mean v2, v3, or v4, limit the versions tried for RDMA mounts. Today, only version 3 supports RDMA. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* The user's mount options and the set of versions to try should notChuck Lever2009-09-291-24/+106
| | | | | | | | | | | | | | | | | | | change over the course of mount retries. With this patch, each version-specific mount attempt is compartment- alized, and starts from the user's original mount options each time. Thus these attempts can now be safely performed in any order, depending on what the user has requested, what the server advertises, and what is up and running at any given point. Don't regress the fix in commit 23c1a452. For v2/v3 negotation, only the user's mount options are written to /etc/mtab, and not any options that were negotiated by mount.nfs. There's no way to guarantee that the server configuration will be the same at umount time as it was at mount time. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Keep server's address in nfsmount_infoChuck Lever2009-09-291-6/+7
| | | | | | | | We want to pass the server's address around. Put it in the mount context structure. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Add API to duplicate a mount option listChuck Lever2009-09-292-0/+66
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Support "-t nfs,vers=4" mounts in the kernelChuck Lever2009-09-144-7/+22
| | | | | | | | | | | | | | Support "vers=4" in nfs_nfs_version() Skip UMNT call for "-t nfs -o vers=4" mounts For "-t nfs -o vers=4" mounts, we want to skip v2/v3 version/transport negotiation, but be sure to append the "clientaddr" option. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com> Tested-by: Steve Dickson <steved@redhat.com>
* Cleaned up some warnings in the mount config file code.Steve Dickson2009-08-271-0/+2
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* Cleaned up parsing errors to hopeful be more preciseSteve Dickson2009-08-172-4/+5
| | | | | | | Also had mount_config_init() call xlog_open() so the program name is set on xlog() calls. Signed-off-by: Steve Dickson <steved@redhat.com>
* Now that only the Section names are case-insensitiveSteve Dickson2009-08-161-3/+6
| | | | | | | | | the mount code has to make sure the the mount options given to the kernel are in the correct case. Fixed a couple of warnings on #ifndefs Signed-off-by: Steve Dickson <steved@redhat.com>
* The example nfsmount.conf fileSteve Dickson2009-08-162-0/+121
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* The new nfsmount.conf(5) man page and the update toSteve Dickson2009-08-163-0/+95
| | | | | | the nfs(5) man page Signed-off-by: Steve Dickson <steved@redhat.com>
* Added hooks to the mount command that allowSteve Dickson2009-08-163-1/+56
| | | | | | mount options to be set in a configuration file Signed-off-by: Steve Dickson <steved@redhat.com>
* Support routines used to read sections from the configuration fileSteve Dickson2009-08-162-0/+321
| | | | | | and parse them into comma separated mount options. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs(5): Remove trailing blanksChuck Lever2009-08-161-131/+130
| | | | | | | Clean up: eliminate trailing blanks in utils/mount/nfs.man. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs(5): Add description of lookupcache mount optionChuck Lever2009-08-161-0/+96
| | | | | | | See kernel commit 7973c1f1. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* errno not be set on RPC errorsSteve Dickson2009-07-152-6/+16
| | | | | | | | | | | | Changed both nfs_advise_umount() and nfs_gp_ping() to set the errno by calling CLNT_GETERR() after a CLNT_CALL() error. Also added code to rpc_strerror() that will log the errno value, when set, via strerror(). These changes added essential information to the error message making it much easier to detect errorsuch as "Connection refused" Signed-off-by: Steve Dickson <steved@redhat.com>
* Don't use initialized garbage for address lengthsSteve Dickson2009-07-151-2/+2
| | | | | | | | | | Make sure address lengths are initialized before call calling nfs_extract_server_addresses() from nfs_rewrite_pmap_mount_options(). Otherwise the length check in nfs_string_to_sockaddr() can fail since its will be using garbage from the stack. Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Squelch compiler warnings in nfs_strerror()Chuck Lever2009-07-142-7/+7
| | | | | | | | | | | Address compiler warnings: error.c: In function nfs_strerror: error.c:341: warning: comparison between signed and unsigned error.c:342: warning: comparison between signed and unsigned Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Squelch unused parameter warnings on empty functionsChuck Lever2009-07-142-3/+4
| | | | | | | | | | | | | Address compiler warnings: fstab.c:288: warning: unused parameter sig parse_dev.c:186: warning: unused parameter dev parse_dev.c:187: warning: unused parameter hostname parse_dev.c:187: warning: unused parameter pathname Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Fix compiler warning in stropts.cChuck Lever2009-07-141-2/+4
| | | | | | | | | | Address compiler warning: stropts.c: In function ¿nfs_append_generic_address_option¿: stropts.c:138: warning: comparison between signed and unsigned Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* umount.nfs: Use correct data type in nfsumount()Chuck Lever2009-07-141-1/+1
| | | | | | | | | | | | | Address compiler warning: nfsumount.c: In function nfsumount: nfsumount.c:347: warning: comparison between signed and unsigned The result type of pointer arithmetic and the return type of strlen(3) are both size_t. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: remove unused @addrlen argument from nfs_string_to_sockaddr()Chuck Lever2009-07-143-9/+5
| | | | | | | | | | Address compiler warning: network.c: In function nfs_string_to_sockaddr: network.c:272: warning: unused parameter addrlen Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Remove unused @salen parameter from nfs_ca_gai()Chuck Lever2009-07-141-2/+2
| | | | | | | | | Address compiler warning: network.c:1124: warning: unused parameter salen Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Fix some nfs_error() nits in network.cChuck Lever2009-07-141-3/+4
| | | | | | | Fix a couple of nfs_error() call sites in utils/mount/network.c. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Remove unused parameter in try_mount()Chuck Lever2009-07-141-3/+3
| | | | | | | | | | Address compiler warning: mount.c: At top level: mount.c:420: warning: unused parameter nomtab Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Use correct data type in discover_nfs_mount_data_version()Chuck Lever2009-07-141-1/+1
| | | | | | | | | | | | | | | | | Address compiler warning: mount.c: In function discover_nfs_mount_data_version¿: mount.c:162: warning: comparison between signed and unsigned mount.c:164: warning: comparison between signed and unsigned mount.c:166: warning: comparison between signed and unsigned mount.c:168: warning: comparison between signed and unsigned mount.c:170: warning: comparison between signed and unsigned mount.c:178: warning: comparison between signed and unsigned linux_version_code() and MAKE_VERSION() both return an unsigned int. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* support: Introduce sockaddr helpers to get and set IP port numbersChuck Lever2009-07-141-15/+0
| | | | | | | | | | Introduce address family-agnostic functions that get and set IP port numbers in socket addresses. We can already replace a few similar functions in the mount command, and a few more will come up with statd and sm-notify. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Don't update extra_opts after text-based negotiationChuck Lever2009-07-141-5/+14
| | | | | | | | | The umount.nfs command will negotiate the mount options again, so all that is needed in /etc/mnttab is the original set of options used for the mount, plus the additional mandatory options like addr=''. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Clean up after restructuring version/protocol negotiationChuck Lever2009-07-141-132/+25
| | | | | | | | | | Fix up comments and function names to reflect the new version/protocol negotiation scheme. We can now remove a bunch of mount processing that is specific to v2/v3, removing about 100 lines of logic from stropts.c. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Clean up nfs_is_permanent_error()Chuck Lever2009-07-141-20/+25
| | | | | | | | | Clean up: Move nfs_is_permanent_error() closer to the functions that call it, and update a documenting comment to reflect recent restructuring in this area. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: rearchitect mount version/protocol negotiation logicChuck Lever2009-07-141-17/+25
| | | | | | | | | | | | | | | | | | | | Text-based mounts try a mount operation first with default settings, then negotiate via rpcbind queries and retry the mount, if the default settings don't work. This method introduces long delays in certain common scenarios, and makes it difficult to tell when it is appropriate to fail immediately or negotiate and retry. To address these behavioral regressions, make text-based mounts operate the same way that legacy mounts work. Perform rpcbind queries with short timeouts first, then use the results to determine transport, version, and port number settings for the mount. This allows the mount.nfs command to detect server settings, or whether negotiation is even possible, quickly. It also makes it simple to determine when to fail vs. when to retry. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: make nfs_options2pmap return errorsChuck Lever2009-07-144-102/+227
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up until now, nfs_options2pmap() has been passed mount options that have already gone through the kernel's parser successfully. So, it never had to check for invalid mount option values. However, we are about to pass it options that come right from the user. So nfs_options2pmap() will now need to report an error and fail if it encounters a bogus value for any of the options it cares about. ===== Note that nfs_options2pmap() will allow a bogus value for an option if the same option is specified farther to the right with a useable value. For example, if a user specifies "proto=foo,...,tcp" then nfs_options2pmap() uses "tcp" and ignores "proto=foo". However, if the options are specified in the other order: "tcp,...,proto=foo" then nfs_options2pmap() will fail. This is a simple and unambiguous extension of the "rightmost wins" rule. Since mount.nfs strips out these options out and replaces them with the rpcbind-negotiated options before invoking mount(2), the kernel should never receive bogus values for these options from mount.nfs in such cases. This is probably slightly more flexible behavior than the legacy mount implementation, but should be harmless. All mount options unrelated to pmap are ignored by nfs_options2pmap(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: force rpcbind queries if options aren't specifiedChuck Lever2009-07-141-7/+11
| | | | | | | | | | | | | | | | | nfs_options2pmap() fills in default values if the passed-in mount options don't specify values. This short-circuits the version, port, and transport negotiation logic in nfs_probe_bothports(). Instead, nfs_options2pmap() should plant zeros in these pmap fields to force nfs_probe_bothports() and nfs_advise_mount() to discover, via rpcbind queries, what the server supports. This fixes some scenarios where umount.nfs fails to connect to servers that don't have all rpcbind ports open, in addition to fixing other corner cases during mount.nfs version/protocol negotiation. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: If port= specifies an unregistered port, retry, then failChuck Lever2009-07-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suppose a port= option is specified on the mount command line, but not enough other mount options are specified to avoid an rpcbind query to discover the NFS service. If the NFS service isn't registered on [100003, 3, "tcp", port] (even if the server is listening on the specified port), the legacy mount.nfs command fails immediately with: mount.nfs: mount to NFS server 'server' failed: RPC Error: Success What's more, this mount request should succeeded if an NFS service is registered on the specified port for another version and/or protocol. So instead, let's retry the rpcbind query with the other versions and transport protocols to be absolutely sure that port won't work with either version or transport. Then, if all fails, report: mount.nfs: mount to NFS server 'server' failed: RPC Error: Program not registered This change also affects text-based mounts that require negotiation by the mount.nfs command. Note that if the mount options specify all four pmap parameters for NFS, the rpcbind query for the NFS service is skipped entirely. The mount command then hangs and times out later if NFS service is not listening on the requested tuple. This is unchanged from previous behavior. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Add more debugging output around nfs_getport()Chuck Lever2009-07-141-4/+24
| | | | | | | | | So we can see how rpcbind queries are failing during mount processing, add some debugging messages (enabled with "mount.nfs -v") around the nfs_getport() calls. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* getport: Clear shared error fields before trying rpcbind queriesChuck Lever2009-07-141-2/+1
| | | | | | | | | Some RPC errors set fields in rpc_createerr.cf_error in addition to cf_stat. Be sure to clear _all_ error fields in rpc_createerr each time through the rpcbind API. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* umount.nfs: Harden umount.nfs error reportingChuck Lever2009-05-182-13/+23
| | | | | | | | | | Add additional error reporting to nfs_advise_umount(). These messages can be displayed if the "-v" option is specified with umount.nfs. Normally these messages do not appear. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount: remove legacy version of nfs_name_to_address()Chuck Lever2009-05-184-81/+28
| | | | | | | | | | | | | | | | | | | | | | | Currently we have two separate copies of nfs_name_to_address() since some older glibc's don't define AI_ADDRCONFIG. This means extra work to build- and run-test both functions when code is changed in this area. It is also the case that gethostbyname(3) is deprecated, and should not be used in new code. Remove the legacy code in favor of always using getaddrinfo(3). We can also get rid of nfs_name_to_address()'s @family argument as well. Note also this addresses a bug in nfsumount.c -- it was calling nfs_name_to_address() with AF_UNSPEC unconditionally, even if the legacy version of nfs_name_to_address(), which doesn't support AF_UNSPEC, was in use. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>