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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Chuck Lever [Mon, 16 Jul 2007 20:28:56 +0000 (16:28 -0400)]
mount.nfs: Move MS_DUMMY and friends to header file
We move the definitions of MS_USER and friends to our local copy of
mount_constants.h. These will need to be available in nfsmount.c and
nfs4mount.c when we move the mount system call out of mount.c.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
Clean-up: remove logic to handle --bind and other such command-line
options from mount.nfs[4].
These options are already handled in /bin/mount, and the logic for handling
them in the NFS helper is currently disabled. Other helpers such as
mount.ocfs2 appear not to support --bind (ie. they rely on /bin/mount to
do it).
Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
mount.c seems to assume that nfsumount() uses standard C true/false
return values, and inverts them for the exit status (where 0 is
traditionally considered success). However, nfsumount() consistently
seems to use 0 for success, and thus a success gets returned as exit
status 1 and a failure as exit status 0. This confuses at least
the GNOME drive manager applet, and probably others as well.
Signed-off-by: Steinar H. Gunderson <sesse@debian.org> Signed-off-by: Neil Brown <neilb@suse.de>
J. Bruce Fields [Thu, 5 Jul 2007 17:45:54 +0000 (13:45 -0400)]
document the sec= option
Document the sec= option in the exports man page.
Not done: it would be nice to have an example or two here (and not just
in the final "EXAMPLE" section, though that would be nice too). I was
just too lazy to figure out the formatting.
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@suse.de>
J. Bruce Fields [Thu, 5 Jul 2007 17:45:53 +0000 (13:45 -0400)]
Support sec= option to specify export security
This adds support for reading sec= option and sending security data
through cache via "... secinfo n flavor1 flag1 ... flavorN flagN".
If sec= is missing, no secinfo option will be passed down.
Signed-off-by: Fred Isaman <iisaman@citi.umich.edu> Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@suse.de>
mount.nfs: Fix retry= to handle lack of reserved port situation
In the case of several (>500) mounts running at the same time
with -o tcp, the number of attempts that succeed is about 300-500
because it run out of priviledged port (they are busy in TIME_WAIT
state).
Signed-off-by: Flavio Leitner <flavio.leitner@gmail.com> Signed-off-by: Neil Brown <neilb@suse.de>
Prior to David Howell's mount changes in 2.6.18, users who mounted
different directories which happened to be from the same filesystem on the
server would get different super blocks, and hence could choose different
mount options. As long as there were no hard linked files that crossed from
one subtree to another, this was quite safe.
Post the changes, if the two directories are on the same filesystem (have
the same 'fsid'), they will share the same super block, and hence the same
mount options.
Add a flag to allow users to elect not to share the NFS super block with
another mount point, even if the fsids are the same. This will allow
users to set different mount options for the two different super blocks, as
was previously possible. It is still up to the user to ensure that there
are no cache coherency issues when doing this, however the default
behaviour will be to share super blocks whenever two paths result in
the same fsid.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Neil Brown <neilb@suse.de>
Steve Dickson [Thu, 17 May 2007 00:04:19 +0000 (10:04 +1000)]
mount.nfs - NFSv4 mounts give wrong error message when server denies the mount
When nfs4 mount fail because the exported directory does
not exist, the mount command claims the local mount point
does not exist which is wrong. This patch fixes that problem
as well as makes the v4 mount failures look like v3/v2 failures.
Signed-off-by: Steve Dickson <steved@redhat.com> Signed-off-by: Neil Brown <neilb@suse.de>
In client_compose(), free() the hostent structure returned before
exiting. Normally, gethostbyaddr() returns a pointer to a static
struct, but this hostent comes from either get_reliable_hostbyaddr() or
get_hostent(), both which return a pointer they privately xmalloc()ed,
which thus can and should be free()d.
Signed-Off-By: Steinar H. Gunderson <sesse@debian.org>
Jeff Layton [Wed, 9 May 2007 14:19:33 +0000 (10:19 -0400)]
nfs-utils: have mountd hold open etab file to force inode number to change
This patch changes mountd to hold the etab file open so that when it's
changed by exportfs, the inode number should change. We then change
auth_reload to reload the file based on whether st_ino is different
from the last time it was checked. It also changes auth_reload to
maintain a static counter value and return it instead of a timestamp
and fixes up get_exportlist accordingly. Finally, it adds some
comments to xtab_write to warn people about editing the etab in place.
Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
Neil Brown [Tue, 8 May 2007 04:43:28 +0000 (14:43 +1000)]
Remove rquotad
rquotad isn't really used by anyone - as you can tell by the fact that
it only works for ext2 and ext3 (if those).
The 'quota' package contains a working and maintained rquota and all
distros appear to use that one. So remove rquotad from this package
to avoid confusion.
Jeff Layton [Mon, 7 May 2007 11:53:32 +0000 (07:53 -0400)]
update manpages for showmount and mountd
This patch updates the manpages for showmount and mountd. It adds a
description of the new mountd -r option, and a caveat about the unreliability
of showmount -a.
Neil Brown [Thu, 3 May 2007 00:46:02 +0000 (10:46 +1000)]
Detect version of libblkid and act accordingly.
libblkid earlier than 1.40 has a memory leak bug that make it unsuitable
for use in mountd.
So detect the version and default to not using it if too old. Give appropriate
warnings in various cases.
Kevin Coffman [Thu, 19 Apr 2007 21:39:27 +0000 (17:39 -0400)]
Update libgssapi requirements
Update the required version of libgssapi from 0.9 to 0.11.
(Working with Heimdal requires 0.11. Symbol versioning was
introduced in 0.10 and should be used everywhere, although
not absolutely required.)