summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* gssd: use pthreads to handle upcallsOlga Kornievskaia2016-04-297-37/+87
| | | | | | | | | | | Currently, to persevere global data over multiple mounts, the root process does not fork when handling an upcall. Instead on not-forking create a pthread to handle the upcall since global data can be shared among threads. Reviewed-by: Jeff Layton <jlayton@poochiereds.net> Signed-off-by: Olga Kornievskaia <kolga@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Remove rpcsecgss library supportSteve Dickson2016-04-293-34/+5
| | | | | | | | | librpcsecgss has not been used in years so and there is no longer an upstream for it so the support for the library has been removed Signed-off-by: Steve Dickson <steved@redhat.com>
* mount: run START_STATD fully as rootNeilBrown2016-04-271-1/+4
| | | | | | | | | | | | | | | | | | | | | | | If a "user" mount is the first NFSv3 mount, mount.nfs will be running setuid to root (with non-root as the real-uid) when it executes START_STATD. start-statd is a shell script and many shells refuse to run setuid, dropping privileges immediately. This results in start-statd running as an unprivileged user and so statd fails to start. To fix this, call "setuid(0)" to set real uid to zero. Also call "setgid(0)" for consistency. The behaviour of a shell can often be affected by the environment, such as the "shell functions" that bash includes from the environment. To avoid the user being able to pass such environment to the shell, explicitly pass an empty environment. The start-statd script explicitly sets the PATH which is all it really needs. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* fix building w/newer C librariesMike Frysinger2016-04-274-0/+9
| | | | | | | | | | | | | | Linux C libraries are moving away from implicitly including the header sys/sysmacros.h via sys/types.h. We would like to do this for glibc now, but others (musl/etc...) have been doing it already. This means any code using major/minor/makedevs functions will fail to build when they don't include that header. Leverage the AC_HEADER_MAJOR macro that configure is already using to pull in the right header. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: skip server address resolution on remountBenjamin Coddington2016-04-271-11/+20
| | | | | | | | | | | | A remount might fail if name resolution returns a different server address, as might occur if there are multiple name records for the server. Since we cannot change the server's address on a remount anyway, skip the lookup and remove any set addresses in the options. Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Move nfs-utils_env.sh to a more appropriate directorySteve Dickson2016-04-272-2/+2
| | | | | | | | | Currently nfs-utils_env.sh is installed in a directory that is own by systemd. They requested via https://bugzilla.redhat.com/show_bug.cgi?id=1303113 to move the script into /usr/libexec/nfs-utils Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: ignore pipe directories that do not existSteve Dickson2016-03-191-2/+3
| | | | | | | | | | | | | Back when commit aba5ea5c and commit 55197c98 happen that replaced dnotify with inotify the ignoring of non-existent upcall directories got dropped. The patch adds it back and stops following error log ERROR: inotify_add_watch failed for nfs/clntXX: No such file or directory Signed-off-by: Steve Dickson <steved@redhat.com>
* systemd: ensure nfs-config service is re-run as needed.NeilBrown2016-03-161-1/+5
| | | | | | | | | | | | | | | | | | The nfs-config service translates distro-specific startup configuration into "environment" variable read and used by systemd unit files. Currently it is only run once, so subsequent changes to the distro-specific files do not take effect when an nfs service is restarted. If we change "RemainAfterExit=yes" to "RemainAfterExit=no" then the service will be restarted before any dependant service is started, so the environment file will always be up to date. Reported-and-tested-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd.man: Update to change -P option as an alias for -pYongcheng Yang2016-03-161-4/+1
| | | | | | | From: Yongcheng Yang <yongcheng.yang@gmail.com> Signed-off-by: Yongcheng Yang <yongcheng.yang@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* statd: Don't unregister statd service on failing to execute calloutToshiaki Makita2016-03-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | statd calls atexit(statd_unregister) to unregister statd service on exit, which actually has a side-effect that ha_callout() unregisters statd service even when the child callout process exits on execl() failure. Certain clustering software's deployment script adds -H option with its specified file non-existent, when it is configured not to use callout. In other words, -H seems to be used no matter if callout is needed or not, but when callout is unnecessary, the specified callout program is not deployed. This causes statd not to work once a lock is requested by its NFS client, as execl() in ha_callout() results in ENOENT and exit() of the child process calls exit-handler statd_unregister(). Eventually, the NFS client gets stuck with messages "lockd: cannot monitor xxx" on the NFS server. Also, execl() could fail for other reasons like ENFILE or EIO as well. A forked child must not unregister the statd RPC server, so use _exit(), which does not call any exit-handlers, instead of exit(). Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Fix inner-loop variable reuseBenjamin Coddington2016-03-161-3/+3
| | | | | | | | | | The var "i" is already in use iterating realmnames. Fixes: "6597e391 gssd: Don't assume the machine account will be in uppercase" Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: fix missing brace in host_ntop() fallbackStefan Hajnoczi2016-03-161-1/+1
| | | | | | | | | An if statement has been missing a brace since host_ntop() was added in commit 94ce1eb94babb4c587b2826452fb053cba745098 ("libexport.a: Add helpers to manage DNS lookups"). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs - hide EBUSY errorsNeilBrown2016-03-161-0/+9
| | | | | | | | | | | | | | | | | | | | Linux only returns EBUSY for a non-remount mount if the exact requested filesystem is already mounted. Arguably this is not an error. "mount -a" tries to see if each requested filesystem is already mounted. Sometimes it gets it wrong - e.g. hostname aliases can confuse it. So "mount -a" will report a failure "already mounted", which is wrong because it should filter those out. An easy fix it just to be silent about EBUSY. As the requested result (a given filesystem being mounted at a given location) is in effect after the EBUSY return, we can just treat it as success. This removes the confusing "already mounted" errors. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmapd: allow the usage message to be displayedSteve Dickson2016-03-161-1/+1
| | | | | | | | | xlog_err() never returns. Change the xlog_err(), when invalid arguments are use, to xlog_warn() so the second xlog_warn, displaying the usage, will be called. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmapd: Let verbose determent whether stderr logging should be doneSteve Dickson2016-03-161-1/+1
| | | | | | | Use the verbose command flag to turn on or off logging to stderr. Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Corrected some types in the debugging codeSteve Dickson2016-03-081-2/+2
| | | | | | | Change some debugging levels in populate_port() to make easier to follow the code. Signed-off-by: Steve Dickson <steved@redhat.com>
* krb5_use_machine_creds: Fixed the format of some debugging messagesSteve Dickson2016-03-071-6/+7
| | | | | | | commit 1201d5d8 introduced some new debugging messages that needed some formatting Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsd: use correct byte order on rdma portSteve Dickson2016-03-011-1/+1
| | | | | | | | | | The returned port from getservbyname() is in network order. Convert the port to host order before writing it to the portlist file. Reported-by: Chuck Lever <chuck.lever@oracle.com> Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* blkmapd: Added a usage routineSteve Dickson2016-01-201-2/+12
| | | | | | | Show the correct arguments when invalid arguments are used. Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.idmapd: Added the -h flagSteve Dickson2016-01-202-2/+8
| | | | | | | In general the -h flag should at least show a usage message Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: print an error message when no versions are specifiedSteve Dickson2016-01-201-2/+3
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: added missing argument to usage stringSteve Dickson2016-01-201-2/+3
| | | | | | | The "-r | --reverse-lookup" arguments were missing from the usage string. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs_connect_nb: handle EINTR during connection establishmentOlga Kornievskaia2016-01-161-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | both connect() and select() can receive EINTR signals that we need to recover from. In Unix Network Programming, volume 1, section 5.9, W. Richard Stevens states: What we are doing [?] is restarting the interrupted system call ourself. This is fine for accept, along with the functions such as read, write, select and open. But there is one function that we cannot restart ourself: connect. If this function returns EINTR, we cannot call it again, as doing so will return an immediate error. When connect is interrupted by a caught signal and is not automatically restarted, we must call select to wait for the connection to complete, Thus for connect() treat both EINPROGRESS and EINTR the same -- call select(). For select(), it should be re-tried again upon receiving EINTR. Signed-off-by: Olga Kornievskaia <kolga@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsstat: show client rpc information correctlyKinglong Mee2016-01-161-3/+2
| | | | | | | | | | | | | | There are 59 client rpc procedures, not 60. The order of rpc name must be the same as define of NFSPROC4_CLNT_xx in include/linux/nfs4.h, not nfs4_procedures in nfs4xdr.c. Drop duplicate rpc name "getdevlist". Reviewed-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Set right error after getaddrinfo failsRinku Kothiya2016-01-161-2/+2
| | | | | | | URL: https://bugzilla.redhat.com/show_bug.cgi?id=1287468 Signed-off-by: Rinku Kothiya <rkothiya@redhat.com> Signed-off-by: Mohit Agrawal <moagrawa@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* start-statd: don't run multiple rpc.statds on the one host.NeilBrown2016-01-161-0/+8
| | | | | | | | | | | | | | If rpc.statd is running but slow to respond, mount.nfs will run "start-statd" which might start a new statd. This is not a good ideas as can result in lots of rpc.statds. So inf start-statd check the pid file and if rpc.statd seems to be running, exit with success. (also "cd /" before running rpc.statd, just in case). Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: trust the exit status of "start_statd".NeilBrown2016-01-161-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If DNS service is particularly slow, nfs_probe_statd() can fail even though rpc.statd is actually running. This happens because rpc.statd is single threaded and could be waiting longer for DNS than nfs_probe_statd() will wait for it. This causes problems when mount.nfs uses nfs_probe_statd() to see if statd is running, as is needed for NFSv3. Currently in these circumstances there are two possible outcomes. 1/ if systemd is in use, it will be told to start rpc-statd, which is already running so no change. mount.nfs will try pinging rpc.statd a few more times and could eventually give up and fail the mount. While slow DNS may well result in slow service, it shouldn't cause a mount attempt to fail. 2/ if systemd is not in use, a new rpc.statd will be started. This can (and has) lead to a large number of rpc.statd processes running on the one machine. This patch addresses the first scenario. If START_STATD is run and exits with a success status, mount.nfs assumes statd is running and allows the mount to succeed. A separate patch will address the other scenario. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Fix protocol minor version fall-backTakashi Iwai2016-01-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | mount.nfs currently expects mount(2) to fail with EPROTONOSUPPORT if the kernel doesn't understand the requested NFS version. Unfortunately if the requested minor is not known to the kernel it returns -EINVAL. In kernels since 3.11 this can happen in nfs4_alloc_client(), if compiled without NFS_V4_2. More generally it can happen in in nfs_validate_text_mount_data() when nfs_parse_mount_options() returns 0 because nfs_parse_version_string() didn't recognise the version. EPROTONOSUPPORT is only returned if NFSv4 support is completely compiled out. So nfs_autonegotiate needs to check for EINVAL as well as EPROTONOSUPPORT. URL: https://bugzilla.opensuse.org/show_bug.cgi?id=959211 Reported-by: Takashi Iwai <tiwai@suse.com> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Fix uninitialised variable usage in nfs_options2pmapAndreas Schwab2016-01-161-1/+4
| | | | | | | | | | | | | | | | | | Commit 5bea22e33b7a introduced a regression. Prior to that commit nfs_nfs_version would set *version to 0 if NFS version wasn't specified. Since that commit, version.v_mode is set to V_DEFAULT if the NFS version isn't specified, but nfs_options2pmap uses version.major without checking v_mode. This can lead to incorrect behaviour. In particular fall-ack to v3 if server doesn't support v4 can fail. So test v_mode before using version.major. URL: https://bugzilla.opensuse.org/show_bug.cgi?id=956743 Fixes: 5bea22e33b7a ("mount.nfs: Add struct nfs_version and generalize version parsing") Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: fix netgroup lookup for short hostnamesFrank Sorenson2015-12-161-10/+7
| | | | | | | | | | | | Commit 9a92ef6f to add netgroup lookup of resolvable IP addresses inadvertently broke the netgroup check for short hostnames. This patch fixes that breakage by changing the IP address lookup to use a separate variable. Signed-off-by: Frank Sorenson <sorenson@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountstats: add missing v4.2 operationsScott Mayhew2015-12-111-1/+8
| | | | | Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountstats: handle KeyError in accumulate_iostats()Scott Mayhew2015-12-111-1/+4
| | | | | | | | | | | | | | | | | | | | | This will prevent a backtrace like this from occurring in 'mountstats nfsstat' if a new NFSv4 operation is added to the kernel but not to the Nfsv4ops list in mountstats.py: Traceback (most recent call last): File "/sbin/mountstats", line 988, in <module> res = main() File "/sbin/mountstats", line 977, in main return args.func(args) File "/sbin/mountstats", line 792, in nfsstat_command v4stats.accumulate_iostats(acc_stats) File "/sbin/mountstats", line 566, in accumulate_iostats self.__rpc_data[op] = list(map(add, self.__rpc_data[op], new_stats.__rpc_data[op])) KeyError: 'SEEK' Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsstat: update nfs server operationsBenjamin Coddington2015-12-111-1/+14
| | | | | Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsstat: update nfs client operationsBenjamin Coddington2015-12-111-11/+23
| | | | | | | | | FSID_PRESENT was missing, and LAYOUTGET and GETDEVICEINFO were switched. Update all the client operations. Also, increase the output width a bit and pull out a column for these longer new operation names. Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.idmapd: Added the -C and -S flagsSteve Dickson2015-12-111-1/+3
| | | | | | | The C and S flags were missing for the SYNOPSIS Signed-off-by: Steve Dickson <steved@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.idmapd: Added a usage routineSteve Dickson2015-12-111-2/+10
| | | | | | | Show the correct arguments when invalid arguments are used. Signed-off-by: Steve Dickson <steved@redhat.com>
* statd: make statd_canonical_name return the presentation address if it maps ↵Scott Mayhew2015-12-111-4/+1
| | | | | | | | | | | | | | | | | | | | to an empty Certain name resolution misconfigurations (for example, a hosts file entry with an ip address but no hostnames) can cause get_nameinfo() to return an empty string in buf, which will lead to this cryptic failure: Dec 7 09:37:44 hostname rpc.statd[8024]: Failed to insert: creating /var/lib/nfs/statd/sm/: Is a directory Dec 7 09:37:44 hostname rpc.statd[8024]: STAT_FAIL to hostname.example.com for SM_MON of 192.168.1.2 Dec 7 09:37:44 hostname kernel: lockd: cannot monitor 192.168.1.2 It's better in that case to just go ahead and use the presentation address instead. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: Deal with path's trailing "/" in unexportfs_parsed()Yongcheng Yang2015-12-111-1/+10
| | | | | | | | | | | When unexport directory, it's possible that the specified path ends with a '/'. So we need to deal with it to find the matched entry. If not, there will be error like "Could not find '*:/some_path/' to unexport." Signed-off-by: Yongcheng Yang <yongcheng.yang@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: fix null pointer derefernce in nfs_parse_simple_hostnameVivek Trivedi2015-12-111-1/+2
| | | | | | | | | In function nfs_parse_simple_hostname, hostname can be NULL, dereferncing it while passing it to free(*hostname) may result in segfault. Signed-off-by: Vivek Trivedi <t.vivek@samsung.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libnsm.a: do not close file if open failedVivek Trivedi2015-12-112-2/+4
| | | | | | | | If file open failed, no need to issue close system call in nsm_get_state and closeall. Signed-off-by: Vivek Trivedi <t.vivek@samsung.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: keyring_clear() should succeed if id_resolver keyring not foundChuck Lever2015-12-111-4/+9
| | | | | | | | | | | | | | If the id_resolver keyring doesn't exist, the kernel has no cached idmap information to expunge. AFAIK it's not an error. If nfsidmap is run by a non-privileged user, the id_resolver keyring is never visible. IMO that should be reported, but the error message should report the privilege problem, not the missing keyring. Reported-by: Amy Shi <amy.shi@oracle.com> Fixes: 69aa69e7de80 ('nfsidmap: Allow keys to be cleared from the ') Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* statd: Update existing record if we receive SM_MON with new cookieScott Mayhew2015-11-231-13/+27
| | | | | | | | | | This prevents rpc.statd's in-memory (and on-disk) monitor lists from winding up with multiple records for the same peer with outdated cookie values. This happens in some HA-NFS configurations where rpc.statd is always running. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Teach mount.nfs about the mountversion optionSteve Dickson2015-11-211-1/+6
| | | | | | | | | | When the mountversion option is used, there should not be any mount negotiations with the server. Also, when the option is used, its know that the mount is a v4 mount and a V_SPECFIC type. Signed-off-by: Steve Dickson <steved@redhat.com>
* svc_create.c: Make sure errors are loggedSteve Dickson2015-11-202-10/+13
| | | | | | | | To help debug rpcbind failures, make sure all errors are logged and log as much info about the error as possible. Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: reworked second level of debuggingSteve Dickson2015-11-165-13/+13
| | | | | | | Trimmed down the number messages being logged by moving them into level 3 or 4 of debugging Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: log all fatal errorsSteve Dickson2015-11-163-8/+8
| | | | | | When gssd exist ensure a error message is logged. Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: reworked first level of debuggingSteve Dickson2015-11-162-21/+19
| | | | | | | Cleaned up first level of debugging. Only errors and warnings are logged. Signed-off-by: Steve Dickson <steved@redhat.com>
* systemd: Decouple the starting and stopping of rpcbind/nfs-serverSteve Dickson2015-11-162-2/+2
| | | | | | | | | | | | Commit b98f2af15 introduced a regression that cause the starting and stop of rpcbind and the nfs-server to be depended on each other The starting of the NFS server should start rpcbind but bring rpcbind down should not bring the NFS server down. Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: Fix buf size in test_export() dump()Jianhong Yin2015-11-041-5/+8
| | | | | | | | | | From: Jianhong Yin <jiyin@redhat.com> The buf[] size in test_export() is not enough for NFS_MAXPATHLEN + prefix/suffix proto string. Fix it and same issue in dump(). And just to be on the safe side, %s/sprintf/snprintf/ Signed-off-by: Steve Dickson <steved@redhat.com>
* mydaemon.c: Removed a warningSteve Dickson2015-11-041-0/+1
| | | | | | | | Commit 273b4647 introduced the following warning: mydaemon.c:125:2: warning: implicit declaration of function 'closelog' [-Wimplicit-function-declaration] Signed-off-by: Steve Dickson <steved@redhat.com>