patch-2.1.86 linux/fs/nfsd/export.c

Next file: linux/fs/sysv/CHANGES
Previous file: linux/fs/minix/namei.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.85/linux/fs/nfsd/export.c linux/fs/nfsd/export.c
@@ -616,26 +616,28 @@
 	svc_client	**clpp, *clp;
 	int		err;
 
+	err = -EINVAL;
 	if (!exp_verify_string(ncp->cl_ident, NFSCLNT_IDMAX))
-		return -EINVAL;
+		goto out;
 
 	/* Lock the hashtable */
 	if ((err = exp_writelock()) < 0)
-		return err;
+		goto out;
 
+	err = -EINVAL;
 	for (clpp = &clients; (clp = *clpp); clpp = &(clp->cl_next))
 		if (!strcmp(ncp->cl_ident, clp->cl_ident))
 			break;
 
-	if (!clp) {
-		exp_unlock();
-		return -EINVAL;
+	if (clp) {
+		*clpp = clp->cl_next;
+		exp_freeclient(clp);
+		err = 0;
 	}
-	*clpp = clp->cl_next;
-	exp_freeclient(clp);
 
 	exp_unlock();
-	return 0;
+out:
+	return err;
 }
 
 /*
@@ -750,6 +752,8 @@
 		while (clnt_hash[i])
 			exp_freeclient(clnt_hash[i]->h_client);
 	}
+	clients = NULL; /* we may be restarted before the module unloads */
+	
 	exp_unlock();
 	dprintk("nfsd: export shutdown complete.\n");
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov