Re: 2.1.85 : Oops with knfsd

Bill Hawes (whawes@star.net)
Fri, 06 Feb 1998 15:47:31 -0500


This is a multi-part message in MIME format.
--------------93F8D82EE9E8385F42CEBCD7
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Thomas Pornin wrote:

> I got a kernel oops while shutting down and then running again knfsd.
> The nfs server support is compiled in the kernel, not a module. This is
> 2.1.85 (compiled with egcs 1.0.1 on an alpha).
> What I did was :
> /etc/rc.d/init.d/nfs stop
> (4 seconds wait)
> /etc/rc.d/init.d/nfs start
>

Hi Thomas,

Thanks for the good bug report -- I've attached a patch that should fix it. It
looks like what's happening is that when shutting down the server, the client
list pointer wasn't being cleared after all the clients are freed. Then if the
server is started again before the module unloads, it dereferences a stale
pointer in the client list. (Forcibly unloading the module would probably fix it
as well.)

Regards,
Bill
--------------93F8D82EE9E8385F42CEBCD7
Content-Type: text/plain; charset=us-ascii; name="nfsd_exp85-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="nfsd_exp85-patch"

--- fs/nfsd/export.c.old Sat Jan 24 10:13:16 1998
+++ fs/nfsd/export.c Fri Feb 6 16:40:47 1998
@@ -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");
}

--------------93F8D82EE9E8385F42CEBCD7--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu