On Tue, 2025-07-15 at 10:58 +0200, Christoph Hellwig wrote: > On Mon, Jul 14, 2025 at 09:14:27AM -0400, Jeff Layton wrote: > > > + delegation_buckets = roundup_pow_of_two(nfs_delegation_watermark / 16); > > > + server->delegation_hash_mask = delegation_buckets - 1; > > > + server->delegation_hash_table = kmalloc_array(delegation_buckets, > > > + sizeof(*server->delegation_hash_table), GFP_KERNEL); > > > + if (!server->delegation_hash_table) > > > + goto out_free_server; > > > + for (i = 0; i < delegation_buckets; i++) > > > + INIT_HLIST_HEAD(&server->delegation_hash_table[i]); > > > + > > > > This is going to get created for any mount, even v3 ones. It might be > > better to only bother with this for v4 mounts. Maybe do this in > > nfs4_server_common_setup() instead? > > I tried that, but it crashes because the usual mount process goes > through nfs_clone_server, which then doesn't set up the hash table. > > I think the best idea is to pass the version to nfs_allocate_server > and just make this code conditional, but I'm open to other suggestions. The other thing you could do is move the allocation and setup into a helper function, and have nfs_clone_server() call that if the source server has a hashtable present. -- Jeff Layton <jlayton@xxxxxxxxxx>