summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* rpc.mountd: add new mode for handling netgroup-heavy configurationsJeff Layton2007-09-283-19/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* rpc.mountd: create client_resolve and change client_compose to take a ↵Jeff Layton2007-09-284-17/+22
| | | | | | | | | | | | | | 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>
* rpc.mountd: make exportent->e_hostname a dynamically-allocated stringJeff Layton2007-09-285-24/+15
| | | | | | | | | | | | 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>
* rpc.mountd: Change nfs_client->m_hostname to be a dynamically-allocated stringJeff Layton2007-09-283-11/+15
| | | | | | | | | | | 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>
* rpc.mountd: fix memory leak and error handling in nfsd_fhJeff Layton2007-09-281-0/+3
| | | | | | | | | | | 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>
* Don't do_nfs_umount() for NFSv4 unmountsChuck Lever2007-09-251-1/+1
| | | | | | | | 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>
* umount.nfs: umount doesn't recognize a busy file systemChuck Lever2007-09-251-3/+7
| | | | | | | | | | 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>
* umount.nfs: Refactor remount logic in umount.nfsChuck Lever2007-09-251-17/+26
| | | | | | | | 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>
* umount.nfs: Fix white space damage in nfsumount.cChuck Lever2007-09-251-58/+58
| | | | | | | 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>
* mount.nfs: Add error messages for errors reported by text-based mount(2)Chuck Lever2007-09-251-2/+18
| | | | | | | | | 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>
* text-based mount.nfs: Add text-based error reporting functionChuck Lever2007-09-252-0/+57
| | | | | | | | | | | | 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>
* mount.nfs: rename mount_errors()Chuck Lever2007-09-254-10/+19
| | | | | | | | | | 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>
* text-based mount.nfs: Use "child" instead of "bg" for nfsmount_sChuck Lever2007-09-251-3/+3
| | | | | | | | 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>
* mount.nfs: Don't leak mount_optsChuck Lever2007-09-251-6/+11
| | | | | | | | 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>
* mount.nfs: Don't leak extra_optsChuck Lever2007-09-251-0/+1
| | | | | | | 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>
* text-based mount.nfs: Fix memory leak in add_mtab()Chuck Lever2007-09-251-0/+2
| | | | | | | | 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>
* mount.nfs: teach [u]mount.nfs[4] to exit with EX_SUCCESS instead of 0Chuck Lever2007-09-255-10/+10
| | | | | | | 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>
* mount.nfs: add EX_SUCCESS exit codeChuck Lever2007-09-251-0/+1
| | | | | | | | | | | | 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>
* mount.nfs: Provide comments for public network functionsChuck Lever2007-09-251-5/+37
| | | | | | | | 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>
* Fix the usage message for gssd to reflect new optionKevin Coffman2007-09-111-1/+1
| | | | | | | 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>
* Change to a dependency on libgssglue rather than libgssapiKevin Coffman2007-09-111-5/+5
| | | | | | | | | | | 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>
* mount.nfs: Update description of clientaddr= in nfs(5)Chuck Lever2007-09-051-5/+17
| | | | | | | | 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>
* mount.nfs: restore admin-specified clientaddr optionChuck Lever2007-09-051-7/+4
| | | | | | | | | | | 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>
* mount.nfs: Add a block comment before mount_error() and umount_error()Chuck Lever2007-08-251-1/+11
| | | | | | | | 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>
* mount.nfs: Remove get_my_ipv4addr() from utils/mount/stropts.cChuck Lever2007-08-251-25/+0
| | | | | | | | 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>
* mount.nfs: Use get_client_addr() to build clientaddr= optionChuck Lever2007-08-251-9/+9
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Create a new API to find out client's addressChuck Lever2007-08-252-0/+47
| | | | | | | | | | | | 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>
* mount.nfs: Refactor parse_devname and fill_ipv4_addrChuck Lever2007-08-251-32/+34
| | | | | | | | | 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>
* mount.nfs: Use dynamically allocated character buffersChuck Lever2007-08-251-27/+58
| | | | | | | | | | | 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>
* mount.nfs: Remove get_my_ipv4addr() from append_addr_opt()Chuck Lever2007-08-251-3/+1
| | | | | | | | 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>
* mount.nfs: Don't allow the user to specify addr= or clientaddr=.Chuck Lever2007-08-251-8/+24
| | | | | | | | | | | | 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>
* mount.nfs: Fix nfs4mount_s prototype.Chuck Lever2007-08-251-2/+3
| | | | | | | | 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>
* mount.nfs: Combine two verbose messages into oneChuck Lever2007-08-241-10/+2
| | | | | | | A little less noise. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: getport() should avoid modifying passed-in argumentsChuck Lever2007-08-241-5/+9
| | | | | | | | 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>
* mount.nfs: Replace fork() with daemon() for backgrounding mountsChuck Lever2007-08-241-3/+8
| | | | | | | | | | 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>
* mount: Small tidy up.Neil Brown2007-08-241-3/+1
| | | | | | | 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>
* nfsstat: Add -S/--since flag.david m. richter2007-08-161-18/+134
| | | | | | | | | | | | | | | | 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>
* nfsstat: #define stat header labels.david m. richter2007-08-161-20/+35
| | | | | | | | | 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>
* nfsstat: Remove some pointer comparisons against global statinfos.david m. richter2007-08-161-12/+15
| | | | | | | | 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>
* nfsstat: Obviate and remove copy_stats().david m. richter2007-08-161-25/+18
| | | | | | | | | 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>
* nfsstat: rename *_tmp variables to *_old.david m. richter2007-08-161-19/+19
| | | | | | | | | 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>
* Restrict -i option to root.Neil Brown2007-08-111-0/+5
| | | | | | As it is still under development, don't expose it - just in case. Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Enable mount.nfs to do text-based mount supportChuck Lever2007-08-111-8/+30
| | | | | | | | | | | | | | | | | 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>
* mount.nfs: Add new files for supporting string-ified mount optionsChuck Lever2007-08-113-2/+358
| | | | | | | | | | | | | | 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>
* mount.nfs: Replace a "return 0; " that should be an "exit(0); "Chuck Lever2007-08-111-1/+1
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Treat another UDP/TCP pair of strings like the restChuck Lever2007-08-111-1/+1
| | | | | | | 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>
* umount.nfs: Update umount.nfs(8)Chuck Lever2007-08-101-4/+3
| | | | | | | 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>
* mount.nfs: Update the mount.nfs(8) man pageChuck Lever2007-08-102-21/+10
| | | | | | | 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>
* nfs-utils: specify a create mode with open(...O_CREAT) call in xflockJeff Layton2007-08-091-1/+1
| | | | | | | | | 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>
* Remove ARCH-specific compile flags for ALPHA.Neil Brown2007-08-091-2/+2
| | | | | | | | | | -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.