configure: Fixed logic around $enable_gss and $enable_svcgss

Signed-off-by: Steve Dickson <steved@redhat.com>
configure: Fixed typo in configure.ac

Signed-off-by: Steve Dickson <steved@redhat.com>
rpc.mountd: set nonblocking mode if no libtirpc

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>
rpc.mountd: set nonblocking mode with libtirpc

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 libtirpc nonblocking mode to avoid DOS

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>
mountstats: Fix up NFS event counters

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>
mountstats: Add lists of various counters

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>
mountstats: Refactor __parse_nfs_line and __parse_rpc_line

Iterate over the newly added counter lists instead of having a ton of
assignment statements.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
mountstats: Refactor compare_iostats

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>
mountstats: Convert existing option parsing to use the getopt module

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
mountstats: Make ms-iostat output match that of nfs-iostat.py

Changes mostly lifted straight from nfs-iostat.py.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
mountstats: Make print_iostat_summary handle newly appearing mounts

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
mountstats: Add support for -f/--file to the mountstats and ms-iostat commands

Add support for the -f/--file option to allow parsing of data from an
arbitrary file instead of /proc/self/mountstats.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
mountstats: Add support for -S/--since to the mountstats and ms-iostat commands

Add support for -S/--since to the mountstats and ms-iostat commands to
display the delta between a previous copy of /proc/self/mountstats and
the current /proc/self/mountstats file.  Can be combined with the -f
option to show the statistics between two different points in time.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
mountstats: Fix IndexError in __parse_nfs_line

If __parse_nfs_line is is called on a line that has 'fstype nfsd', it'll
raise an IndexError trying to parse a nonexistent statvers entry.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
mountstats: Allow mountstats_command to take a variable number of mountpoints

Allow the mountstats command to take a variable number of mountpoints
(including none, in which case it will print stats for all NFS
mountpoints it finds).

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
mountstats: Add support for -R/--raw to mountstats_command

This option displays the mountstats in raw format (i.e. in the same
format as /proc/self/mountstats).  It's intended to be used mainly with
the -S/--since option.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
mountstats: Implement nfsstat_command

Displays nfssstat-like statistics for a single mountpoint (client
statistics only).

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
mountstats: Remove the --start and --end options

All they do is throw 'not implemented' exceptions anyway.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
mountstats: Update the help output

Updated the help output for mounstats, ms-iostat, and ms-nfsstat to make
them constistent.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>