]> git.decadent.org.uk Git - nfs-utils.git/log
nfs-utils.git
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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.

17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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.

17 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>
17 years agofix broken compile due to missing pseudoflavors.h
J. Bruce Fields [Mon, 16 Jul 2007 17:06:08 +0000 (13:06 -0400)]
fix broken compile due to missing pseudoflavors.h

Commit e9b0bed761bc77ba046f53be2ec324c4b61357ff should also have added
this file.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
17 years agomount.nfs: White space clean up
Chuck Lever [Mon, 16 Jul 2007 20:29:32 +0000 (16:29 -0400)]
mount.nfs: White space clean up

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
17 years agomount.nfs: Use nfs_error in nfsmount.c, nfsumount.c, and nfs4mount.c
Chuck Lever [Mon, 16 Jul 2007 20:29:27 +0000 (16:29 -0400)]
mount.nfs: Use nfs_error in nfsmount.c, nfsumount.c, and nfs4mount.c

Clean up. - fprintf becomes nfs_error

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
17 years agomount.nfs: Error handling clean-up
Chuck Lever [Mon, 16 Jul 2007 20:29:22 +0000 (16:29 -0400)]
mount.nfs: Error handling clean-up

o  Use nfs_error( _() ) instead of fprintf(stderr,
o  Use the mount return code macros instead of bare integers
o  Free mount_point after it has been canonicalized

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
17 years agomount.nfs: When -v is set and the mount succeeds, print the mount info
Chuck Lever [Mon, 16 Jul 2007 20:29:17 +0000 (16:29 -0400)]
mount.nfs: When -v is set and the mount succeeds, print the mount info

Add a bit of logic that appears to be in other mount helpers.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
17 years agoRemove the running_bg parameter
Chuck Lever [Mon, 16 Jul 2007 20:29:12 +0000 (16:29 -0400)]
Remove the running_bg parameter

Clean up: when nfsmount and nfs4mount are called, running_bg is always set
to zero.  Remove the parameter from the call.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
17 years agomount.nfs: Change *flags to flags
Chuck Lever [Mon, 16 Jul 2007 20:29:06 +0000 (16:29 -0400)]
mount.nfs: Change *flags to flags

It's not necessary to treat the *flags parameter to nfsmount and nfs4mount
as an output parameter.  Nothing is passed back.  Replace it with a normal
call-by-value.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
17 years agomount.nfs: No need to return nfs_mount_data structs
Chuck Lever [Mon, 16 Jul 2007 20:29:01 +0000 (16:29 -0400)]
mount.nfs: No need to return nfs_mount_data structs

Refactor mount processing slightly to remove an output parameter and an
unnecessary type cast.  The mount syscall is now made from inside
nfs_mount or nfs4mount, rather than in common code after those are called.

Code review suggests that EX_BG was never returned by mount.nfs because the
logic I just replaced was always returning EX_FAIL.  The new logic should
properly return EX_BG when appropriate.

However, it is unclear whether /bin/mount handles backgrounding the mount
request, or whether mount.nfs should.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>