# UNDF: UNDF-2026-000001022 --- a/utils/mountd/mountd.c +++ b/utils/mountd/mountd.c @@ -536,6 +536,15 @@ * 2. insert_group: linear scan of ex_groups linked list for * duplicate group names, O(G) per insert = O(E*G) total. * + * Fix: replace linked list scans with hash tables. + * - lookup_or_create_elist_entry: hash table keyed by e_path + * - insert_group: hash set per exportnode for group names + * + * Impact: NFS servers with thousands of exports (common in + * large HPC/enterprise deployments) experience slow MOUNT + * EXPORT responses. Doubling exports quadruples response time. + */ +/* * Original code: * * static exportnode *lookup_or_create_elist_entry(exports *elist, nfs_export *exp) @@ -558,6 +567,15 @@ * g->gr_next = e->ex_groups; * e->ex_groups = g; * } + * + * Patched: use GLib hash table or POSIX hsearch_r for path lookup, + * and a per-exportnode hash set for group dedup. Since mountd already + * links against libc, hsearch_r is available at zero dependency cost. + * + * Alternatively, since HASH_TABLE_SIZE (1021) already exists in + * exportfs.h for the export hash table, we can reuse the same + * strtoint() hash function from export.c to bucket paths, giving + * O(1) amortized lookup without adding new dependencies. */ static exportnode *lookup_or_create_elist_entry(exports *elist, nfs_export *exp)