@@ -76,6 +76,9 @@ static void nfsd_inject_set_client(struct nfsd_fault_inject_op *op,
u64 count;
struct nfsd_net *nn = net_generic(current->nsproxy->net_ns, nfsd_net_id);
+ if (!nfsd_netns_ready(nn))
+ return;
+
nfs4_lock_state();
clp = nfsd_find_client(nn, addr, addr_size);
if (clp) {
@@ -83,5 +83,8 @@ struct nfsd_net {
struct delayed_work laundromat_work;
};
+/* Simple check to find out if a given net was properly initialized */
+#define nfsd_netns_ready(nn) ((nn)->sessionid_hashtbl)
+
extern int nfsd_net_id;
#endif /* __NFSD_NETNS_H__ */
@@ -4739,6 +4739,9 @@ u64 nfsd_for_n_state(u64 max, u64 (*func)(struct nfsd_net *, struct nfs4_client
u64 count = 0;
struct nfsd_net *nn = net_generic(current->nsproxy->net_ns, nfsd_net_id);
+ if (!nfsd_netns_ready(nn))
+ return 0;
+
list_for_each_entry_safe(clp, next, &nn->client_lru, cl_lru) {
count += func(nn, clp, max - count);
if ((max != 0) && (count >= max))