summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* nfs-utils: Update rpc.idmap and nfsidmap man pagesSteve Dickson2016-08-202-0/+32
| | | | | | | | Describe how the NFSv4 domain name can be now be found using the _nfsv4idmapdomain DNS TXT record Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: fail nfsd.export lookup for path to unmounted exportpointNeilBrown2016-08-031-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an export point should be mounted ("mountpoint" option set) but isn't, then an attempt to mount using the MOUNT protocol for NFSv3 will fail and an attempt to access the filesystem using a pre-existing filehandle will block because nfsd_fh wont tell the kernel about it. However a lookup from the parent, as happens with an NFSv4 mount request, will pass the name to nfsd_export(), and it doesn't check the mointpoint option, and so exports the underlying (typically "/") filesystem. So change nfsd_export() to refused to export that exportpoint, but instead to explictly say that it isn't exported. This will cause an 'ls' in the parent pseudo-root directory to not show the name and will cause a "mount" attempt which walks down through the pseudo root to fail in the same way that it does with NFSv3. An access from a pre-existing NFSv4 mount will still hang until the filesystem is mounted, just like it does with NFSv3. In order to be a bit more responsive to the filesystem getting mounted, just a short timeout (1 minutes) on exports of missing "mountpoint" exportpoints. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: allow alternate ttl to be specified for dump_to_cache.NeilBrown2016-08-031-8/+12
| | | | | | | | The default will not always be best. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount: fix memory leak in v4root_add_parentsNeilBrown2016-08-031-3/+3
| | | | | | | | If pseudofs_update failed, we weren't freeing 'path'. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount: use a public address for IPv6 callback.NeilBrown2016-08-031-0/+5
| | | | | | | | | | | | If IPv6 address privacy is active, the "clientaddr" given to the server will likely be a temporary address which will eventually expire, thus breaking callback. So ask for a public address to ensure continued service. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount: don't treat temporary name resolution failure as permanentNeilBrown2016-08-031-23/+31
| | | | | | | | | | | | | | | | | | If getaddrinfo() returns EAI_AGAIN, we shouldn't just give up, but should continue normal retries as the nameserver may be unavailable for the same reason as the NFS server. So move the getaddrinfo() call from nfs_validate_options() into nfs_try_mount() which is always called soon after, except in the 'remount' case when we don't want it anyway. If EAI_AGAIN is returned, set errno to EAGAIN and allow this to be a temporary failure. Otherwise report error and set errno to EALREADY so no further message is given. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: remove the --exports-file optionNeilBrown2016-08-034-21/+5
| | | | | | | | It is completely ineffective. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs.man: clarify effect of 'retry' optionNeilBrown2016-08-031-2/+12
| | | | | | | | | | | | | | | | | | | | | The total timeout for a "mount" attempt to a non-responsive server will always be a multiple of the time a single mount attempt in the kernel takes, which for TCP defaults to about 4 minutes. The documentation for the "retry" option seems to suggest that this can be used to set a maximum but it really sets a time after which to stop retrying. The total can be as much as "retry" plus the time for a single attempt. So clarify the documentation a bit, and also note that retrans defaults are different for UDP and TCP: #define NFS_DEF_UDP_RETRANS (3) #define NFS_DEF_TCP_RETRANS (2) Reported-by: Howard Guo<hguo@suse.com> Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* blkmapd: unlink pid file when error outKinglong Mee2016-07-201-4/+4
| | | | | | | Fix some error out without unlink pid file. Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* blkmapd: Let running correctly when pid file existsKinglong Mee2016-07-201-7/+1
| | | | | | | | Blkmapd cannot run until blkmapd.pid is unlinked. This patch lets checking exists based on lockf without stat. Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Gssd: Avoid compiling warning and simplify codesKinglong Mee2016-07-201-8/+8
| | | | | | | | krb5_util.c: In function gssd_acquire_user_cred: krb5_util.c:1389:4: warning: this if clause does not guard... Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: fix export point checkingJianhong Yin2016-07-181-2/+2
| | | | | | | | NFS does not support file and symbolic export, if the export point is regular file should give warning to user. Signed-off-by: Jianhong Yin <jiyin@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs(5): Add lease management security considerationsChuck Lever2016-07-181-3/+56
| | | | | | | | | | | | | | | | | | | | Several years ago, the kernel Linux NFS client was changed to attempt to use strong security for lease management operations that are shared by all NFSv4 mounts of a server on that client. This forces the client to use a consistent security flavor and principal for lease management, even across reboots, to ensure that state recovery works, independent of what mounts have been done, what order they were done, and with what sec= option. The use of krb5i for lease management does not affect the flavor used for RPCs done on behalf of individual users, but sometimes it means krb5i is used for certain operations even when "sec=sys" is specified. This has occasionally been surprising. Link: https://bugzilla.redhat.com/show_bug.cgi?id=1334510 Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* start-statd: Use flock to serialize the running of this scriptSteve Dickson2016-06-211-0/+4
| | | | | | | | To once and for all stop multiple rpc.statd from being started (mostly in HA environments), use flock to serialize the running of the script Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: fix a typo in the manpageYongcheng Yang2016-06-211-1/+1
| | | | | | Turned "nfsdcltack" into "nfsdcltrack" Signed-off-by: Steve Dickson <steved@redhat.com>
* statd: suppress a benign log message in nsm_delete_host()Scott Mayhew2016-06-213-10/+13
| | | | | | | | | | | | | | | | | | Commit 76f8ce8c (statd: Update existing record if we receive SM_MON with new cookie) added some logic to unconditionally delete some existing on-disk monitor records. That works fine in an HA-NFS setup where there's a good chance of monitor files being left around after service failovers, but in the case where there isn't an existing monitor file statd emits a scary looking message like this: Jun 15 14:14:59 hostname rpc.statd[1368]: Failed to delete: could not stat original file /var/lib/nfs/statd/sm/nfs.smayhew.test: No such file or directory That message can be suppressed. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: added the -h optionSteve Dickson2016-06-082-3/+9
| | | | | | | Use the correct exit code when an invalid option use or the -h option. Signed-off-by: Steve Dickson <steved@redhat.com>
* umount: fixed typo in usage messageSteve Dickson2016-06-071-1/+1
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: added usage output when no arguemnts are givenSteve Dickson2016-06-071-0/+2
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: cleaned up usage message.Steve Dickson2016-05-201-1/+1
| | | | | | Fixed the -H and --ha-callout usage message Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Convert 'rdma' to 'tcp' protocolChuck Lever2016-05-161-0/+16
| | | | | | | | | | | | | | | | | | | | | The kernel NFS client specifies 'rdma' as the transport protocol for NFS/RDMA mounts. This is a generic display token, probably not something the kernel should lie about. The kernel uses it to form NFSv4 client IDs, for example. Until gssd can speak RPC-over-RDMA, convert 'rdma' to 'tcp' in kernel gss upcalls. This means that the Linux NFS client requires an NFS/TCP service on an NFS/RDMA server when establishing a GSS context for proto=rdma mount points. This is probably not an onerous requirement for the time being. Eventually user space support for RPC-over-RDMA might be introduced, and gssd can use that for context establishment. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* blkmapd: Add the -h flag on the man pageYongcheng Yang2016-05-141-1/+4
| | | | | | | Update SYNOPSIS and OPTIONS for the -h flag. Signed-off-by: Yongcheng Yang <yongcheng.yang@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: no longer needed pid logicOlga Kornievskaia2016-05-141-6/+1
| | | | | | | with threads, we don't need to distinguish zero uid. Signed-off-by: Olga Kornievskaia <kolga@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: move read of upcall into main threadOlga Kornievskaia2016-05-143-83/+96
| | | | | | | | | | This patch moves reading of the upcall information from the child thread into the main thread. It removes the need to synchronize between the parent and child thread before processing upcall. Also it creates the thread in a detached state. Signed-off-by: Olga Kornievskaia <kolga@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: replace one xlog(D_GENERAL) in host_canonname()Scott Mayhew2016-05-021-1/+1
| | | | | | | | | | If we fall back to using the numeric host then we shouldn't call xlog with D_GENERAL. That can cause 'exportfs -u' to exit with a 1 if, for example, you have exports using ip addresses that can't be resolved to hostnames. Use D_PARSE instead. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: add the debug optionScott Mayhew2016-05-022-2/+8
| | | | | | | | | Since calling xlog(D_GENERAL) will cause exportfs to exit with a status of 1, there really should be a way to see those messages for debugging purposes. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* systemd unit files: fix up dependencies on rpcbind.NeilBrown2016-05-022-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dependencies on rpcbind have been changed a few times and I think they are still wrong. So I'll go into some detail to justify this change. Firstly: rpcbind.target rpcbind.socket or rpcbind.service? The systemd documentation talks about targets as "synchronization points" and likens them to SysV init run levels. Run levels are about ordering but not dependencies. The systemd.special man page describes rpcbind.target as intended explicitly for ordering sysvinit scripts, with "After=" dependencies. So while I think it is valid to use rpcbind.target for ordering (before/after) it shouldn't be used for dependencies (Wants/Requires). The rpcbind.target file included in systemd does not "Require" the actual service, so requiring rpcbind.target itself is pointless. I think we shouldn't use rpcbind.target at all. Leave it for sysvinit synchronization. So: .socket or .service? I think nfs only needs the socket to be active. On first connection the service will be started. But nfs does not need to wait for the service to start, only the socket. So I think we should exclusively use rpcbind.socket. Next: Wants or Requires. rpc.statd definitely Requires rpcbind. It needs to register to be useful, and without rpcbind it cannot register. nfs-server does not necesarily require rpcbind. Specifically if configured for NFSv4 only, nfs-server will work quite happily without rpcbind. Someone with an NFSv4 only setup who wants rpcbind to not run can use systemctl mask rpcbind.socket to ensure it never runs. So nfs-server should only "Wants: rpcbind.socket". I think Commit: 4fabfcd08206 ("systemd: Decouple the starting and stopping of rpcbind/nfs-server") should have changed "Requires" to "Wants" rather than "server" to "target" to fix the dependency problem. Finally: After? It only makes sense to declare an ordering relation as "After:" something that will actually be started. If "foo.service" is not part of the systemd transaction, then "After: foo.service" has no effect. So having: Requires: rpcbind.target After: rpcbind.socket doesn't make much sense unless there is some relationship between rpcbind.target and rpcbind.socket, and there is no general guarantee of that (though what individual distros do, I don't know). So the "After" should match the "Wants" or "Requires". It might make sense to Requires: rpcbind.socket After: rpcbind.target as it is reasonable to assume that rpcbind.target will be ordered with rpcbind.socket, but as we can use rpcbind.socket explictly, that is clearer. So my conclusion is that nfs-server should: Wants: rpcbind.socket After: rpcbind.socket and rpc-statd should Requires: rpcbind.socket After: rpcbind.socket which is what this patch puts into effect. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: always call gss_krb5_ccache_nameOlga Kornievskaia2016-04-294-61/+19
| | | | | | | | | | | Previously the location of the credential cache was passed in either using environment variable KRB5CCNAME or gss_krb5_ccache_name() if supported. For threaded-gssd, we can't use an environment variable as it's shared among all thread. Thus always use the api call. Reviewed-by: Steve Dickson <steved@redhat.com> Signed-off-by: Olga Kornievskaia <kolga@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: using syscalls directly to change thread's identityOlga Kornievskaia2016-04-291-10/+9
| | | | | | | | | | | For the threaded version we have to set uid,gid per thread instead of per process. glibc setresuid() when called from a thread, it'll send a signal to all other threads to synchronize the uid in all other threads. To bypass this, we have to call syscall() directly. Reviewed-by: Jeff Layton <jlayton@poochiereds.net> Reviewed-by: Steve Dickson <steved@redhat.com> Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
* 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>