summaryrefslogtreecommitdiffstats
path: root/utils/mountd
Commit message (Collapse)AuthorAgeFilesLines
...
* mountd: move export lookup into separate functionJ. Bruce Fields2010-01-131-38/+49
| | | | | | | | | | | Move this main loop to a separate function, to make it a little easier to follow the logic of the caller. Also, instead of waiting till we find an export to do the dns resolution, do it at the start; it will normally be needed anyway, and this simplifies the control flow. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* relax insecure option on mountdRobert Gordon2009-11-161-2/+1
| | | | | | | | | | | In nfs-utils 1.2.0, I noticed that the insecure option validates that the client port is a subset of IPPORT_RESERVED as opposed to just validating it is a valid reserved port. The following proposed patch would correct that issue. Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Robert Gordon <rbg@openrbg.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Don't give client an empty flavor listJ. Bruce Fields2009-08-241-0/+5
| | | | | | | | | | | | | | | | | | | | In the absence of an explicit sec= option on an export, rpc.mountd is returning a zero-length flavor list to clients in the MOUNT results. The linux client doesn't seem to mind, but the Solaris client (reasonably enough) is giving up; the symptom is a "security mode does not match" error on mount. We could modify the export-parsing code to ensure the secinfo array is nonzero. But I think it's slightly simpler to handle this default case in the implementation of the MOUNT call. This is more-or-less the same thing the kernel does when mountd passes it an export without any security flavors specified. Thanks to Tom Haynes for bug report and diagnosis. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* SinceJ. Bruce Fields2009-08-161-8/+6
| | | | | | | | | | | | | | | | | 2d77e3a27b7b211f303f.. "Fix bug when both crossmnt and fsid are set" Subexports automatically created by "crossmnt" get the NFSEXP_FSID flag cleared. That flag should also be cleared in the security-flavor-specific flag fields. Otherwise the kernel detects the inconsistent flags and rejects the export. The symptoms are clients hanging the first time they export a filesystem mounted under a filesystem that was exported with something like: /exports *(crossmnt,fsid=0,sec=krb5) Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* Retry export if getfh fails.NeilBrown2009-06-031-1/+10
| | | | | | | | | | | | | | mountd tries to avoid telling the kernel to export something when the kernel already knows to do that. However sometimes (exportfs -r) the kernel can be told to forget something without mountd realising. So if mountd finds that it cannot get a valid filehandle, make sure it really has been exported to the kernel. This only applies if the nfsd filesystem is not mounted. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* Replace the Sun RPC license with the BSD license,Tom spot Callaway2009-06-021-26/+25
| | | | | | | with the explicit permission of Sun Microsystems Signed-off-by: Tom "spot" Callaway <tcallawa@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Mountd should use separate lockfilesBen Myers2009-04-032-4/+14
| | | | | | | | | | | | | | | | Mountd keeps file descriptors used for locks separate from those used for io and seems to assume that the lock will only be released on close of the file descriptor that was used with fcntl. Actually the lock is released when any file descriptor for that file is closed. When setexportent() is called after xflock() he closes and reopens the io file descriptor and defeats the lock. This patch fixes that by using a separate file for locking, cleaning them up when finished. Signed-off-by: Ben Myers <bpm@sgi.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Include legacy or TI-RPC headers, not bothChuck Lever2009-03-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Data type incompatibilities between the legacy RPC headers and the TI-RPC headers mean we can't use libtirpc with code that was compiled against the legacy RPC headers. The definition of rpcprog_t for example is "unsigned long" in the legacy library, but it's "uint32_t" for TI-RPC. On 32-bit systems, these types happen to have the same width, but on 64-bit systems they don't, making more complex data structures that use these types in fields ABI incompatible. Adopt a new strategy to deal with this issue. When --enable-tirpc is set, append "-I/usr/include/tirpc" to the compilation steps. This should cause the compiler to grab the tirpc/ headers instead of the legacy headers. Now, for TI-RPC builds, the TI-RPC legacy functions and the TI-RPC headers will be used. On legacy systems, the legacy headers and legacy glibc RPC implementation will be used. A new ./configure option is introduced to allow system integrators to use TI-RPC headers in some other location than /usr/include/tirpc. /usr/include/tirpc remains the default setting for this new option. The gssd implementation presents a few challenges, but it turns out the gssglue library is similar to the auth_gss pieces of TI-RPC. To avoid similar header incompatibility issues, gssd now uses libtirpc instead of libgssglue if --enable-tirpc is specified. There may be other issues to tackle with gssd, but for now, we just make sure it builds with --enable-tirpc. Note also: svc_getcaller() is a macro in both cases that points to a sockaddr field in the svc_req structure. The legacy version points to a sockaddr_in type field, but the TI-RPC version points to a sockaddr_in6 type field. rpc.mountd unconditionally casts the result of svc_getcaller() to a sockaddr_in *. This should be OK for TI-RPC as well, since rpc.mountd still uses legacy RPC calls (provided by glibc, or emulated by TI-RPC) to set up its listeners, and therefore rpc.mountd callers will always be from AF_INET addresses for now. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Provide type-checked version of svc_getcaller()Chuck Lever2009-03-052-16/+11
| | | | | | | | | | | | | TI-RPC's version of the svc_getcaller() macro points to a sockaddr_in6, not a sockaddr_in, though for AF_INET callers, an AF_INET address resides there. To squelch compiler warnings when the TI-RPC version of the svc_req structure is used, add inline helpers with appropriate type casting. Note that tcp_wrappers support only AF_INET addresses for now. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Converted good_client() to correctly use the tcp wrapperSteve Dickson2009-03-041-1/+3
| | | | | | | interface and added a note to the mountd man page saying hostnames will be ignored when they can not be looked up. Signed-off-by: Steve Dickson <steved@redhat.com>
* Exportfs and rpc.mountd optimalizationTomas Richter2009-02-183-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | There were some problems with exportfs and rpc.mountd for long export lists - see https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=76643 I do optimalization as my bachelors thesis (Facuulty of informatics, Masaryk's university Brno, Czech Republic), under lead of Yenya Kasprzak. Both exportfs and rpc.mount build linked list of exports (shared functions in export.c). Every time they are inserting new export into list, they search for same export in list. I replaced linked list by hash table and functions export_add and export_lookup by functions hash_export_add and hash_export_lookup (export.c). Because some other functions required exportlist as linked list, hash table has some implementation modification im comparison with ordinary hash table. It also keeps exports in linked list and has pointer to head of the list. So there's no need of implementation function <for_all_in_hash_table>. Signed-off-by: Tomas Richter <krik3t@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: change "unknown host" error message to "unmatched host"Jeff Layton2008-09-291-1/+1
| | | | | | | | | | | | | mount request from unknown host 10.11.14.99 for /export The hosts are listed in DNS with proper reverse records, so the reason why the host is "unknown" isn't clear. This patch just changes the wording of this error to hopefully make it more clear why the mount request was rejected. This also makes this error message use a format more similar to the other error messages in auth_authenticate(). Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Determine supported pseudoflavors from exportJ. Bruce Fields2008-08-281-17/+38
| | | | | | | | Instead of using a static list of supported flavors, we should be taking the list from the export. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* Minor mountd.c cleanupJ. Bruce Fields2008-08-281-38/+49
| | | | | | | | | I find it more readable to have the normal (non-error) case unindented, and to keep conditionals relatively simple, as is the usual kernel style. Fix some inconsistent indentation while we're there. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* Remove redundant m_path fieldJ. Bruce Fields2008-08-282-13/+3
| | | | | | | | | | | | | | | | | Contrary to the comment above its definition, the field m_path always has the same value as e_path: the *only* modifications of m_path are all of the form: strncpy(exp->m_export.m_path, exp->m_export.e_path, sizeof (exp->m_export.m_path) - 1); exp->m_export.m_path[sizeof (exp->m_export.m_path) - 1] = '\0'; So m_path is always just a copy of e_path. In places where we need to store a path to a submount of a CROSSMNT-exported filesystem, as in cache.c, we just use a local variable. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* Use fsid from statfs for UUID if blkid can't cope (or not used)David Woodhouse2008-08-281-2/+11
| | | | | Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Explicit UUID handling doesn't require blkid; factor out get_uuid_blkdev()David Woodhouse2008-08-281-36/+41
| | | | | Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Fix handling of explicit uuidDavid Woodhouse2008-08-281-1/+3
| | | | | | | | | | | Fix a couple of bugs which show up if you try to explicitly set a 16-byte UUID when exporting a file system. First, exportfs cuts the first two bytes off the UUID and writes something invalid to etab. Second, mountd writes the _ascii_ form of the UUID to the kernel, instead of converting it to hex. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount issue with Mac OSX and --manage-gids, client hangsNeil Brown2008-08-271-1/+3
| | | | | | | | | Make sure are zero len group list is sent down to the kernel when the gids do not exist on the server. Tested-by: Alex Samad <alex@samad.com.au> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* There were 2 things wrong with auth flavour ordering:bc Wong2008-03-181-1/+8
| | | | | | | | | | | | | | | | | | | | | | - Mountd used to advertise AUTH_NULL as the first flavour on the list, which means that it prefers AUTH_NULL to anything else (as per RFC 2623 section 2.7). - Mount.nfs used to scan the returned list in reverse order, and stopping at the first AUTH_NULL or AUTH_SYS encountered. If a server advertises (AUTH_SYS, AUTH_NULL), it will by default choose AUTH_NULL and have degraded access. I've fixed mount.nfs to scan from the beginning. For mountd, it does not advertise AUTH_NULL anymore. This is necessary to avoid backward compatibility issue. If AUTH_NULL appears in the list, either the new or the old client will choose that over AUTH_SYS. Tested the server/client combination against the previous versions, as well as Solaris and FreeBSD. Signed-off-by: bc Wong <bcwong@cisco.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Stop rpc.mountd from probing all known devices which causesSteinar H. Gunderson2008-03-131-2/+0
| | | | | | | idle disks to spin up for basically no reason. Signed-off-by: Steinar H. Gunderson <sgunderson@bigfoot.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* In mountd, if get_exportlist() (utils/mountd/mountd.c) returns NULL itHarshula Jayasuriya2008-02-121-9/+7
| | | | | | | | | | | | | | should not be considered a failure. It just means that there are no exports on the system. The practical problem with the current code is that a showmount -e results in a syslog message from mountd that looks like: rpc.mountd: export request from 10.250.100.2 failed. Reviewed-by: Greg Banks <gnb@sgi.com> Signed-off-by: Harshula Jayasuriya <harshula@sgi.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Cleaned up some typos that were found in the variousFrank Filz2008-02-091-5/+7
| | | | | | | places in the mountd code. Signed-off-by: Steve Dickson <steved@redhat.com> Signed-off-by: Frank Filz <ffilzlnx@us.ibm.com>
* Fix bug when both crossmnt and fsid are set.Steve Dickson2008-01-191-3/+8
| | | | | | | | | When exported a filesystems with option inherited (by the crossmnt option) from a higherlevel filesystem, ignore filesystem specific options like FSID and explicit UUID. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* Automatically set 'nohide' on referral exports.Steve Dickson2008-01-091-1/+10
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* Fixed typo in rpc.mountd's man pageSteve Dickson2008-01-071-1/+1
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* When mountd gets a request to export a mountpoint which is notSteve Dickson2007-11-031-1/+1
| | | | | | | | | | | | | explicitly exported, but is below an export point that is flagged as "crossmnt", it passes the wrong path name to the kernel for the "filehandle -> directory" mapping. This can badly confuse the NFS client, and is certainly wrong. So use the correct path names. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: address a minor compiler warningChuck Lever2007-10-121-1/+1
| | | | | | | | | | | auth.c: In function ‘auth_authenticate’: auth.c:190: warning: ‘error’ may be used uninitialized in this function "error" is used as an output parameter, but the compiler has no way of knowing that. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mountd: eliminate a spurious compiler warningChuck Lever2007-10-121-1/+1
| | | | | | | auth.c:61: warning: function declaration isn’t a prototype Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* 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-282-8/+6
| | | | | | | | | | | | | | 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: Change nfs_client->m_hostname to be a dynamically-allocated stringJeff Layton2007-09-281-2/+7
| | | | | | | | | | | 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>
* fix regression with rmtab handling in newer nfs-utils codeJeff Layton2007-08-071-3/+1
| | | | | | | | | 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>
* Support sec= option to specify export securityJ. Bruce Fields2007-07-101-0/+21
| | | | | | | | | | | 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>
* nfs-utils: have mountd hold open etab file to force inode number to changeJeff Layton2007-05-113-15/+26
| | | | | | | | | | | | | 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>
* update manpages for showmount and mountdJeff Layton2007-05-081-0/+7
| | | | | | | | 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. Signed-off-by: Jeff Layton <jlayton@redhat.com>
* mountd - improve checks and error messages for export failure.Neil Brown2007-04-021-6/+18
| | | | | | | | | | | If an attempt is made to export a non-(dir|file), just ignore it. This should get caught by exportfs. If an attempt is made to export a non-exportable filesystem, report an error. Hopefully exportfs can trap some these as well, but catching them in mountd as well is good. Signed-off-by: Neil Brown <neilb@suse.de>
* mountd - better response to failed attempts to export filesystemsNeil Brown2007-03-291-3/+6
| | | | | | | | | | If the kernel rejects an attempt to export a filesystem - e.g. because it is not exportable, we shouldn't just ignore the error, but rather should tell the kernel that the relevant filehandle or path cannot be supported. We should really print out some error messages too. Signed-off-by: Neil Brown <neilb@suse.de>
* Allow disabling of libblkid usage.Neil Brown2007-03-201-0/+10
| | | | | | | Some versions of libblkid have a terrible memory leak which makes mounted grow toooo big. So support --disable-uuid to remove the uuid functionality and liblkid with it.
* When finding an export for an fsid, check submounts too.Neil Brown2007-03-191-10/+63
| | | | | | When looking for the exportpoint to match a given fsid, if an NFSEXP_CROSSMOUNT export is found, also check all filesystems mounted below there.
* Handle 'crossmnt' when kernel asked for export options for a directory.Neil Brown2007-03-191-1/+26
| | | | | | | If the kernel finds a mountpoint below a 'crossmnt' export, it will ask mounted what export options to use. With this patch it will return the same export options as for the top 'crossmnt' export unless more specific options have been given.
* Allow exporting of a subfilesystem when 'crossmnt' is set.Neil Brown2007-03-192-10/+50
| | | | | | | | | If we are asked to export a filesystem which is not explicitly exported, but an ancestor is exported as 'crossmnt', export the filesystems with the same options as the ancestor. This is the first step to making 'crossmnt' effectively export a tree of filesystems.
* Work around svc_getreqset in glibc 3Neil Brown2007-03-191-0/+26
| | | | | | Without this fix, mountd ignores sockets with filedescriptor > 31, so if there are more than about 26 concurrent connections, mountd starts spinning.
* Make warning about host matching multiple exports more helpful.Neil Brown2007-03-191-3/+5
| | | | | 1/ only warn once per export, as it could get too noisy. 2/ make it a little clearer why this might be a problem.
* Don't complain if two exports of different types match the same IP address.Neil Brown2007-03-161-2/+4
| | | | | | | As nfs-utils as an ordering of client types (hostname, netmask, wildcard, netgroup), it is expected that sometimes the one IP will match two or more of these and the first will over-ride. So don't both complaining when that happens.
* Remove "maptype" supportJ. Bruce Fields2007-03-151-6/+0
| | | | | | | | It appears that this is used only by unfsd, and is obscure enough that we should be able to just rip it out with no special precautions. Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@suse.de>
* Use very long timeout for information in the filehandle->path cache.Simon Peter2007-03-131-1/+9
| | | | | | | | | | | | | /* The fsid -> path lookup can be quite expensive as it * potentially stats and reads lots of devices, and some of those * might have spun-down. The Answer is not likely to * change underneath us, and an 'exportfs -f' can always * remove this from the kernel, so use a really log * timeout. Maybe this should be configurable on the command * line. */ Signed-off-by: Neil Brown <neilb@suse.de>
* Fix silly bug with gid lookupNeil Brown2007-02-271-1/+1
| | | | | | | Wrong pointer test meant mountd would alway do gid lookups instead of only if asked to with '-g'. Signed-off-by: Neil Brown <neilb@suse.de>
* Extend the exportfs/mountd interface to pass fslocations info into the kernelFred Isaman2007-02-271-8/+12
| | | | | | | | Fix up a few issues with the fsloc code. Signed-off-by: Fred Isaman <iisaman@citi.umich.edu> Signed-off-by: Kevin Coffman <kwc@citi.umich.edu> Signed-off-by: Neil Brown <neilb@suse.de>