summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* mountstats: Convert existing option parsing to use the argparse moduleScott Mayhew2014-12-131-144/+110
| | | | | | | | | | | | | | Made mountstats, nfsstat, and iostat all subcommands (note that the nfsstat function is still unimplemented here). If no sub-command is given, then the mountstats sub-command will run by default (so any scripts that run older versions of the mountstats command will still work). Also removed the --start and --end options since all they do is throw exceptions. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountstats: Refactor compare_iostatsScott Mayhew2014-12-131-6/+19
| | | | | | | | | | Iterate over the newly added counters instead of using repeated assignment statements. Also compute the difference of every counter where it makes sense -- this will allow support for -S/--since to be implemented in the future. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountstats: Refactor __parse_nfs_line and __parse_rpc_lineScott Mayhew2014-12-131-69/+23
| | | | | | | | Iterate over the newly added counter lists instead of having a ton of assignment statements. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountstats: Add lists of various countersScott Mayhew2014-12-131-0/+168
| | | | | | | | | | The NfsEventCounters and NfsByteCounters were lifted straight from nfs-iostat.py. Also added counters for the xprt line (for udp, tcp, and rdma) as well as for v3 and v4 NFS ops. These will allow for more compact code in a couple of places. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountstats: Fix up NFS event countersScott Mayhew2014-12-131-15/+18
| | | | | | | | | The event counters in the mountstats program aren't in sync with the event counters in the kernel. Removed syncinodes and added vfsupdatepage, vfssetattr, congestionwait, pnfsreads, and pnfswrites. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* configure: use pkg-config to find libtirpcYann E. MORIN2014-12-131-55/+12
| | | | | | | | | | | | | | | | | | | | | | | | Currently, we use a custom function to find libtirpc's headers and libraries. This works fine for shared linking. But for static linking, this forgets to link with -lpthread, which is required by libtirpc. A recent patch was sent to libtirpc to add that missing -lpthread in its Libs.private section of its .pc file. Thus, pkg-config will soon be able to return the appropriate libraries. So, use pkg-config to find libtirpc. And for older libtirpc versions, there is no change in behaviour: we're still missing the -lpthread. But once libtirpc has been fixed, we'll automatically get that missing library for free! Remove the --with-libirpc flag as it is no longer needed: pkg-config will provide us with the -I and -L flags, now. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Steve Dickson <steved@redhat.com>
* systemd: added the $BLKMAPDARGS var to the nfs-blkmap serviceSteve Dickson2014-12-131-1/+1
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* rpcgen: change internal rpcgen to support separate builddirDavid Hardeman2014-12-081-3/+4
| | | | | | | | rpcgen uses absolute paths (based on the input) when generating the output files, thus breaking builds using a separate build directory. Signed-off-by: David Hardeman <david@hardeman.nu> 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>
* Include systemd unit files in "dist" and "install".NeilBrown2014-12-073-1/+44
| | | | | | | | | | | | New configure option "--with-systemd" will causes systemd unit files to be installed in /usr/lib/systemd/system. Alternalte a path can be given: --with-systemd=/lib/systemd/system Also, systemd files get included in "make dist" now. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* Fix up issue with "make dist"NeilBrown2014-12-0713-39/+22
| | | | | | | | | | | | | 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>
* nfslib: remove now unused FILE helpersTimo Teräs2014-12-072-117/+0
| | | | | | | All access to kernel is now done using file descriptors. Signed-off-by: Timo Ter?s <timo.teras@iki.fi> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsexport: talk to kernel using file descriptors instead of FILETimo Teräs2014-12-071-33/+44
| | | | 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-075-0/+5
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* mountstats: Sort RPC statistics by operation countChuck Lever2014-12-061-11/+14
| | | | | | | | | Sort the RPC statistics in descending order by operation count, so that the most frequently executed operation appears at the top of the listing (a la `top`). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: warn when really nothing is exportedPavel Raiskup2014-12-033-23/+21
| | | | | | | | | | | | 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-173-9/+16
| | | | | | | | | | 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>
* mountstats: Fix spurious I/O errorsChuck Lever2014-11-171-0/+4
| | | | | | | | | | | | | | | | | When running mountstats under "watch," occassionally the output shows "close failed in file object desctructor: sys.excepthook is missing" and the data display is messed up. This seems to be a common problem when Python script output is piped to another program. Ensure stdout/stderr is completely flushed before mountstats exits, and add an IOError exception handler to catch these exceptions gracefully. Solution suggested by: http://bugs.python.org/issue11380 Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.mountd: set libtirpc nonblocking mode to avoid DOSBodo Stroesser2014-11-121-0/+17
| | | | | | | | | | | | | | | This patch is experimental. In works fine in that it removes the vulnerability against a DOS attack. rpc.mountd can be blocked by a bad client, that sends many RPC requests but never reads the responses. This might happen intentionally or caused by a wrong network config (MTU). The patch switches on the nonblocking mode of libtirpc. In that mode writes can block for a max of 2 seconds. Attackers are forced to send requests slower, as libtirpc will close a connection if it finds two requests to read at the same time. Reviewed-by: NeilBrown <neilb@suse.de> Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.mountd: set nonblocking mode with libtirpcBodo Stroesser2014-11-121-0/+7
| | | | | | | | | | | | If mountd is built with libtirpc the tcp listeners and the sockets waiting for UDP messages are not in non-blocking mode. Thus if running with multiple threads (-t XX), all threads will wake up from select on a connection request or a UDP message, but only one thread will succeed. All others will wait on accept() or read() for the next event. Reviewed-by: NeilBrown <neilb@suse.de> Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.mountd: set nonblocking mode if no libtirpcBodo Stroesser2014-11-123-33/+36
| | | | | | | | | | | | | If mountd is built without libtirpc and it is started using "-p XXX" option, the tcp listeners and the sockets waiting for UDP messages are not in non-blocking mode. Thus if running with multiple threads (-t XX), all threads will wake up from select on a connection request or a UDP message, but only one thread will succeed. All others will wait on accept() or read() for the next event. Reviewed-by: NeilBrown <neilb@suse.de> Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* configure: Fixed typo in configure.acSteve Dickson2014-11-061-1/+1
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* configure: Fixed logic around $enable_gss and $enable_svcgssSteve Dickson2014-11-051-4/+2
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: changes handling of unresolvable entriesHenrique Martins2014-11-043-5/+12
| | | | | | | | | The patch to nfs/exportfs to allow nfsd to start when there are some, but not all, unresolvable entries in /etc/exports. Signed-off-by: Henrique Martins <linux@martins.cc> 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>
* mountstats: Don't display retrans stats unless there are re-xmitSigned-off-by: Chuck Lever2014-11-041-2/+5
| | | | | | | | Clean up display of RPC statistics by omitting retransmit statistics when there have been no retransmissions. Signed-off-by: Chuck Lever <chuck.lever@oracle.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>
* Centralize dependencies on the auth unit.Simo Sorce2014-09-303-6/+12
| | | | | | | | | | | | | | | | | | With this patch either gssproxy or rpc.svcgssd are started only if the auth module is requested, and it finds a keytab. If the wants are in the main nfs-client or nfs-server unit files then the two deamons are started unconditionally and would require conditions which we can test once and for all in a single unit file instead. Change also Before and After statments accordingly to properly serialize loading modules and starting daemons in 3 steps 1. load kernel GSS auth module 2. start GSS handling daemons 3. start NFS client/server daemons Signed-off-by: Simo Sorce <simo@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-client.target: Removed a ordering cycle with nfs-server.serviceSteve Dickson2014-09-291-1/+1
| | | | | | | | | | | | | | On a VM that boots very fast and with out kerberos enabled a systemd ordering cycle happens between nfs-client and nfs-server units when both were enabled. Having nfs-client start the gssd daemons in the same matter as the nfs-server does ('After=') seemed to eliminated the ordering cycle. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* Release 1.3.1Steve Dickson2014-09-251-1/+1
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-service: Added gssproxy supportSteve Dickson2014-09-251-3/+3
| | | | | | | | | | | | | | | | | | | When kernel have gssproxy support the the gssproxy daemon should be used to manage the GSSAPI creds. So this patch adds "calls" to the gssproxy daemon from the NFS server systemd unit file. When gssproxy is installed, gssproxy will be start and rpc.svcgssd will not be. When gssproxy is not installed the rpc.svcgssd daemon will be started. Note, there are already existing hooks in the rpc-svcgssd service file that will ensure the gssproxy will be started before rpc.svcgssd which allows the script not to start rpc.svcsdd when gssproxy is installed and running. Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.svcgssd: Add a configure switch to disable building the daemonSteve Dickson2014-09-252-6/+28
| | | | | | | | 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>
* systemd: manually insert auth_rpcgss module.J. Bruce Fields2014-09-243-1/+16
| | | | | | | | | | | | | | | | | | | We need to insert the auth_rpcgss module before starting rpc.svcgssd or gss-proxy, for two reasons: - gss-proxy needs access to the /proc/net/rpc/use-gss-proxy file to set up communication with knfsd. - the unit files need to able to test for the existance of the same path in order to decide whether the kernel supports gss-proxy or not. Currently we're using dependencies on proc-fs-nfsd.mount for this, but that works only because of the nfsd kernel module references some symbols in auth_rpcgss, which is an odd implementation detail we're likely to fix some day. Signed-off-by: J. Bruce Fields <bfields@redhat.com> 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>
* nfsdcltrack: update schema to v2Jeff Layton2014-09-191-8/+93
| | | | | | | | | | | | | | | | | | | | From: Jeff Layton <jlayton@poochiereds.net> In order to allow knfsd's lock manager to lift its grace period early, we need to figure out whether all clients have finished reclaiming their state not. Unfortunately, the current code doesn't allow us to ascertain this. All we track for each client is a timestamp that tells us when the last "check" or "create" operation came in. Not only is this insufficient with clients that use sessions, it's also wrong. We only want to update the timestamp on v4.1 clients when the "create" operation comes in or we can leave the server susceptible to edge condition #2 in RFC5661, section 8.4.3. Once the grace period is lifted, we disallow reclaim on subsequent reboots for clients that have not sent a RECLAIM_COMPLETE. Signed-off-by: Jeff Layton <jlayton@primarydata.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: overhaul database initializtionJeff Layton2014-09-193-85/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have some possibility for races with nfsdcltrack when the DB schema is upgraded. Suppose we update the nfs-utils package on a machine after the DB has been initialized. With the current scheme of initializing the DB only during the "init" phase, we could end up with a new program that expects a new schema with an old database. We could try to do a one-time update when the package is installed, but that could be racy. We could get an upcall between when the program is installed and when we run the update. Also, relying on packaging to get that right is tricky at best. To fix this, change how the database initialization and checking of the schema revision works. On every upcall, attempt to open the db as we normally would. If that fails, then try to create the directory if it doesn't exist and then retry the open. If it fails again, then give up. If we get a successful open, then query the DB for the schema version. If it matches what we expect, then declare success and move on. If the query fails then assume that the DB isn't set up yet. Start an exclusive transaction, check the schema version again and then set up the DB if no one raced in to create it in the meantime. This should only add a tiny bit of overhead on most upcalls (just an extra select of the parameters table), and should improve the performance of the "init" upcall. It'll also make it possible to handle DB schema changes sanely. Signed-off-by: Jeff Layton <jlayton@primarydata.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: rename CLD_* constants with CLTRACK_* prefixesJeff Layton2014-09-191-6/+6
| | | | | | | | Since nfsdcld has been dead for a few years now, clean up the prefixes on the constants. Signed-off-by: Jeff Layton <jlayton@primarydata.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: update comments in sqlite.cJeff Layton2014-09-191-6/+4
| | | | | | | Clean up and fix some inaccuracies. Signed-off-by: Jeff Layton <jlayton@primarydata.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* sm-notify: inform the kernel if there were no hosts to notifyJeff Layton2014-09-191-0/+25
| | | | | | | | | | | | | | In the event that there no hosts to be notified after a reboot, there's no real reason to force lockd to wait the entire grace period before handing out locks. We're not expecting any reclaim requests to come in that situation. Have sm-notify do a write to /proc/fs/lockd/nlm_end_grace if that file is present. That informs the kernel that it's OK to go ahead and lift lockd's grace period early. Signed-off-by: Jeff Layton <jlayton@primarydata.com> Signed-off-by: Steve Dickson <steved@redhat.com>