summaryrefslogtreecommitdiffstats
path: root/utils
Commit message (Collapse)AuthorAgeFilesLines
* rpc.statd: Avoid passing unregistered socket to svc_getreqsetCarlos O'Donell2015-02-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rpc.statd may crash if it receives both a notification reply and a client connection at the same time. It crashes because it adds sockfd to SVC_FDSET and that violates the API contract. The SVC_FDSET is to be considered read-only and must not be modified by user code. The daemon modifies it for expediency to avoid having to maintain two distinct fd lists and select on each one. It is a practical choice that makes sense. Thus, if a notification reply arrives by itself everything works, or if a client connection arrives by itself everything works. Both must arrive at the same time for sockfd to be set in SVC_FDSET and to be processed by svc_getreqset because more than one of readfds is ready. It is the processing by svc_getreqset that will crash when it finds an unregistered fd in the list that doesn't correlate to any of the internal book keeping done by the library. At present the glibc SunRPC library will crash, but TIRPC does not (it is robust against invalid API usage in this case). However, future RPC libraries may be implemented differently, and the questionable API usage should be fixed. The simplest fix is for process_reply to *clear* sockfd from the ready-to-read fds, since it was never registered with xprt_register. This works because the code always calls process_reply before handing the fd set to the RPC layer for processing. Compile-tested on x86_64 against master. Signed-off-by: Carlos O'Donell <carlos@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exports.man: improve documentation of 'nohide' and 'crossmnt'NeilBrown2015-02-261-6/+36
| | | | | | | | | - note that 'nohide' is irrelevant for NFSv4 - note that children on a 'crossmnt' filesystem cannot be unexported - note that 'nocrossmnt' is a valid option, but probably not useful. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: fix next_mnt handling for "/"NeilBrown2015-02-261-1/+1
| | | | | | | | | | | | If the (exported) path passed to next_mnt() is simply "/", next_mnt() will not report any children, as none start with "/" followed by a '/'. So make a special case for strlen(p)==1. In that case, return all children. This gives correct handling if only "/" is exported. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* statd: Fix test for foreground modeChris Mayo2015-02-011-1/+1
| | | | | | | | daemon_init parameter has the opposite sense to code removed in commit 7addf9d Signed-off-by: Chris Mayo <aklhfex@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - simplify handle_gssd_upcallDavid Hardeman2015-01-231-68/+38
| | | | | | | | Stumbled across this function, just had to simplify it. No mallocs necessary, one quick loop to find the parameters. Much simpler. Signed-off-by: David Hardeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - improve inotifyDavid Hardeman2015-01-232-52/+116
| | | | | | | | | | Make full use of inotify by not rescanning the whole tree on each change, instead keep track of the inotify events and make sure that the minimum work (scan/create/delete) clients is done in most cases. Still detect anomalies and perform a full rescan in those cases. Signed-off-by: David Hardeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - further shorten some pathnamesDavid Hardeman2015-01-231-9/+7
| | | | | | | Save some more memory by using relative pathnames. Signed-off-by: David Hardeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - change dnotify to inotifyDavid Hardeman2015-01-232-30/+73
| | | | | | | | | This is just the first step, replacing dnotify with an inotify implementation that is not much better (still does a complete rescan of the whole rpc_pipefs tree on each change). Signed-off-by: David Hardeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - cleanup read_service_infoDavid Hardeman2015-01-231-98/+110
| | | | | | | | | There's a lot of fixed buffers in use here. Clean up the code and add more documentation on the different formats that have been used by the kernel. Signed-off-by: David Hardeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - simplify client scanningDavid Hardeman2015-01-231-91/+80
| | | | | | | | Simplify the code responsible for the client dir scanning. This is also in preparation for the inotify patches. Signed-off-by: David Hardeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - simplify topdir scanningDavid Hardeman2015-01-232-92/+81
| | | | | | | | Simplify and refactor the code that does the topdir scanning, this is in preparation for the inotify patches. Signed-off-by: David H?rdeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - use more relative pathsDavid Hardeman2015-01-233-41/+40
| | | | | | | | Using more relative paths saves memory and lets us get rid of more PATH_MAX fixed arrays. Signed-off-by: David Hardeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - keep the rpc_pipefs dir openDavid Hardeman2015-01-231-49/+37
| | | | | | | | Keep the rpc_pipefs dir open and just do a rewind/rescan when necessary. Signed-off-by: David Hardeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - make the client lists per-topdirDavid Hardeman2015-01-232-73/+66
| | | | | | | | This makes it easier to keep track of which client belongs to which topdir. Signed-off-by: David Hardeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - remove "close me" codeDavid Hardeman2015-01-232-20/+8
| | | | | | | | This code is mostly just confusing. Close the fds immediately instead of doing so later. Signed-off-by: David Hardeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - use libeventDavid Hardeman2015-01-233-266/+138
| | | | | | | | Using libevent (which is already in use in idmap) saves about a hundred lines of hand-rolled event loop code. Signed-off-by: David Hardeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - move over pipfs scanning codeDavid Hardeman2015-01-234-563/+566
| | | | | | | | Move all rpc_pipefs scanning code from gssd_proc.c to gssd.c in preparation for later patches. Signed-off-by: David Hardeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - simplify topdirs pathDavid Hardeman2015-01-232-59/+40
| | | | | | | | | | By chdir():ing to the root of the rpc_pipefs dir and making paths relative from there (gssd already keeps a number of files open in rpc_pipefs so chdir doesn't suddenly make it impossible to umount rpc_pipefs because of this patch). Signed-off-by: David Hardeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - remove arbitrary GSSD_MAX_CCACHE_SEARCH limitationDavid Hardeman2015-01-232-13/+35
| | | | | | | Get rid of another arbitrary limitation and PATH_MAX array. Signed-off-by: David Hardeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - simplify some option handlingDavid Hardeman2015-01-232-10/+6
| | | | | | | | Using PATH_MAX in modern code is almost always a bad idea. Simplify the code and remove that arbitrary limitation at the same time. Signed-off-by: David Hardeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - merge gssd_main_loop.c and gssd.cDavid Hardeman2015-01-234-271/+220
| | | | | | | | Having all the main loop code in one file is important in preparation for later patches which add inotify and libevent. Signed-off-by: David Hardeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* cleanup daemonization codeDavid Hardeman2015-01-236-71/+17
| | | | | | | | | | | | | | | The daemonization init/ready functions have parameters that are never used, require the caller to keep track of some pipefds that it has no interest in and which might not be used in some scenarios. Cleanup both functions a bit. The idea here is also that these two functions might be good points to insert more systemd init code later (sd_notify()). Also, statd had a private copy of the daemonization code for unknown reasons...so make it use the generic version instead. Signed-off-by: David H?rdeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: configurable minor version defaultsBenjamin Coddington2015-01-231-43/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update nfsmount.conf to allow minor version specification, and rearrange the autonegotiation logic to agreed upon best behavior. Depending upon the combination of values specified within nfsmount.conf and given to mount.nfs, the retry behavior of mount.nfs varies according to the general rule of defaulting to the most specific setting, with some exceptions. A general guide to the expected behavior follows: ------------------ | nfsmount.conf |----------------------------------- | Defaultvers= | arg option | attempts: | |---------------------------------------------------| | 4.2 | not set | v4.2 v4.1 v4.0 v3 | | 4.2 | v4 | v4.2 v4.1 v4.0 | | 4.1 | not set | v4.1 v4.0 v3 | | 4.1 | v4 | v4.1 v4.0 | | 4 | not set | v4.0 v3 | | 4 | v4 | v4.0 | | 3 | not set | v3 | | any set | v4.2 | v4.2 | | any set | v4.1 | v4.1 | | any set | v4 | v4.0 | | any set | v3 | v3 | | not set | not set | v4.2 v4.1 v4.0 v3 | ----------------------------------------------------- If built with --enable-mountconfig=no, then the behavior is the same as if nfsmount.conf did not set Defaultvers. Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsmount.conf: Always parse versionsBenjamin Coddington2015-01-231-34/+0
| | | | | | | | | | | In order to make decisions about which default version to use when only the major version is specified, the nfsmount.conf Defaultvers options should always be parsed, even when a version has already been specified. Remove the check and bypass for parsing the Defaultvers options from nfsmount.conf. Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Add struct nfs_version and generalize version parsingBenjamin Coddington2015-01-235-77/+88
| | | | | | | | | | | | | | | | | | The nfs_version needs to carry major, minor, and basic mode information to allow decisions to be made to override, discard, or negotiate various versions. Update nfs_nfs_version() to work against this struct and set the various modes. This change also makes nfs_nfs_version() parse properly for future version number additions. The general rules for version.v_mode are - not set V_DEFAULT - single digit => 4 V_GENERAL - single digit < 4 V_SPECIFIC - decimal included V_SPECIFIC - miss all others V_PARSE_ERR Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: parse options - add helper po_contains_prefixBenjamin Coddington2015-01-232-0/+26
| | | | | | | | | | The version options (v3,v4,v4.2) may increase in the future, but they have a predictable prefix. Add a parse option helper to locate and return these options by prefix so that a future increment of version does not require the addition of strings to a search table. Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: fix a comment typo in parse optionsBenjamin Coddington2015-01-231-1/+1
| | | | | Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.idmapd: Add a reference to nfsidmap(8) on the man pageScott Mayhew2015-01-231-1/+12
| | | | | | | | Even though the 'new' idmapper used by the client has been around for several years, a lot of users seem to be unaware of its existence. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.idmap: Use event_initialized() to check if event is initializedSteve Dickson2015-01-231-1/+1
| | | | | | | | Using EVLIST_INIT directly is bound to break. This seems to be a leftover from legacy code. Reported-by: Holger Hoffstatte <holger.hoffstaette@googlemail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* start-statd: Use the canonical to check if systemd is running.Steve Dickson2015-01-151-1/+1
| | | | | | | | | Use the approved way, define in http://www.freedesktop.org/software/systemd/man/sd_booted.html to check if systemd is installed and running Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: fix gssd build flagsDavid Hardeman2014-12-081-2/+2
| | | | | | | | | The tirpc variable is another library to add, not additional flags. I'm guessing the reason this hasn't caused problems is that it only shows up with static libraries. Signed-off-by: David Hardeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* Fix up issue with "make dist"NeilBrown2014-12-079-11/+15
| | | | | | | | | | | | | Add mention of new files, remove mention of old files, and cause "make dist" to create something very similar to the current distributions. systemd files are not currently included in "make dist" and some files generated by "rpcgen" are (though they aren't in official distribution). Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: talk to kernel using file descriptors instead of FILETimo Teräs2014-12-074-33/+38
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: talk to kernel using file descriptors instead of FILETimo Teräs2014-12-071-160/+183
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* Add string.h to source files that need itTimo Teräs2014-12-072-0/+2
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: warn when really nothing is exportedPavel Raiskup2014-12-031-9/+13
| | | | | | | | | | | | Throw 'No file systems exported!' iff no volume is exported rather then if some exports file is empty. Typically this can happen if the default /etc/exports file is empty and admin installed configuration into /etc/exports.d directory. This is follow-up for e725def62c73b4 commit. Signed-off-by: Pavel Raiskup <praiskup@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: use sqlite3_errmsg instead of sqlite3_errstrJeff Layton2014-11-171-6/+6
| | | | | | | | | sqlite3_errstr was only added in v3.7.15 of libsqlite3, which makes it difficult to build against earlier releases. Switch the code over to use sqlite3_errmsg instead. Signed-off-by: Jeff Layton <jlayton@primarydata.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: use sqlite3_close instead of sqlite3_close_v2Jeff Layton2014-11-171-1/+1
| | | | | | | | | | | | | | sqlite3_close_v2 wasn't added until v3.7.14 of libsqlite3 so this causes the build to fail vs. very old sqlite3 libs. Also, Chuck points out that the documentation says that sqlite3_close_v2 is intended for use with host languages that are garbage collected, and C isn't. In practice, we shouldn't ever see sqlite3_close return SQLITE_BUSY here anyway since the program is single-threaded, so sqlite3_close should be fine. Signed-off-by: Jeff Layton <jlayton@primarydata.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: Do not fail on empty exports file.Steve Dickson2014-11-171-5/+5
| | | | | | | | | | Commit 076dd80 introduced a regression that causes exportfs to fail when there is an empty /etc/exports file. A empty /etc/exports file is valid and should not cause exportfs to fail. Signed-off-by: Steve Dickson <steved@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: Correct a failure to set key timeout valuesBenjamin Coddington2014-11-041-0/+3
| | | | | | | | | The caller must be a possesor of the key to set the attributes, so link the destination keyring to the current thread's keyring before instantiation so that after instantiation the timeout can be set. Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: set the correct DEFAULT_KEYRING stringBenjamin Coddington2014-11-041-1/+1
| | | | | Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: keyctl_invalidate kernel compatibilityBenjamin Coddington2014-11-041-4/+17
| | | | | | | | | | Change the keyctl_invalidate call to use the syscall interface directly so that when building with libkeyutils missing keyctl_invalidate the build succeeds. Attempt to use _invalidate and fall back to _revoke if the current kernel is missing _invalidate. Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* umount: make it sensitive to -vKarel Zak2014-10-241-1/+13
| | | | | | | Let's print verbose messages like original non-libmount version. Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsstat: fix server rpc stats headerMarko Myllynen2014-10-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | linux/net/sunrpc/stats.c has: /* * Get RPC server stats */ void svc_seq_show(struct seq_file *seq, const struct svc_stat *statp) { ... seq_printf(seq, "rpc %u %u %u %u %u\n", statp->rpccnt, statp->rpcbadfmt+statp->rpcbadauth+statp->rpcbadclnt, statp->rpcbadfmt, statp->rpcbadauth, statp->rpcbadclnt); ... But when /proc/net/rpc/nfsd contains rpc 1 2 3 4 5 nfsstat -sv prints: Server rpc stats: calls badcalls badclnt badauth xdrcall 1 2 3 4 5 Change this to match the kernel: Server rpc stats: calls badcalls badfmt badauth badclnt 1 2 3 4 5 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1142842. Signed-off-by: Marko Myllynen <myllynen@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.svcgssd: Add a configure switch to disable building the daemonSteve Dickson2014-09-251-2/+9
| | | | | | | | Now that gssproxy is supported on modern kernels, the svcgssd is no longer needed. This switch disables the building of the daemon. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsstat: document nfsstat io/ra server facilitiesMarko Myllynen2014-09-221-0/+8
| | | | | | | Document the newly added nfsstat io/ra server facilities. Signed-off-by: Marko Myllynen <myllynen@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsstat: add server ra cache statsMarko Myllynen2014-09-221-4/+25
| | | | | | | Add server read ahead cache statistics to nfsstat. Signed-off-by: Marko Myllynen <myllynen@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsstat: add server io statsMarko Myllynen2014-09-221-3/+23
| | | | | | | Add server io statistics to nfsstat. Signed-off-by: Marko Myllynen <myllynen@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: fetch NFSDCLTRACK_GRACE_START out of environmentJeff Layton2014-09-193-1/+112
| | | | | | | | | | | | | Allow the fetching of NFSDCLTRACK_GRACE_START out of environment variables. If it's present in the "create" or "init" upcalls, then we can use that to query the database to see whether there are any clients that have not issued a RECLAIM_COMPLETE since that time. If there aren't any, then we know that all reclaim activity is now done and we can then cue the kernel to lift the grace period. Signed-off-by: Jeff Layton <jlayton@primarydata.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: grab the NFSDCLTRACK_CLIENT_HAS_SESSION env var if it's presentJeff Layton2014-09-193-12/+55
| | | | | | | | | | ...and set the has_session field in the DB based on whether it's true or not. Since we no longer set the timestamp for v4.1+ clients on a check operation, we must be careful to set the timestamp to zero for v4.1+ clients found via the legacy tracker. Signed-off-by: Jeff Layton <jlayton@primarydata.com> Signed-off-by: Steve Dickson <steved@redhat.com>