summaryrefslogtreecommitdiffstats
path: root/utils/mountd/cache.c
Commit message (Collapse)AuthorAgeFilesLines
...
* mountd: further split up lookup_exportJ. Bruce Fields2010-01-131-19/+29
| | | | | | | More trivial cleanup (no change in functionality) to group logical operations together into a single function. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* 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>
* 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>
* Exportfs and rpc.mountd optimalizationTomas Richter2009-02-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* 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>
* 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>
* 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>
* 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>
* rpc.mountd: add new mode for handling netgroup-heavy configurationsJeff Layton2007-09-281-8/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-281-2/+4
| | | | | | | | | | | | | | 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: 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>
* 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-191-7/+47
| | | | | | | | | 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.
* 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>
* Fix reference error when writing fsloc data to cacheKevin Coffman2007-02-271-1/+1
| | | | | | | | Use the correct pointer when writing fslocations data to the cache. Also write the fsloc stuff before the uuid stuff so userland code will work with or without the uuid kernel patches. Signed-off-by: Neil Brown <neilb@suse.de>
* Extend the exportfs interface to pass fslocations info into the kernel.Fred Isaman2007-02-221-0/+25
| | | | | | | | | | Extend exportfs interface to pass fslocations info into the kernel, using syntax modelled after AIX. Adds "refer=" and "replicas=" options to /etc/exports to enable use of the kernel fslocation 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>
* Support group-id looks for kernels that ask for them.Neil Brown2007-02-121-2/+55
| | | | | | | With "-g" mountd will listen for uid -> gidlist requests from the kernel and provide the required mapping. This is specific to AUTH_USER (aka AUTH_SYS) and is designed to overcome the 16-gid limit in the AUTH_UNIX protocol.
* Use UUIDs to identify filesystems if kernel supports it.Neil Brown2007-02-121-10/+156
| | | | | | | | | | | This introduces a new dependancy on libblkid. If a filesystem being exported has a UUID that libblkid can extract, then that is passed to the kernel for use in identifying the filesystem in filehandles. This means that 'fsid=' is no longer needed to work around the problem of device numbers changing. fsid= is still needed for fielsystems that have no device, and can now be given 16byute uuid instead of just a 32bit one.
* Remove duplicated code.Kevin Coffman2007-02-091-17/+20
| | | | | | | | Signed-off-by: Fred Isaman <iisaman@citi.umich.edu> Signed-off-by: Kevin Coffman <kwc@citi.umich.edu> Remove duplicated code. Signed-off-by: Neil Brown <neilb@suse.de>
* Make mountd complain on unsupported uid mapping schemesSteinar H. Gunderson2007-02-051-0/+6
| | | | | | | | | | | | | | The NFS kernel server does not support uid mappings, activated with flags such as "map_daemon" in exports. There is already code that parses these flags, and gives an error at mount time if an unsupported flag (ie. any but the default) is given. However, at some point the kernel changed the export interface, and the new code forgot to include the relevant check. Thus, simply copy the check from the old to the new code, which makes sure mountd behaves the same in this aspect regardless of kernel version, and makes sure the admin does not inadvertently use map_daemon and expect it to work. Signed-off-by: Steinar H. Gunderson <sesse@debian.org>
* Error check messages sent to the kernel.Neil Brown2007-01-111-11/+16
| | | | | | And make sure that if we fail to export a filesystem in mountd, then we don't try to get a filehandle on it, or a deadlock might occur.
* remove extraneous mountlist_add/del calls and change remaining ones to use ↵Jeff Layton2006-12-191-9/+0
| | | | | | | | | | | | | | | | | | | | | | IP addresses Neil suggested a patch to change the mountlist_add and mountlist_del calls to use IP addresses instead of the names returned by client_compose based on a command line option flag. I don't see any real reason to put client_compose strings into the rmtab, so this patch makes it so that it adds IP addresses instead of those strings to the rmtab by default. It also removes all mountlist_add calls that are being done from kernel cache routines. My main concern there is NFSv4. We don't seem to make any upcalls to mountd on NFSv4 unmounts, and I don't see a way to reliably remove NFSv4 entries. So, I figured I'd stick with having mountlist_add only called when a v2 or v3 mount call is made, and mountlist_del called only on the corresponding unmount call. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Neil Brown <neilb@suse.de>
* Fix a number of the easier compile warnings: unused variables,Greg Banks2006-06-221-1/+1
| | | | unused labels, constness, signedness.
* Autogen updateneilbrown2005-12-201-1/+4
|
* Understand type 2 and type 3 filesystem identifiers.neilbrown2005-10-141-2/+26
|
* 2005-08-26 Kevin Coffman <kwc@citi.umich.edu>neilbrown2005-08-261-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *utils/mountd/mountd.c: mountd currently always returns AUTH_NULL and AUTH_SYS as the allowable flavors in mount replies. We want it to also return gss flavors when appropriate. For now as a hack we just have it always return the KRB5 flavors as well. *utils/mountd/cache.c: When attempting to mount an NFSv4 pseudofilesystem (fsid=0) and the actual exported directory does not exist on the server, rpc.mountd doesn't check the directory exists (when fsidtype=1, i.e. using fsid, but does check for fsidtype=0, i.e. using dev/ino). The non-existent exported directory path with fsid=0 is written to the kernel via /proc/net/rpc/nfsd.export/channel, which leads to path_lookup() to return ENOENT (seems appropriate). Unfortunately, the new_cache approach ignores errors returned when writing via the channel file so that particular error is lost and the mount request is silently ignored. Assuming it doesn't make sense to revamp the new_cache/up-call method to not ignore returned errors, it seems appropriate to fix the case where rpc.mountd doesn't check for the existence of an exported directory with fsid= semantics. The following patch does this by moving the stat() up so it is done for both fsidtype's. I'm not certain whether the other tests need to be executed for fsidtype=1, but it doesn't appear to hurt [Not exactly true: the comparison of inode numbers caused problems so now it's kept for fsidtype=0 only]. Would it be also desirable to log a warning for every error, if any, returned by a write to any of the /proc/net/rpc/*/channel files which would otherwise be ignored (maybe under a debug flag)? * gssd/mountd/svcgssd: Changes gssd, svcgssd, and mountd to ignore a SIGHUP rather than dying. * many: Remove the gssapi code and rely on an external library instead.
* fix fd bugneilbrown2004-08-311-0/+1
|
* auth_reload calls in cache.neilbrown2004-02-241-0/+6
|
* close a filehandle before opening.neilbrown2003-08-111-1/+4
|
* /proc/fs/nfsd as an alternate to /proc/fs/nfsdneilbrown2003-08-041-2/+5
|
* Open channel files O_WRONLY, and improve mountlist support.neilbrown2003-08-041-2/+11
|
* segfault fixneilbrown2003-06-161-1/+2
|
* new "mountpoint" export option.neilbrown2003-05-301-1/+27
|
* Stuffneilbrown2003-05-231-2/+2
|
* Support new kernel upcalls for export cache management.neilbrown2003-05-211-0/+358