nfs-utils.git
13 years agotext-based mount.nfs: Use new parser to handle 'addr=' and 'clientaddr='
Chuck Lever [Fri, 28 Sep 2007 20:36:40 +0000 (16:36 -0400)]
text-based mount.nfs: Use new parser to handle 'addr=' and 'clientaddr='

Introduce, but don't yet use, functions that will eventually replace
append_addr_opt() and append_clientaddr_opt().

Note the behavioral change in append_addr_opt() -- it simply removes
any previous 'addr=' rather than throwing an error.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
13 years agotext-based mount.nfs: parse option strings into lists
Chuck Lever [Fri, 28 Sep 2007 20:36:35 +0000 (16:36 -0400)]
text-based mount.nfs: parse option strings into lists

Adapt a parsing trick used by Python.

Parse mount option strings into an abstract data type so we don't have to
copy and/or tokenize the whole option string multiple times while trying
to manipulate the mount options.  Then, just before calling the mount(2)
system call, convert the object back into a C string.

One major advantage of this approach is that we can copy the final version
of the mount options into /etc/mtab when we're done, instead of copying in
the original mount options that the user specified.  Any fallback from NFS
v3 to NFS v2 or TCP to UDP that was done by mount.nfs will be reflected in
/etc/mtab.

This patch adds methods for creating and manipulating mount option data
objects.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
13 years agomount.nfs: add new string tokenizer facility
Chuck Lever [Fri, 28 Sep 2007 20:36:30 +0000 (16:36 -0400)]
mount.nfs: add new string tokenizer facility

To quote the strtok(3) man page: "Avoid using these functions."

OK.  We've created our own.  The main reason for this is that strtok(3)
doesn't handle quoted delimiters at all.  We need to handle this:

   context="foo,bar"

where 'context' is a single mount option that sets a token string that
possibly uses the same delimiter that the mount command uses to separate
options (that is, a comma).

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
13 years agorpc.mountd: add new mode for handling netgroup-heavy configurations
Jeff Layton [Thu, 27 Sep 2007 10:54:04 +0000 (06:54 -0400)]
rpc.mountd: add new mode for handling netgroup-heavy configurations

If a host is a member of a large number of netgroups, it becomes easily
possible for client_compose to generate a m_hostname string that
overflows the maximum string length allowed by the kernel caches.

This patch adds a new mode for mountd where it will map IP address to IP
address in the auth.unix.ip cache. When this enabled, mountd doesn't
bother using client_compose to build the m_hostname string. It just
populates it with the dotted-quad ip address. When mountd handles a
mount request, it then has an IP address and a path. It then calls
client_check to check the host against export entries where the path has
already matched.

Since we don't bother looking up netgroups which have no relation to the
mount, this can be a big performance gain in netgroup-heavy
configurations.  The downside is that every host has a corresponding
entry in the nfsd.export and nfsd.fh caches as well as the auth.unix.ip
cache.

The new behavior is automatically enabled if the length of all of the
concatenated netgroup names in the export table is longer than half
NFSCLNT_IDMAX. The rationale for this logic is that this should allow
for a host to be a member of a long list of netgroups while still
allowing for other matches.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Steve Dickson <steved@redhat.com>
Signed-off-by: Neil Brown <neilb@suse.de>
13 years agorpc.mountd: create client_resolve and change client_compose to take a hostent arg
Jeff Layton [Thu, 27 Sep 2007 10:53:58 +0000 (06:53 -0400)]
rpc.mountd: create client_resolve and change client_compose to take a hostent arg

This moves the resolution of IP address to hostent into a helper function
and has other functions call it. Having client_compose take a hostent arg
allows us to avoid an extra hostname lookup in the auth_authenticate
codepath as well. Instead of redoing this lookup in client_compose, we can
simply reuse the hostent that was already generated in auth_authenticate.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Steve Dickson <steved@redhat.com>
Signed-off-by: Neil Brown <neilb@suse.de>
13 years agorpc.mountd: make exportent->e_hostname a dynamically-allocated string
Jeff Layton [Thu, 27 Sep 2007 10:53:53 +0000 (06:53 -0400)]
rpc.mountd: make exportent->e_hostname a dynamically-allocated string

This makes the e_hostname field of the exportent into a pointer to a
dynamically allocated string. This is necessary since this is field is
often filled out from the m_hostname. This too adds a few
micro-optimizations as we can avoid copying the string in some places
and simply pass a pointer to the original string instead.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Steve Dickson <steved@redhat.com>
Signed-off-by: Neil Brown <neilb@suse.de>
13 years agorpc.mountd: Change nfs_client->m_hostname to be a dynamically-allocated string
Jeff Layton [Thu, 27 Sep 2007 10:53:48 +0000 (06:53 -0400)]
rpc.mountd: Change nfs_client->m_hostname to be a dynamically-allocated string

Change nfs_client->m_hostname to be dynamically allocated rather than a
fixed length array of size NFSCLNT_IDMAX. This also adds a bit of
micro-optimization in a few places since it reduces the amount of string
copying that needs to be done.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Steve Dickson <steved@redhat.com>
Signed-off-by: Neil Brown <neilb@suse.de>
13 years agorpc.mountd: fix memory leak and error handling in nfsd_fh
Jeff Layton [Thu, 27 Sep 2007 10:53:43 +0000 (06:53 -0400)]
rpc.mountd: fix memory leak and error handling in nfsd_fh

nfsd_fh() uses strdup for creating found_path and doesn't check the
return value. It also doesn't free this memory when the function
returns. Check the return value of strdup and return immediately
if it's NULL. Also, free found_path on exit.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Steve Dickson <steved@redhat.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoDon't do_nfs_umount() for NFSv4 unmounts
Chuck Lever [Mon, 24 Sep 2007 15:29:36 +0000 (11:29 -0400)]
Don't do_nfs_umount() for NFSv4 unmounts

No need to talk to mountd when unmounting nfs4 filesystems.

Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
Acked-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoumount.nfs: umount doesn't recognize a busy file system
Chuck Lever [Mon, 24 Sep 2007 15:29:31 +0000 (11:29 -0400)]
umount.nfs: umount doesn't recognize a busy file system

umount.nfs shouldn't remove a busy file system from /etc/mtab, and should
report and return an error.  I also added an extra "goto" to make the flow
of control more clear, and to reduce the chance that a future change in
this logic will break it.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoumount.nfs: Refactor remount logic in umount.nfs
Chuck Lever [Mon, 24 Sep 2007 15:29:26 +0000 (11:29 -0400)]
umount.nfs: Refactor remount logic in umount.nfs

Clean up: move the remount logic into its own function.  This makes it
easier to fix a bug in the next patch.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoumount.nfs: Fix white space damage in nfsumount.c
Chuck Lever [Mon, 24 Sep 2007 15:29:20 +0000 (11:29 -0400)]
umount.nfs: Fix white space damage in nfsumount.c

Replace leading blanks with tabs in del_mtab().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Add error messages for errors reported by text-based mount(2)
Chuck Lever [Mon, 24 Sep 2007 15:29:15 +0000 (11:29 -0400)]
mount.nfs: Add error messages for errors reported by text-based mount(2)

The text-based mount(2) system call API can return some additional errors
that we would like to report correctly to our users.  These should be safe
to use with the legacy mount(2) ABI as well.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agotext-based mount.nfs: Add text-based error reporting function
Chuck Lever [Mon, 24 Sep 2007 15:29:10 +0000 (11:29 -0400)]
text-based mount.nfs: Add text-based error reporting function

The mount_errors() function prints an error based on what just happened in
the user-space RPC library.  This is meaningless for text-based mounts,
since they don't use the RPC library for most things.

Add a new error printing function that the text-based logic can use to
report an error.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: rename mount_errors()
Chuck Lever [Mon, 24 Sep 2007 15:29:05 +0000 (11:29 -0400)]
mount.nfs: rename mount_errors()

The function mount_errors() actually reports RPC errors generated by the
user-land RPC library.  We're about to add a similar function for reporting
system call errors via errno, so rename mount_errors() to be more specific
about what it does.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agotext-based mount.nfs: Use "child" instead of "bg" for nfsmount_s
Chuck Lever [Mon, 24 Sep 2007 15:28:59 +0000 (11:28 -0400)]
text-based mount.nfs: Use "child" instead of "bg" for nfsmount_s

Match a recent change to nfs4mount_s -- eventually it will become clear why
these were renamed.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Don't leak mount_opts
Chuck Lever [Mon, 24 Sep 2007 15:28:54 +0000 (11:28 -0400)]
mount.nfs: Don't leak mount_opts

A C string containing the user's requested mount options is constructed by
the main mount function in utils/mount/mount.c, but is never freed.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Don't leak extra_opts
Chuck Lever [Mon, 24 Sep 2007 15:28:49 +0000 (11:28 -0400)]
mount.nfs: Don't leak extra_opts

The mount.nfs[4] command should properly release extra_opts before exiting.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agotext-based mount.nfs: Fix memory leak in add_mtab()
Chuck Lever [Mon, 24 Sep 2007 15:28:44 +0000 (11:28 -0400)]
text-based mount.nfs: Fix memory leak in add_mtab()

The add_mtab() function in utils/mount/mount.c calls fix_opts_string() to
construct an /etc/mtab entry, but never frees the result.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: teach [u]mount.nfs[4] to exit with EX_SUCCESS instead of 0
Chuck Lever [Mon, 24 Sep 2007 15:28:38 +0000 (11:28 -0400)]
mount.nfs: teach [u]mount.nfs[4] to exit with EX_SUCCESS instead of 0

Use the newly defined EX_SUCCESS exit code in all the right places.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: add EX_SUCCESS exit code
Chuck Lever [Mon, 24 Sep 2007 15:28:33 +0000 (11:28 -0400)]
mount.nfs: add EX_SUCCESS exit code

We've had some recent trouble, especially in the umount code, that appears
to be due to functions returning a 1 or a 0 return code when they should be
returning a mount exit code (such as EX_FAIL) or a 0.

To help clearly distinguish these two classes of functions, define an
EX_SUCCESS exit code, which is equal to zero.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Provide comments for public network functions
Chuck Lever [Mon, 24 Sep 2007 15:28:28 +0000 (11:28 -0400)]
mount.nfs: Provide comments for public network functions

Clean up: Document public functions in util/mount/network.c with block
comments.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoFix the usage message for gssd to reflect new option
Kevin Coffman [Fri, 7 Sep 2007 14:18:40 +0000 (10:18 -0400)]
Fix the usage message for gssd to reflect new option

Fix the usage message for gssd to reflect new -M option added in 1.1.0

Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoChange to a dependency on libgssglue rather than libgssapi
Kevin Coffman [Fri, 7 Sep 2007 14:18:35 +0000 (10:18 -0400)]
Change to a dependency on libgssglue rather than libgssapi

From: Guillaume Rousse <Guillaume.Rousse@inria.fr>

Use the renamed library libgssglue rather than libgssapi.
Also bump the required version for librpcsecgss (to the one that
also requires libgssglue rather than libgssapi).

Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Update description of clientaddr= in nfs(5)
Chuck Lever [Tue, 4 Sep 2007 20:13:55 +0000 (16:13 -0400)]
mount.nfs: Update description of clientaddr= in nfs(5)

The description of clientaddr= in nfs(5) is out of date and omits some
other typical reasons for using it.  Expand its description.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: restore admin-specified clientaddr option
Chuck Lever [Tue, 4 Sep 2007 20:13:50 +0000 (16:13 -0400)]
mount.nfs: restore admin-specified clientaddr option

Revert an earlier change to make specifying the clientaddr= option illegal.

Jeff Layton pointed out that admins may want to specify the clientaddr=
option to advertise a different callback address when accessing an NFSv4
server through a NAT router.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Add a block comment before mount_error() and umount_error()
Chuck Lever [Fri, 24 Aug 2007 17:11:53 +0000 (13:11 -0400)]
mount.nfs: Add a block comment before mount_error() and umount_error()

Add block comments before mount_error() and umount_error() to help
distinguish them from the other error reporting functions.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Remove get_my_ipv4addr() from utils/mount/stropts.c
Chuck Lever [Fri, 24 Aug 2007 17:11:48 +0000 (13:11 -0400)]
mount.nfs: Remove get_my_ipv4addr() from utils/mount/stropts.c

The get_my_ipv4addr() function is no longer used, so remove it from
utils/mount/stropts.c.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Use get_client_addr() to build clientaddr= option
Chuck Lever [Fri, 24 Aug 2007 17:11:43 +0000 (13:11 -0400)]
mount.nfs: Use get_client_addr() to build clientaddr= option

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Create a new API to find out client's address
Chuck Lever [Fri, 24 Aug 2007 17:11:38 +0000 (13:11 -0400)]
mount.nfs: Create a new API to find out client's address

Provide a version of clnt_ping() that discovers the client's address, but
doesn't do an RPC ping.  The in-kernel text-based mount code already does
a ping, so all we need here is address discovery.

As well, add a block comment in front of clnt_ping() that hopefully
elucidates the differences.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Refactor parse_devname and fill_ipv4_addr
Chuck Lever [Fri, 24 Aug 2007 17:11:32 +0000 (13:11 -0400)]
mount.nfs: Refactor parse_devname and fill_ipv4_addr

We will eventually need the server address in both append_addr_opt()
and append_clientaddr_opt().  Call parse_devname() and fill_ipv4_addr()
from the top level functions.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Use dynamically allocated character buffers
Chuck Lever [Fri, 24 Aug 2007 17:11:27 +0000 (13:11 -0400)]
mount.nfs: Use dynamically allocated character buffers

Replace the use of static character arrays with buffers allocated via
xstrdup() in stropts.c.

I added a couple of extra length checks; not sure if these are really
necessary.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Remove get_my_ipv4addr() from append_addr_opt()
Chuck Lever [Fri, 24 Aug 2007 17:11:22 +0000 (13:11 -0400)]
mount.nfs: Remove get_my_ipv4addr() from append_addr_opt()

The result of the get_my_ipv4addr() function is not used in
append_addr_opt(), so remove the call and the ip_addr variable.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Don't allow the user to specify addr= or clientaddr=.
Chuck Lever [Fri, 24 Aug 2007 17:11:16 +0000 (13:11 -0400)]
mount.nfs: Don't allow the user to specify addr= or clientaddr=.

The current mount.nfs implementation doesn't allow users to specify their
own addr= or clientaddr= option.  The new string-based interface does
allow this, even though nfs(5) does not document 'addr=' and specifically
forbids adding 'clientaddr='.

Make the addition of either option by the user a permanent error.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Fix nfs4mount_s prototype.
Chuck Lever [Fri, 24 Aug 2007 17:11:11 +0000 (13:11 -0400)]
mount.nfs: Fix nfs4mount_s prototype.

The definition of nfs4mount_s in utils/mount/stropts.c doesn't match the
prototype declared in utils/mount/stropts.h.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Combine two verbose messages into one
Chuck Lever [Tue, 21 Aug 2007 16:19:18 +0000 (12:19 -0400)]
mount.nfs: Combine two verbose messages into one

A little less noise.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: getport() should avoid modifying passed-in arguments
Chuck Lever [Tue, 21 Aug 2007 16:19:13 +0000 (12:19 -0400)]
mount.nfs: getport() should avoid modifying passed-in arguments

Defensive coding: getport() shouldn't alter the passed-in server address,
but should treat it as read only.  Have it operate on a copy.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Replace fork() with daemon() for backgrounding mounts
Chuck Lever [Tue, 21 Aug 2007 16:19:08 +0000 (12:19 -0400)]
mount.nfs: Replace fork() with daemon() for backgrounding mounts

Neil recommended this change to address a problem with background mount
processes handling signals properly during an init level change.  It is
also useful for preventing background mount processes from reporting
progress on the parent's tty, which is generally just annoying noise.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount: Small tidy up.
Neil Brown [Fri, 24 Aug 2007 03:11:00 +0000 (13:11 +1000)]
mount: Small tidy up.

1/ remove confusing sentence from a comment.
2/ remove needless 'exit' - just fall through to common exit.

Signed-off-by: Neil Brown <neilb@suse.de>
14 years agonfsstat: Add -S/--since flag.
david m. richter [Mon, 13 Aug 2007 19:16:14 +0000 (15:16 -0400)]
nfsstat: Add -S/--since flag.

Read statistics from the file given with -S/--since and display
the difference between those and the current statistics.  Valid stat files
are those in the form of /proc/net/rpc/nfs, /proc/net/rpc/nfsd, or any
"pretty" output from nfsstat itself.  Statistics that are missing from a
"pretty" stat file are treated as zeroes.

Similar to Neil Brown's suggestion, one might use this in
conjunction with watch(1) like this:

$ watch "nfsstat --since /tmp/stats; nfsstat >/tmp/stats"

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agonfsstat: #define stat header labels.
david m. richter [Mon, 13 Aug 2007 19:15:57 +0000 (15:15 -0400)]
nfsstat: #define stat header labels.

Make #defines for the stat header labels, use for output, and add
to struct statinfo.  This will be used by a subsequent patch for
-S/--since.

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agonfsstat: Remove some pointer comparisons against global statinfos.
david m. richter [Mon, 13 Aug 2007 19:15:48 +0000 (15:15 -0400)]
nfsstat: Remove some pointer comparisons against global statinfos.

Pass-in an "is_srv" arg instead of doing pointer comparisons
against the static statinfo arrays themselves.

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agonfsstat: Obviate and remove copy_stats().
david m. richter [Mon, 13 Aug 2007 19:15:40 +0000 (15:15 -0400)]
nfsstat: Obviate and remove copy_stats().

Rather than copying stats during --sleep, instead introduce a few
pointers and rearrange them to avoid the copy.  Will be useful with
--since, too.

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agonfsstat: rename *_tmp variables to *_old.
david m. richter [Mon, 13 Aug 2007 19:15:31 +0000 (15:15 -0400)]
nfsstat: rename *_tmp variables to *_old.

To make a subsequent patch a little clearer, make it explicit that
current *_tmp variables are actually always/only the "old" set used in
comparisons.

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoRestrict -i option to root.
Neil Brown [Fri, 10 Aug 2007 23:52:29 +0000 (09:52 +1000)]
Restrict -i option to root.

As it is still under development, don't expose it - just in case.

Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Enable mount.nfs to do text-based mount support
Chuck Lever [Fri, 10 Aug 2007 22:20:01 +0000 (18:20 -0400)]
mount.nfs: Enable mount.nfs to do text-based mount support

A new command line option, "-i", is added to mount.nfs to force the use of
the string interface for testing purposes.  "-s", "-t", and "-r" are
already taken or have legacy meaning so I picked "-i".

At some later point, when everyone is comfortable with the string mount
option parsing implementation, we will add a switch based on kernel
version, and remove the "-i" command line option.  For now, I am more
comfortable enabling it by hand instead.

Since this is a temporary arrangement, I'm leaving the option undocumented
in the mount.nfs man page.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Add new files for supporting string-ified mount options
Chuck Lever [Fri, 10 Aug 2007 22:19:55 +0000 (18:19 -0400)]
mount.nfs: Add new files for supporting string-ified mount options

Introduce support files which contain code that builds string mount
options and passes them to the kernel.  This is a pre-requisite for
actually enabling /sbin/mount.nfs to do text-based mounts.

This is only partially complete at the moment, but is presented so that
folks can start banging on the kernel mount option string parsing code.
There are clearly still parts that are not implemented quite yet, such
as bg and retry support, but it should be enough to get going.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Replace a "return 0; " that should be an "exit(0); "
Chuck Lever [Fri, 10 Aug 2007 22:19:50 +0000 (18:19 -0400)]
mount.nfs: Replace a "return 0; " that should be an "exit(0); "

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Treat another UDP/TCP pair of strings like the rest
Chuck Lever [Fri, 10 Aug 2007 22:19:45 +0000 (18:19 -0400)]
mount.nfs: Treat another UDP/TCP pair of strings like the rest

See the error messages at the end of utils/mount/network.c:get_socket()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoumount.nfs: Update umount.nfs(8)
Chuck Lever [Thu, 9 Aug 2007 21:37:01 +0000 (17:37 -0400)]
umount.nfs: Update umount.nfs(8)

Account for recent changes to the umount.nfs command.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Update the mount.nfs(8) man page
Chuck Lever [Thu, 9 Aug 2007 21:36:56 +0000 (17:36 -0400)]
mount.nfs: Update the mount.nfs(8) man page

Account for recent changes to the mount.nfs command.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agonfs-utils: specify a create mode with open(...O_CREAT) call in xflock
Jeff Layton [Tue, 7 Aug 2007 12:01:08 +0000 (08:01 -0400)]
nfs-utils: specify a create mode with open(...O_CREAT) call in xflock

The xflock function can create a file via open() with O_CREAT, but does
not specify the create mode when it does so. I think 0644 should be
appropriate given the current usage of this function.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoRemove ARCH-specific compile flags for ALPHA.
Neil Brown [Thu, 9 Aug 2007 01:23:24 +0000 (11:23 +1000)]
Remove ARCH-specific compile flags for ALPHA.

 -mno-fp-regs -ffixed-8

are used for compiling the kernel on alphas, and it seems they
were copied into nfs-utils long ago, even though they have no
relevance now.
As we now use floating point (just a little bit in nfsstat), remove
these pointless flags.

14 years agonfsstat: include -Z/--sleep in the manpage
david m. richter [Tue, 7 Aug 2007 23:53:48 +0000 (19:53 -0400)]
nfsstat: include -Z/--sleep in the manpage

Add a little blurb about -Z/--sleep to the nfsstat manpage.

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agonfsstat: rename --diff-stat to --sleep
david m. richter [Tue, 7 Aug 2007 23:53:11 +0000 (19:53 -0400)]
nfsstat: rename --diff-stat to --sleep

As per Bruce Fields' suggestion, rename the clunky -D/--diff-stat
to the more-intuitive -Z/--sleep.

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agonfsstat: fix a bug in diff_stats()
david m. richter [Tue, 7 Aug 2007 23:53:00 +0000 (19:53 -0400)]
nfsstat: fix a bug in diff_stats()

Fix a bug in diff_stats() that causes false-positives in
has_stats(), which can result in a bunch of zeros being displayed instead
of suppressed as intended.

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agonfsstat: add a comment to has_stats()
david m. richter [Tue, 7 Aug 2007 23:52:50 +0000 (19:52 -0400)]
nfsstat: add a comment to has_stats()

Clarify what has_stats() is actually doing.

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agonfsstat: display 3 additional NFSv4 client op counters
david m. richter [Tue, 7 Aug 2007 23:52:39 +0000 (19:52 -0400)]
nfsstat: display 3 additional NFSv4 client op counters

Display three extra NFSv4 client counters that are already exposed
in /proc/net/rpc/nfs: GETACL, SETACL, and FS_LOCATIONS.  Won't cause
trouble on older kernels that might lack those counters.

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agofix regression with rmtab handling in newer nfs-utils code
Jeff Layton [Mon, 6 Aug 2007 23:18:58 +0000 (19:18 -0400)]
fix regression with rmtab handling in newer nfs-utils code

commit dbfcba5b03481d49f3e78946fe8fd066e2025545
incorrectly added some mountlist_add calls.
Removed them again.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Fix background mounts
Chuck Lever [Fri, 3 Aug 2007 17:24:15 +0000 (13:24 -0400)]
mount.nfs: Fix background mounts

The new mount.nfs helper does not support background mounts.  Add support
for background mounts.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Refactor mount logic to allow support for "bg" option
Chuck Lever [Fri, 3 Aug 2007 17:24:10 +0000 (13:24 -0400)]
mount.nfs: Refactor mount logic to allow support for "bg" option

Refactor main() a bit to make adding support for "bg" option easier.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: restore bg argument to nfsmount() and nfs4mount()
Chuck Lever [Fri, 3 Aug 2007 17:24:05 +0000 (13:24 -0400)]
mount.nfs: restore bg argument to nfsmount() and nfs4mount()

To enable background mounting again, restore the "bg" argument to
nfsmount() and nfs4mount() that was recently removed.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: get_socket() may clobber errno, but preserves .re_errno
Chuck Lever [Fri, 3 Aug 2007 17:24:00 +0000 (13:24 -0400)]
mount.nfs: get_socket() may clobber errno, but preserves .re_errno

get_socket() guarantees that rpc_createerr.cf_error.re_errno is set
correctly after an error, but it can wipe errno if it has to print an error
message.  Make sure that clnt_ping() checks the correct error code when
get_socket() returns.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Always close the socket at the end of getport()
Chuck Lever [Fri, 3 Aug 2007 17:23:54 +0000 (13:23 -0400)]
mount.nfs: Always close the socket at the end of getport()

These days, none of get_socket()'s callers pass an RPC_ANYSOCK on to the
RPC code.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Shorter timeout for TCP connects
Chuck Lever [Fri, 3 Aug 2007 17:23:49 +0000 (13:23 -0400)]
mount.nfs: Shorter timeout for TCP connects

The standard TCP connect timeout on Linux is 75 seconds, which can be
too long in some cases.  The timeout itself can be altered on a system-wide
basis, but we'd like mount to have it's own connect timeout that's tunable,
and defaults to a shorter value.

The get_socket() function is a utility function that does TCP connects for
getport, clnt_ping, and other functions.  Add logic there to use a
non-blocking connect() and select() in order to time out a connect
operation that's taking too long.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Remove a redundant port assignment
Chuck Lever [Fri, 3 Aug 2007 17:23:44 +0000 (13:23 -0400)]
mount.nfs: Remove a redundant port assignment

getport() always fills in its port number before calling GETPORT.  No need
for the caller to do this.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: umount needs to pick up transport option from /etc/mtab
Chuck Lever [Fri, 3 Aug 2007 17:23:39 +0000 (13:23 -0400)]
mount.nfs: umount needs to pick up transport option from /etc/mtab

Now that umount's default transport protocol has become more flexible, it
will need to detect both proto=udp and proto=tcp in /etc/mtab.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: fix printf's normally hidden behind NFS_MOUNT_DEBUG
Chuck Lever [Fri, 3 Aug 2007 17:23:34 +0000 (13:23 -0400)]
mount.nfs: fix printf's normally hidden behind NFS_MOUNT_DEBUG

After I enabled NFS_MOUNT_DEBUG the compiler started spitting out warnings.
Fix up commas, output formatting, and double-wide character support.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: Support double-wide characters in printed strings
Chuck Lever [Fri, 3 Aug 2007 17:23:29 +0000 (13:23 -0400)]
mount.nfs: Support double-wide characters in printed strings

Previous NLS changes missed a spot or two.  This patch tries to get
most of them, but probably misses a few more.

In errors.c:mount_errors() I've removed a period at the end of the error
messages; this is consistent with other error messages I've examined.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agonfsstat: add -D/--diff-stat
david m. richter [Tue, 31 Jul 2007 21:39:49 +0000 (17:39 -0400)]
nfsstat: add -D/--diff-stat

Add -D/--diff-stat: instead of immediately displaying total
collected NFS stats and exiting, nfsstat will take a snapshot of current
statistics and pause until the user hits ^C, at which point it takes a
second snapshot and then prints out the difference of the two; i.e.,
only the statistics collected during the pause.

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agonfsstat: just declare -D/--diff-stat's variables
david m. richter [Tue, 31 Jul 2007 21:39:42 +0000 (17:39 -0400)]
nfsstat: just declare -D/--diff-stat's variables

Add the temp vars -D/--diff-stat will use.  (just using a separate
patch to make the next one easier to read)

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agonfsstat: use macros to declare struct statinfo arrays
david m. richter [Tue, 31 Jul 2007 21:39:30 +0000 (17:39 -0400)]
nfsstat: use macros to declare struct statinfo arrays

Use macros to build the arrays of struct statinfos.  This will
make adding the extra set of temporary variables needed by -D/--diff-stat
much easier.

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agonfsstat: standardize naming of opcount arrays
david m. richter [Tue, 31 Jul 2007 21:39:23 +0000 (17:39 -0400)]
nfsstat: standardize naming of opcount arrays

Standardized Naming 2: Make the client and server "call counts"
arrays' variable names reflect/include the actual text labels from the
/proc files -- e.g., "cltv2info" becomes "cltproc2info".  A subsequent
patch will rely on this naming scheme.

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agonfsstat: standardize naming of server variables
david m. richter [Tue, 31 Jul 2007 21:39:16 +0000 (17:39 -0400)]
nfsstat: standardize naming of server variables

Standardized Naming 1: Instead of having a variety of different
server-related variable name prefixes ("srv", "svr", "svc", "SVC"), set
them all to "srv" or "SRV".  A subsequent patch will rely on this naming
scheme.

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agonfsstat: add get_stats()
david m. richter [Tue, 31 Jul 2007 21:39:11 +0000 (17:39 -0400)]
nfsstat: add get_stats()

Share some of the existing statistics-gathering code by folding it
into a function, get_stats().

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agonfsstat: add has_stats()
david m. richter [Tue, 31 Jul 2007 21:39:02 +0000 (17:39 -0400)]
nfsstat: add has_stats()

To help readability, add has_stats() and use it when deciding
whether to print.

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoFix more 'prototype' warnings and other warnings.
Neil Brown [Mon, 30 Jul 2007 06:33:39 +0000 (16:33 +1000)]
Fix more 'prototype' warnings and other warnings.

Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: clean up a couple of printfs in fstab.c
Chuck Lever [Sat, 28 Jul 2007 21:51:06 +0000 (17:51 -0400)]
mount.nfs: clean up a couple of printfs in fstab.c

Clean up for consistent use.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agolibnfs.a: eliminate another dependency on a global variable
Chuck Lever [Sat, 28 Jul 2007 21:51:00 +0000 (17:51 -0400)]
libnfs.a: eliminate another dependency on a global variable

The file support/nfs/fstab.c, which is linked into libnfs.a, depends on the
global variable "verbose."  This variable is defined and used only in the
mount command, and the functions in fstab.c are used only by the mount
command.

Move fstab.c and support/include/fstab.h to utils/mount.  This file
placement is also consistent with at least one other mount helper,
mount.ocfs2.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agolibnfs.a: eliminate conn.c and conn.h
Chuck Lever [Sat, 28 Jul 2007 21:50:55 +0000 (17:50 -0400)]
libnfs.a: eliminate conn.c and conn.h

conn.[ch] are now no longer needed.  Clean them out and delete them.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: use nfs_error instead of fprintf in get_socket()
Chuck Lever [Sat, 28 Jul 2007 21:50:50 +0000 (17:50 -0400)]
mount.nfs: use nfs_error instead of fprintf in get_socket()

Use nfs_error() where appropriate.  I used "goto" here to reduce string
splitting and indenting past the point of readability.  Gee, it would be
nice if C had proper exception handling...

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agolibnfs.a: move get_socket() function to utils/mount/network.c
Chuck Lever [Sat, 28 Jul 2007 21:50:45 +0000 (17:50 -0400)]
libnfs.a: move get_socket() function to utils/mount/network.c

Now we can address the real problem: that get_socket() depends on the
global variable "verbose" which is only available in the mount command.

Move get_socket() into utils/mount/network.c, and make it static.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agolibnfs.a: move clnt_ping() to utils/mount
Chuck Lever [Sat, 28 Jul 2007 21:50:40 +0000 (17:50 -0400)]
libnfs.a: move clnt_ping() to utils/mount

Continue clean up of mount functionality in libnfs.a by moving clnt_ping()
to utils/mount/network.c.  Note that socklen_t is an unsigned int... the
i386 gcc compiler threw a signedness warning about the 3rd argument of
getsockname().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agolibnfs.a: move more mount-only functions out of libnfs.a
Chuck Lever [Sat, 28 Jul 2007 21:50:35 +0000 (17:50 -0400)]
libnfs.a: move more mount-only functions out of libnfs.a

Continue clean-up with nfsvers_to_mnt() and mntvers_to_nfs().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agolibnfs.a: move mnt_{open, close}clnt calls to utils/mount/network.c
Chuck Lever [Sat, 28 Jul 2007 21:50:30 +0000 (17:50 -0400)]
libnfs.a: move mnt_{open, close}clnt calls to utils/mount/network.c

It turns out that get_socket() accesses a global variable, "verbose," that
is only available in the mount command; yet it's in libnfs.a.  This creates
an undocumented API dependency that will bite someone someday.  This
mount-specific functionality doesn't really belong in libnfs.a anyway.

The simplest way to resolve this is to move all of the functions in
support/nfs/conn.c into utils/mount.  network.c seems like the logical
place to put these.  An added benefit is we eventually get to make
get_socket() static.

Let's start with the mnt_{open,close}clnt functions.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: clean up getport() function
Chuck Lever [Sat, 28 Jul 2007 21:50:24 +0000 (17:50 -0400)]
mount.nfs: clean up getport() function

Mostly comment clarification.  Also replace some naked undocumented
integers with macros, and make getport() static.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: fix hang when getport() uses TCP against unavailable servers
Chuck Lever [Sat, 28 Jul 2007 21:50:19 +0000 (17:50 -0400)]
mount.nfs: fix hang when getport() uses TCP against unavailable servers

If get_socket() can't get us an open TCP socket, we know the server is
down, so make  getport() exit early instead of hanging.  This logic is
copied from clnt_ping().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoumount.nfs: eliminate a nearly empty header file.
Chuck Lever [Sat, 28 Jul 2007 21:50:14 +0000 (17:50 -0400)]
umount.nfs: eliminate a nearly empty header file.

Clean-up: move nfsumount() global declaration to nfs_mount.h, and remove
nfsumount.h.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoumount.nfs: Pass return codes from do_nfs_umount back
Chuck Lever [Sat, 28 Jul 2007 21:50:09 +0000 (17:50 -0400)]
umount.nfs: Pass return codes from do_nfs_umount back

Do we really care about these return codes?

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoumount.nfs: Make do_nfs_mount use conventional EX_ style return codes
Chuck Lever [Sat, 28 Jul 2007 21:50:04 +0000 (17:50 -0400)]
umount.nfs: Make do_nfs_mount use conventional EX_ style return codes

do_nfs_mount() should return EX_ style return codes and not 1 or 0 in order
to distinguish between usage errors and other problems (such as EX_FILEIO
or RPC errors).

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoumount.nfs: make _nfsumount() static
Chuck Lever [Sat, 28 Jul 2007 21:49:59 +0000 (17:49 -0400)]
umount.nfs: make _nfsumount() static

_nfsumount() is never called outside of nfsumount.c.  Also give it a more
conventional name.

Note that it's return code is ignored.  That will be addressed in a
subsequent patch.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoumount.nfs: make del_mtab() a static function
Chuck Lever [Sat, 28 Jul 2007 21:49:54 +0000 (17:49 -0400)]
umount.nfs: make del_mtab() a static function

Clean-up: del_mtab() isn't used outside of nfsumount.c.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoMake sure nfs_call_umount's callers are handling its return code correctly
Chuck Lever [Sat, 28 Jul 2007 21:49:49 +0000 (17:49 -0400)]
Make sure nfs_call_umount's callers are handling its return code correctly

umount.nfs is treating nfs_call_umount's return code like a standard mount
return code (EX_SOMETHING) when its really an RPC return code.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoumount.nfs: move nfs_call_umount to network.c
Chuck Lever [Sat, 28 Jul 2007 21:49:43 +0000 (17:49 -0400)]
umount.nfs: move nfs_call_umount to network.c

nfs_call_umount() is shared by nfsmount.c and nfsumount.c, and manages a
network function (building the RPC umount call to the server's MNT daemon).
So move it to network.c with other network-related functions.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoumount.nfs: make umount_usage() static
Chuck Lever [Sat, 28 Jul 2007 21:49:38 +0000 (17:49 -0400)]
umount.nfs: make umount_usage() static

No good reason to export umount_usage.  Make it static.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoumount.nfs: make umount.nfs use UDP by default
Chuck Lever [Sat, 28 Jul 2007 21:49:33 +0000 (17:49 -0400)]
umount.nfs: make umount.nfs use UDP by default

mount.nfs currently uses UDP by default when calling a MNT server.  Make
umount.nfs do the same.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoumount.nfs: some umount.nfs error return codes are confusing
Chuck Lever [Sat, 28 Jul 2007 21:49:28 +0000 (17:49 -0400)]
umount.nfs: some umount.nfs error return codes are confusing

umount.nfs should return the standard EX_ mount return codes.  At some
point in the past, it was returning 0 for failure and 1 for success, and
some of these have been changed and some haven't.  See if we can rectify
this.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agomount.nfs: fix more nits with error messages
Chuck Lever [Sat, 28 Jul 2007 21:49:23 +0000 (17:49 -0400)]
mount.nfs: fix more nits with error messages

Catch-all.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
14 years agoAdd -Wstrict-prototypes to compiler args, and fix warnings caused.
Neil Brown [Sun, 29 Jul 2007 07:20:10 +0000 (17:20 +1000)]
Add -Wstrict-prototypes to compiler args, and fix warnings caused.

14 years agoUse __fpurge to ensure single-line writes to cache files
J. Bruce Fields [Thu, 26 Jul 2007 20:30:46 +0000 (16:30 -0400)]
Use __fpurge to ensure single-line writes to cache files

On a recent Debian/Sid machine, I saw libc retrying stdio writes that
returned write errors.  The result is that if an export downcall returns
an error (which it can in normal operation, since it currently
(incorrectly) returns -ENOENT on any negative downcall), then subsequent
downcalls will write multiple lines (including the original line that
received the error).

The result is that the server fails to respond to any rpc call that
refers to an unexported mount point (such as a readdir of a directory
containing such a mountpoint), so client commands hang.

I don't know whether this libc behavior is correct or expected, but it
seems safest to add the __fpurge() (suggested by Neil) to ensure data is
thrown away.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>