forgot about 5.x freeze, backout 1.26 through 1.28 pending re@ appoval.

This commit is contained in:
Alfred Perlstein 2002-11-20 10:53:06 +00:00
parent 0b2724b10f
commit 7affe44ee3

View File

@ -60,6 +60,12 @@ __FBSDID("$FreeBSD$");
#include <nfsclient/nfs_lock.h> #include <nfsclient/nfs_lock.h>
#include <nfsclient/nlminfo.h> #include <nfsclient/nlminfo.h>
#define NFSOWNER_1ST_LEVEL_START 1 /* initial entries */
#define NFSOWNER_2ND_LEVEL 256 /* some power of 2 */
#define NFSOWNER(tbl, i) \
(tbl)[(i) / NFSOWNER_2ND_LEVEL][(i) % NFSOWNER_2ND_LEVEL]
/* /*
* XXX * XXX
* We have to let the process know if the call succeeded. I'm using an extra * We have to let the process know if the call succeeded. I'm using an extra
@ -123,6 +129,11 @@ nfs_dolock(struct vop_advlock_args *ap)
msg.lm_fl = *fl; msg.lm_fl = *fl;
msg.lm_wait = ap->a_flags & F_WAIT; msg.lm_wait = ap->a_flags & F_WAIT;
msg.lm_getlk = ap->a_op == F_GETLK; msg.lm_getlk = ap->a_op == F_GETLK;
/*
* XXX: the lm_cred assignment below directly exports a ucred
* structure to userland. This is probably wrong, and should at
* least be xucred.
*/
bcopy(VFSTONFS(vp->v_mount)->nm_nam, &msg.lm_addr, bcopy(VFSTONFS(vp->v_mount)->nm_nam, &msg.lm_addr,
min(sizeof msg.lm_addr, VFSTONFS(vp->v_mount)->nm_nam->sa_len)); min(sizeof msg.lm_addr, VFSTONFS(vp->v_mount)->nm_nam->sa_len));
msg.lm_fh_len = NFS_ISV3(vp) ? VTONFS(vp)->n_fhsize : NFSX_V2FH; msg.lm_fh_len = NFS_ISV3(vp) ? VTONFS(vp)->n_fhsize : NFSX_V2FH;
@ -181,8 +192,8 @@ nfs_dolock(struct vop_advlock_args *ap)
* on a local network). XXX Probably should use a back-off * on a local network). XXX Probably should use a back-off
* scheme. * scheme.
*/ */
error = tsleep(p->p_nlminfo, PCATCH | PUSER, "lockd", 20*hz); if ((error = tsleep((void *)p->p_nlminfo,
if (error != 0) { PCATCH | PUSER, "lockd", 20*hz)) != 0) {
if (error == EWOULDBLOCK) { if (error == EWOULDBLOCK) {
/* /*
* We timed out, so we rewrite the request * We timed out, so we rewrite the request
@ -207,9 +218,10 @@ nfs_dolock(struct vop_advlock_args *ap)
break; break;
} }
error1 = vn_close(wvp, FWRITE, thread0.td_ucred, td); if ((error1 = vn_close(wvp, FWRITE, thread0.td_ucred, td)) && error == 0)
/* prefer any previous 'error' to our vn_close 'error1'. */ return (error1);
return (error != 0 ? error : error1);
return (error);
} }
/* /*
@ -258,7 +270,7 @@ nfslockdans(struct thread *td, struct lockd_ans *ansp)
targetp->p_nlminfo->set_getlk_pid = ansp->la_set_getlk_pid; targetp->p_nlminfo->set_getlk_pid = ansp->la_set_getlk_pid;
targetp->p_nlminfo->getlk_pid = ansp->la_getlk_pid; targetp->p_nlminfo->getlk_pid = ansp->la_getlk_pid;
wakeup(targetp->p_nlminfo); (void)wakeup((void *)targetp->p_nlminfo);
PROC_UNLOCK(targetp); PROC_UNLOCK(targetp);
return (0); return (0);