Terminate requests in nfs_sigintr() if the filesystem is in the

process of being unmounted. This allows forced NFS unmounts to
complete even if there are processes stuck holding the mnt_lock
while the server is down. The mechanism is not ideal in that there
is a small chance we might accidentally cancel requests during a
failed non-forced unmount attempt on that filesystem, but this
is not really a big problem.

Also, move the tsleep() in nfs_nmcancelreqs() so that we do not
sleep in the case where there are no requests to be cancelled.
This commit is contained in:
Ian Dowse 2002-01-10 02:15:35 +00:00
parent 1f493270a1
commit a7f6ff2e8c

View File

@ -1188,7 +1188,6 @@ nfs_nmcancelreqs(nmp)
splx(s);
for (i = 0; i < 30; i++) {
tsleep(&lbolt, PSOCK, "nfscancel", 0);
s = splnet();
TAILQ_FOREACH(req, &nfs_reqq, r_chain) {
if (nmp == req->r_nmp)
@ -1197,6 +1196,7 @@ nfs_nmcancelreqs(nmp)
splx(s);
if (req == NULL)
return (0);
tsleep(&lbolt, PSOCK, "nfscancel", 0);
}
return (EBUSY);
}
@ -1229,6 +1229,9 @@ nfs_sigintr(struct nfsmount *nmp, struct nfsreq *rep, struct proc *p)
if (rep && (rep->r_flags & R_SOFTTERM))
return (EINTR);
/* Terminate all requests while attempting to unmount. */
if (nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNT)
return (EINTR);
if (!(nmp->nm_flag & NFSMNT_INT))
return (0);
if (p == NULL)