summaryrefslogtreecommitdiffstats
path: root/utils/mountd/cache.c
Commit message (Collapse)AuthorAgeFilesLines
* mountd: Add lookup_export_parent()Chuck Lever2012-10-221-9/+70
| | | | | | | | | | | | | | | | | | In a moment I will be adding some logic that needs to know an junction's parent export. Here's a function that can discover an export's parent. It takes the target export's pathname, chops off the rightmost component, and tries a lookup_export(). If that succeeds, we have our answer. If not, it chops off the next rightmost component and tries again, until the root is reached. At the same time, infrastructure is added to pass the parent export down into the functions that convert locations into a new junction export entry. For now the parent export remains unused. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Set e_fslocdata field directlyChuck Lever2012-10-221-14/+23
| | | | | | | | | | | | | | | | | | | To create an export entry for a junction, an options string is constructed from the set of locations in the junction. This options string is then passed to mkexportent() where it is parsed and converted into an exportent. There is only one export option that is used to create a junction's exportent: "refer=". When that option is parsed, it's value is simply copied to a fresh string and planted in the new export's e_fslocdata field. Let's avoid the option parsing and extra string copy. Construct a string for the new e_fslocdata field and plant it in the exportent directly. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Use static buffer when constructing junction export optionsChuck Lever2012-10-221-31/+5
| | | | | | | | | | | | Clean up: Simplify locations_to_export() by constructing a junction's export options in a static buffer. We can do this because all of this code is called serially, in one thread, and the result is thrown away immediately after the caller is finished. The returned exportent itself is static. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Warn when a broken junction is encounteredChuck Lever2012-10-221-5/+14
| | | | | | | | A broken junction is a problem that administrators will want to know about and correct. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: handle allocation failures in auth_unix_ip upcallJ. Bruce Fields2012-05-031-3/+9
| | | | | | | From: "J. Bruce Fields" <bfields@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: prepend '$' to make use_ipaddr clients self-describingJ. Bruce Fields2012-05-031-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From: "J. Bruce Fields" <bfields@redhat.com> Mountd is responsible for filling three interrelated kernel caches: - auth_unix_ip maps an incoming ip addresses to a "domain". - nfsd_fh maps (domain, filehandle-fragment) pairs to paths. - nfsd_export maps (domain, path) pairs to export options. Note that each export is assocated with a "client" string--the part before the parentheses in an /etc/export line--which may be a domain name, a netgroup, etc. The "domain" string in the above three caches may be either: - in the !use_ipaddr case, a comma-separated list of client strings. - in the use_ipaddr case, an ip address. In the former case, mountd does the hard work of matching an ip address to the clients when doing the auth_unix_ip mapping. In the latter case, it delays that until the nfsd_fh or nfsd_export upcall. We're currently depending on being able to flush the kernel caches completely when switching between the use_ipaddr and !use_ipaddr cases. However, the kernel's cache-flushing doesn't really provide reliable guarantees on return; it's still possible we could see nfsd_fh or nfsd_export upcalls with the old domain-type after flushing. So, instead, make the two domain types self-describing by prepending a "$" in the use_ipaddr case. Reviewed-by: NeilBrown <neilb@suse.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: add trivial helpers for client-matchingJ. Bruce Fields2012-05-031-10/+2
| | | | | | | | | | | From: "J. Bruce Fields" <bfields@redhat.com> Pull out a tiny bit of common logic from three functions. Possibly minor overkill, but simplifies the next patch. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: parse ip address earlierJ. Bruce Fields2012-05-031-18/+22
| | | | | | | | | | | | | | I don't see the point of waiting to the last minute to parse the ip address. If the client name isn't a legal ip address then this will fail fairly quickly, so there's not much of a performance penalty. Also, note the previous code incorrectly assumed client_resolve would always return non-NULL. Also factor out some common code. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: fix export upcall failure in use_ipaddr caseJ. Bruce Fields2012-05-031-0/+1
| | | | | | | | | | | | | After 0509d3428f523 "mountd: Replace "struct hostent" with "struct addinfo"", the export upcall fails in the use_ipaddr case. I think we never noticed because a) the use_ipaddr case is rarer than the !use_ipaddr case, and b) the nfsd_fh upcall does a preemptive export downcall that renders the nfsd export call unnecessary in some cases. Cc: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsd_fh: if two exports are possible, choose the one without V4ROOTNeilBrown2012-05-011-1/+10
| | | | | | | | | | | | | | | | | | | | | When nfsd_fh it looking for an export for a particular client and file-handle, it might find two exports for the same path: one with NFSEXP_V4ROOT, one with out. As nfsd_fh calls cache_export_ent to give the export information to the kernel it much choose the same export that auth_authenticate chooses for get_rootfh which it also passes cache_export_ent (via cache_export). i.e. it must choose the non-V4ROOT on where possible. Also change strcmp(foo, bar) to strcmp(foo, bar) == 0 because I have a pathological fear of the former. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* lookup_export: really prefer nonV4ROOT exports.NeilBrown2012-05-011-3/+7
| | | | | | | | | | | | lookup_export() claims to "Always prefer non-V4ROOT mounts" (meaning "exports") but actually prefers V4ROOT exports - once it has 'found' one it will never replace it. So fix that inversion, and add code so that it proactively prefers a non-V4ROOT whether it is found before or after a V4ROOT. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Support junction management plug-insChuck Lever2012-01-051-1/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To support FedFS and NFS junctions without introducing additional build-time or run-time dependencies on nfs-utils, the community has chosen to use a dynamically loadable library to handle junction resolution. There is one plug-in library for mountd that will handle any NFS- related junction type. Currently there are two types: o nfs-basic locally stored file set location data, and o nfs-fedfs file set location data stored on an LDAP server mountd's support for this library is enabled at build time by the presence of the junction API definition header: /usr/include/nfs-plugin.h If this header is not found on the build system, mountd will build without junction support, and will operate as before. Note that mountd does not cache junction resolution results. NFSD already caches these results in its exports cache. Thus each time NFSD calls up to mountd, it is, in essence, requesting a fresh junction resolution operation, not a cached response. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: move fsidtype-specific code to helpersJ. Bruce Fields2011-06-271-111/+129
| | | | | | | Now we can move these big switch statements into helper functions. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: gather fsid information into one structJ. Bruce Fields2011-06-271-34/+45
| | | | | | | | | | | | A large part of nfsd_fh() is concerned with extracting fsid-type-specific information from the fsid, then matching that information with information from the export list and the filesystem. Moving all that information into one struct will allow some further simplifications. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: prefer explicit subexports over crossmnt parentsJ. Bruce Fields2011-06-271-3/+15
| | | | | | | | | | | | | | If a parent is exported with crossmnt, and if a child is also explicitly exported, then both exports could potentially produce matches in this loop; that isn't a bug. Instead of warning and ignoring the second match we find, we should instead prefer whichever export is deeper in the tree, so that children's options can override those of their parents. Reported-by: Olga Kornievskaia <aglo@citi.umich.edu> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Fix missing varialble assignment in auth_unix_gidPavel Shilovsky2011-06-071-2/+4
| | | | | | | | | When we get into auth_unix_gid at the second time, groups_len is not 0 and ngroups variable leave as 0. Then we use ngroups in getgrouplist that fails in this case. This patch fixes it. Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve Dickson <steved@redhat.com>
* Removed compilation warnings from mountd/cache.cJim Rees2011-05-181-5/+5
| | | | | | | Commit 5604b35a6 introduced a number of missing initializer warnings that were missed. This patch removes those warnings. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Increase the stdio file buffer size for procfs filesSean Finney2011-04-191-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, when writing to /proc/net/rpc/*/channel, if a cache line were larger than the default buffer size (likely 1024 bytes), mountd and svcgssd would split writes into a number of buffer-sized writes. Each of these writes would get an EINVAL error back from the kernel procfs handle (it expects line-oriented input and does not account for multiple/split writes), and no cache update would occur. When such behavior occurs, NFS clients depending on mountd to finish the cache operation would block/hang, or receive EPERM, depending on the context of the operation. This is likely to happen if a user is a member of a large (~100-200) number of groups. Instead, every fopen() on the procfs files in question is followed by a call to setvbuf(), using a per-file dedicated buffer of RPC_CHAN_BUF_SIZE length. Really, mountd should not be using stdio-style buffered file operations on files in /proc to begin with. A better solution would be to use internally managed buffers and calls to write() instead of these stdio calls, but that would be a more extensive change; so this is proposed as a quick and not-so-dirty fix in the meantime. Signed-off-by: Sean Finney <sean.finney@sonyericsson.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Use a dynamic buffer for storing lists of gid'sSean Finney2011-04-191-9/+20
| | | | | | | | | | | | | Previously, in auth_unix_gid, group lists were stored in an array of hard-coded length 100, and in the situation that the group lists for a particular call were too large, the array was swapped with a dynamically allocated/freed buffer. For environments where users are commonly in a large number of groups, this isn't an ideal approach. Instead, use malloc/realloc to grow the list on an as-needed basis. Signed-off-by: Sean Finney <sean.finney@sonyericsson.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exports: add a configurable time-to-live for the kernel cache entriesChuck Lever2011-04-061-7/+8
| | | | | | | | | | | | | | | | | | | | | | From: Trond Myklebust <Trond.Myklebust@netapp.com> The fedfs ldap server will specify a ttl for its entries. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> This is a refactoring change only. There should be no change in behavior. Original patch had updates to utils/mountd/junctions.c, which no longer exists. These are not included here. Create a macro for the default cache TTL, which is used in several places besides the export cache. Make e_ttl unsigned. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Ensure cache downcall can handle IPv6 addressesChuck Lever2010-09-161-1/+1
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Handle IPv6 addresses in kernel auth_unix_ip upcallsChuck Lever2010-09-161-3/+3
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: clean up cache APIChuck Lever2010-09-161-10/+39
| | | | | | | | | | | | | | | | | | | | | | | Clean up: Squelch compiler warnings and document public parts of cache API. cache.c: At top level: cache.c:67: warning: no previous prototype for auth_unix_ip cache.c:123: warning: no previous prototype for auth_unix_gid cache.c:217: warning: no previous prototype for get_uuid cache.c:247: warning: no previous prototype for uuid_by_path cache.c:326: warning: no previous prototype for nfsd_fh cache.c:745: warning: no previous prototype for nfsd_export cache.c:820: warning: no previous prototype for cache_open cache.c:832: warning: no previous prototype for cache_set_fd cache.c:841: warning: no previous prototype for cache_process_req cache.c:921: warning: no previous prototype for cache_export cache.c:953: warning: no previous prototype for cache_get_filehandle Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Removed warnings from cache.cSteve Dickson2010-08-091-9/+9
| | | | | | | | | | | | | | | | | | cache.c:812: warning: missing initializer cache.c:812: warning: (near initialization for 'cachelist[0].f') cache.c:813: warning: missing initializer cache.c:813: warning: (near initialization for 'cachelist[1].f') cache.c:814: warning: missing initializer cache.c:814: warning: (near initialization for 'cachelist[2].f') cache.c:815: warning: missing initializer cache.c:815: warning: (near initialization for 'cachelist[3].f') cache.c:816: warning: missing initializer cache.c:816: warning: (near initialization for 'cachelist[4].f') cache.c: In function 'cache_export_ent': cache.c:887: warning: comparison between signed and unsigned integer expressions cache.c:907: warning: comparison between signed and unsigned integer expressions Signed-off-by: Steve Dickson <steved@redhat.com>
* Removed warnings from fsloc.cSteve Dickson2010-08-091-1/+1
| | | | | | | fsloc.c: In function 'replicas_lookup': fsloc.c:149: warning: unused parameter 'key' Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Fix memcmp result comparison error for uuid match.Doug Nazar2010-07-191-1/+1
| | | | | | Fixed Small typo in the new fs uuid comparison code Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Replace "struct hostent" with "struct addrinfo"Chuck Lever2010-06-221-29/+37
| | | | | | | | | | | | | | | | | | | struct hostent can store either IPv4 or IPv6 addresses, but it can't store both address families concurrently for the same host. Neither can hostent deal with parts of socket addresses that are outside of the sin{,6}_addr field. Replace the use of "struct hostent" everywhere in libexport.a, mountd, and exportfs with "struct addrinfo". This is a large change, but there are so many strong dependencies on struct hostent that this can't easily be broken into smaller pieces. One benefit of this change is that hostent_dup() is no longer required, since the results of getaddrinfo(3) are already dynamically allocated. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Add helpers to manage DNS lookupsChuck Lever2010-06-221-2/+4
| | | | | | | | | | | | | | | Introduce DNS query helpers based on getaddrinfo(3) and getnameinfo(3). These will eventually replace the existing hostent-based functions in support/export/hostname.c. Put some of these new helpers to immediate use, where convenient. As they are part of libexport.a, I've added the forward declarations for these new functions in exportfs.h rather than misc.h, where the hostent-based forward declarations are currently. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Improve support for exporting btrfs subvolumesNeilBrown2010-06-221-29/+78
| | | | | | | | | | | | | | | | | | | If you export two subvolumes of a btrfs filesystem, they will both be given the same uuid so lookups will be confused. blkid cannot differentiate the two, so we must use the fsid from statfs64 to identify the filesystem. We cannot tell if blkid or statfs is best without knowing internal details of the filesystem in question, so we need to encode specific knowledge of btrfs in mountd. This is unfortunate. To ensure smooth handling of this and possible future changes in uuid generation, we add infrastructure for multiple different uuids to be recognised on old filehandles, but only the preferred on is used on new filehandles. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd/exportfs: Make m_addrlist field a nfs_sockaddrChuck Lever2010-05-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | To store non-AF_INET addresses in the nfs_client structure, we need to use more than in_addr for the m_addrlist field. Make m_addrlist larger, then add a few helper functions to handle type casting and array indexing cleanly. We could treat the nfs_client address list as if all the addresses in the list were the same family. This might work for MCL_SUBNETWORK type nfs_clients. However, during the transition to IPv6, most hosts will have at least one IPv4 and one IPv6 address. For MCL_FQDN, I think we need to have the ability to store addresses from both families in one nfs_client. Additionally, IPv6 scope IDs are not part of struct sin6_addr. To support link-local IPv6 addresses and the like, a scope ID must be stored. Thus, each slot in the address list needs to be capable of storing an entire socket address, and not simply the network address part. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: trivial: name parameters for clarityJ. Bruce Fields2010-03-081-4/+4
| | | | | | | | | | Part of the reason for the previous bug was confusion between "subpath" and "path"; which is the shorter path, and which the longer? "child" and "parent" seem less ambiguous. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: fix path comparison for v4 crossmntJ. Bruce Fields2010-03-081-1/+1
| | | | | | | | This was obviously wrong, since path[strlen(path)] == '\0' should always be true. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: fix --manage-gids hang due to int/uint bugSteve Dickson2010-03-081-7/+7
| | | | | | | | | | | | | A uid or gid should be represented as unsigned, not signed. The conversion to signed here could cause a hang on access by an unknown user to a server running mountd with --manage-gids; such a user is likely to be mapped to 232-1, which may be converted to 231-1 when represented as an int, resulting in a downcall for uid 231-1, hence the original rpc hanging forever waiting for a cache downcall for 232-1. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: prefer non-V4ROOT exports.J. Bruce Fields2010-01-131-0/+5
| | | | | | | | | | | | | | | | | | | If paths A and A/B are both exported, then we have a choice of exports to return for A (or under A but still above A/B): we could return A itself, or we could return a V4ROOT export leading to B. For now, we will always prefer the non-V4ROOT export, whenever that is an option. This will allow clients to reach A/B as long as adminstrators keep to the rule that the security on a parent permits the union of the access permitted on any descendant. In the future we may support more complicated arrangements. (Note: this can't be avoided by simply not creating v4root exports with the same domain and path, because different domains may have some overlap.) Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* mountd: don't require mountpoint in crossmnt caseJ. Bruce Fields2010-01-131-2/+1
| | | | | | | | | | | | | | | | Currently, mount --bind /path /path where /path is a subdirectory of a crossmnt export, can cause client hangs, since the kernel detects that as a mountpoint, but nfs-util's is_mountpoint() function does not. I don't see any sure-fire way to detect such mountpoints. But that's OK: it's harmless to allow this upcall to succeed even when the directory is not a mountpoint, so let's just remove this check. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
* 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>