From owner-svn-src-user@FreeBSD.ORG Mon Nov 10 13:23:16 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DA7B1065695; Mon, 10 Nov 2008 13:23:16 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5139D8FC0C; Mon, 10 Nov 2008 13:23:16 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAADNGlx070943; Mon, 10 Nov 2008 13:23:16 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAADNF7U070928; Mon, 10 Nov 2008 13:23:15 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200811101323.mAADNF7U070928@svn.freebsd.org> From: Doug Rabson Date: Mon, 10 Nov 2008 13:23:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184812 - in user/dfr/gssapi/6: sys sys/conf sys/kern sys/modules/nfslockd sys/nfsclient sys/nlm sys/rpc sys/sys tools/regression/file/flock usr.sbin/rpc.lockd usr.sbin/rpc.statd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Nov 2008 13:23:16 -0000 Author: dfr Date: Mon Nov 10 13:23:15 2008 New Revision: 184812 URL: http://svn.freebsd.org/changeset/base/184812 Log: MFC: Kernel mode NFS lockd client. Added: user/dfr/gssapi/6/sys/nlm/nlm_advlock.c - copied, changed from r180025, head/sys/nlm/nlm_advlock.c Modified: user/dfr/gssapi/6/sys/ (props changed) user/dfr/gssapi/6/sys/conf/files user/dfr/gssapi/6/sys/kern/kern_lockf.c user/dfr/gssapi/6/sys/modules/nfslockd/Makefile user/dfr/gssapi/6/sys/nfsclient/nfs.h user/dfr/gssapi/6/sys/nfsclient/nfs_lock.c user/dfr/gssapi/6/sys/nfsclient/nfs_node.c user/dfr/gssapi/6/sys/nfsclient/nfs_vfsops.c user/dfr/gssapi/6/sys/nfsclient/nfs_vnops.c user/dfr/gssapi/6/sys/nfsclient/nfsmount.h user/dfr/gssapi/6/sys/nfsclient/nfsnode.h user/dfr/gssapi/6/sys/nlm/nlm.h user/dfr/gssapi/6/sys/nlm/nlm_prot.h user/dfr/gssapi/6/sys/nlm/nlm_prot_clnt.c user/dfr/gssapi/6/sys/nlm/nlm_prot_impl.c user/dfr/gssapi/6/sys/nlm/nlm_prot_server.c user/dfr/gssapi/6/sys/rpc/auth_unix.c user/dfr/gssapi/6/sys/rpc/authunix_prot.c user/dfr/gssapi/6/sys/rpc/clnt.h user/dfr/gssapi/6/sys/rpc/clnt_dg.c user/dfr/gssapi/6/sys/rpc/clnt_rc.c user/dfr/gssapi/6/sys/rpc/clnt_vc.c user/dfr/gssapi/6/sys/rpc/pmap_prot.h user/dfr/gssapi/6/sys/rpc/rpcb_clnt.c user/dfr/gssapi/6/sys/rpc/rpcb_prot.c user/dfr/gssapi/6/sys/rpc/svc_vc.c user/dfr/gssapi/6/sys/sys/fcntl.h user/dfr/gssapi/6/sys/sys/lockf.h user/dfr/gssapi/6/sys/sys/param.h user/dfr/gssapi/6/tools/regression/file/flock/ (props changed) user/dfr/gssapi/6/tools/regression/file/flock/flock.c user/dfr/gssapi/6/usr.sbin/rpc.lockd/ (props changed) user/dfr/gssapi/6/usr.sbin/rpc.lockd/lockd.c user/dfr/gssapi/6/usr.sbin/rpc.statd/ (props changed) user/dfr/gssapi/6/usr.sbin/rpc.statd/file.c Modified: user/dfr/gssapi/6/sys/conf/files ============================================================================== --- user/dfr/gssapi/6/sys/conf/files Mon Nov 10 10:41:58 2008 (r184811) +++ user/dfr/gssapi/6/sys/conf/files Mon Nov 10 13:23:15 2008 (r184812) @@ -1897,6 +1897,7 @@ nfsserver/nfs_srvsock.c optional nfsser nfsserver/nfs_srvcache.c optional nfsserver nfsserver/nfs_srvsubs.c optional nfsserver nfsserver/nfs_syscalls.c optional nfsserver +nlm/nlm_advlock.c optional nfslockd nlm/nlm_prot_clnt.c optional nfslockd nlm/nlm_prot_impl.c optional nfslockd nlm/nlm_prot_server.c optional nfslockd Modified: user/dfr/gssapi/6/sys/kern/kern_lockf.c ============================================================================== --- user/dfr/gssapi/6/sys/kern/kern_lockf.c Mon Nov 10 10:41:58 2008 (r184811) +++ user/dfr/gssapi/6/sys/kern/kern_lockf.c Mon Nov 10 13:23:15 2008 (r184812) @@ -1270,7 +1270,8 @@ lf_setlock(struct lockf *state, struct l priority = PLOCK; if (lock->lf_type == F_WRLCK) priority += 4; - priority |= PCATCH; + if (!(lock->lf_flags & F_NOINTR)) + priority |= PCATCH; /* * Scan lock list for this file looking for locks that would block us. */ @@ -1722,27 +1723,26 @@ lf_split(struct lockf *state, struct loc lf_insert_lock(state, splitlock); } -struct clearlock { - STAILQ_ENTRY(clearlock) link; +struct lockdesc { + STAILQ_ENTRY(lockdesc) link; struct vnode *vp; struct flock fl; }; -STAILQ_HEAD(clearlocklist, clearlock); +STAILQ_HEAD(lockdesclist, lockdesc); -void -lf_clearremotesys(int sysid) +int +lf_iteratelocks_sysid(int sysid, lf_iterator *fn, void *arg) { struct lockf *ls; struct lockf_entry *lf; - struct clearlock *cl; - struct clearlocklist locks; - - KASSERT(sysid != 0, ("Can't clear local locks with F_UNLCKSYS")); + struct lockdesc *ldesc; + struct lockdesclist locks; + int error; /* * In order to keep the locking simple, we iterate over the * active lock lists to build a list of locks that need - * releasing. We then call VOP_ADVLOCK for each one in turn. + * releasing. We then call the iterator for each one in turn. * * We take an extra reference to the vnode for the duration to * make sure it doesn't go away before we are finished. @@ -1755,32 +1755,114 @@ lf_clearremotesys(int sysid) if (lf->lf_owner->lo_sysid != sysid) continue; - cl = malloc(sizeof(struct clearlock), M_LOCKF, + ldesc = malloc(sizeof(struct lockdesc), M_LOCKF, M_WAITOK); - cl->vp = lf->lf_vnode; - vref(cl->vp); - cl->fl.l_start = lf->lf_start; + ldesc->vp = lf->lf_vnode; + vref(ldesc->vp); + ldesc->fl.l_start = lf->lf_start; if (lf->lf_end == OFF_MAX) - cl->fl.l_len = 0; + ldesc->fl.l_len = 0; else - cl->fl.l_len = + ldesc->fl.l_len = lf->lf_end - lf->lf_start + 1; - cl->fl.l_whence = SEEK_SET; - cl->fl.l_type = F_UNLCK; - cl->fl.l_pid = lf->lf_owner->lo_pid; - cl->fl.l_sysid = sysid; - STAILQ_INSERT_TAIL(&locks, cl, link); + ldesc->fl.l_whence = SEEK_SET; + ldesc->fl.l_type = F_UNLCK; + ldesc->fl.l_pid = lf->lf_owner->lo_pid; + ldesc->fl.l_sysid = sysid; + STAILQ_INSERT_TAIL(&locks, ldesc, link); } sx_xunlock(&ls->ls_lock); } sx_xunlock(&lf_lock_states_lock); - while ((cl = STAILQ_FIRST(&locks)) != NULL) { + /* + * Call the iterator function for each lock in turn. If the + * iterator returns an error code, just free the rest of the + * lockdesc structures. + */ + error = 0; + while ((ldesc = STAILQ_FIRST(&locks)) != NULL) { STAILQ_REMOVE_HEAD(&locks, link); - VOP_ADVLOCK(cl->vp, 0, F_UNLCK, &cl->fl, F_REMOTE); - vrele(cl->vp); - free(cl, M_LOCKF); + if (!error) + error = fn(ldesc->vp, &ldesc->fl, arg); + vrele(ldesc->vp); + free(ldesc, M_LOCKF); } + + return (error); +} + +int +lf_iteratelocks_vnode(struct vnode *vp, struct lockf *ls, lf_iterator *fn, void *arg) +{ + struct lockf_entry *lf; + struct lockdesc *ldesc; + struct lockdesclist locks; + int error; + + /* + * In order to keep the locking simple, we iterate over the + * active lock lists to build a list of locks that need + * releasing. We then call the iterator for each one in turn. + * + * We take an extra reference to the vnode for the duration to + * make sure it doesn't go away before we are finished. + */ + STAILQ_INIT(&locks); + if (!ls) + return (0); + + sx_xlock(&ls->ls_lock); + LIST_FOREACH(lf, &ls->ls_active, lf_link) { + ldesc = malloc(sizeof(struct lockdesc), M_LOCKF, + M_WAITOK); + ldesc->vp = lf->lf_vnode; + vref(ldesc->vp); + ldesc->fl.l_start = lf->lf_start; + if (lf->lf_end == OFF_MAX) + ldesc->fl.l_len = 0; + else + ldesc->fl.l_len = + lf->lf_end - lf->lf_start + 1; + ldesc->fl.l_whence = SEEK_SET; + ldesc->fl.l_type = F_UNLCK; + ldesc->fl.l_pid = lf->lf_owner->lo_pid; + ldesc->fl.l_sysid = lf->lf_owner->lo_sysid; + STAILQ_INSERT_TAIL(&locks, ldesc, link); + } + sx_xunlock(&ls->ls_lock); + + /* + * Call the iterator function for each lock in turn. If the + * iterator returns an error code, just free the rest of the + * lockdesc structures. + */ + error = 0; + while ((ldesc = STAILQ_FIRST(&locks)) != NULL) { + STAILQ_REMOVE_HEAD(&locks, link); + if (!error) + error = fn(ldesc->vp, &ldesc->fl, arg); + vrele(ldesc->vp); + free(ldesc, M_LOCKF); + } + + return (error); +} + +static int +lf_clearremotesys_iterator(struct vnode *vp, struct flock *fl, void *arg) +{ + + VOP_ADVLOCK(vp, 0, F_UNLCK, fl, F_REMOTE); + return (0); +} + +void +lf_clearremotesys(int sysid) +{ + + KASSERT(sysid != 0, ("Can't clear local locks with F_UNLCKSYS")); + lf_iteratelocks_sysid(sysid, lf_clearremotesys_iterator, NULL); } int Modified: user/dfr/gssapi/6/sys/modules/nfslockd/Makefile ============================================================================== --- user/dfr/gssapi/6/sys/modules/nfslockd/Makefile Mon Nov 10 10:41:58 2008 (r184811) +++ user/dfr/gssapi/6/sys/modules/nfslockd/Makefile Mon Nov 10 13:23:15 2008 (r184812) @@ -3,6 +3,7 @@ .PATH: ${.CURDIR}/../../nlm ${.CURDIR}/../../rpc KMOD= nfslockd SRCS= vnode_if.h \ + nlm_advlock.c \ nlm_prot_clnt.c \ nlm_prot_impl.c \ nlm_prot_server.c \ Modified: user/dfr/gssapi/6/sys/nfsclient/nfs.h ============================================================================== --- user/dfr/gssapi/6/sys/nfsclient/nfs.h Mon Nov 10 10:41:58 2008 (r184811) +++ user/dfr/gssapi/6/sys/nfsclient/nfs.h Mon Nov 10 13:23:15 2008 (r184812) @@ -92,6 +92,7 @@ #define NFSSTA_SNDLOCK 0x01000000 /* Send socket lock */ #define NFSSTA_WANTSND 0x02000000 /* Want above */ #define NFSSTA_TIMEO 0x10000000 /* Experiencing a timeout */ +#define NFSSTA_LOCKTIMEO 0x20000000 /* Experiencing a lockd timeout */ /* Modified: user/dfr/gssapi/6/sys/nfsclient/nfs_lock.c ============================================================================== --- user/dfr/gssapi/6/sys/nfsclient/nfs_lock.c Mon Nov 10 10:41:58 2008 (r184811) +++ user/dfr/gssapi/6/sys/nfsclient/nfs_lock.c Mon Nov 10 13:23:15 2008 (r184812) @@ -221,6 +221,9 @@ MODULE_VERSION(nfslock, 1); /* * nfs_advlock -- * NFS advisory byte-level locks. + * + * The vnode shall be (shared) locked on the entry, it is + * unconditionally unlocked after. */ int nfs_dolock(struct vop_advlock_args *ap) @@ -238,6 +241,15 @@ nfs_dolock(struct vop_advlock_args *ap) vp = ap->a_vp; fl = ap->a_fl; + ASSERT_VOP_LOCKED(vp, "nfs_dolock"); + + bcopy(VFSTONFS(vp->v_mount)->nm_nam, &msg.lm_addr, + 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; + bcopy(VTONFS(vp)->n_fhp, msg.lm_fh, msg.lm_fh_len); + msg.lm_nfsv3 = NFS_ISV3(vp); + VOP_UNLOCK(vp, 0, td); + /* * the NLM protocol doesn't allow the server to return an error * on ranges, so we do it. @@ -258,6 +270,8 @@ nfs_dolock(struct vop_advlock_args *ap) */ msg.lm_version = LOCKD_MSG_VERSION; msg.lm_msg_ident.pid = p->p_pid; + + mtx_lock(&Giant); /* * if there is no nfsowner table yet, allocate one. */ @@ -273,21 +287,16 @@ nfs_dolock(struct vop_advlock_args *ap) msg.lm_fl = *fl; msg.lm_wait = ap->a_flags & F_WAIT; msg.lm_getlk = ap->a_op == F_GETLK; - bcopy(VFSTONFS(vp->v_mount)->nm_nam, &msg.lm_addr, - 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; - bcopy(VTONFS(vp)->n_fhp, msg.lm_fh, msg.lm_fh_len); - msg.lm_nfsv3 = NFS_ISV3(vp); cru2x(td->td_ucred, &msg.lm_cred); for (;;) { error = nfslock_send(&msg); if (error) - return (error); + goto out; /* Unlocks succeed immediately. */ if (fl->l_type == F_UNLCK) - return (error); + goto out; /* * retry after 20 seconds if we haven't gotten a responce yet. @@ -328,7 +337,8 @@ nfs_dolock(struct vop_advlock_args *ap) error = p->p_nlminfo->retcode; break; } - + out: + mtx_unlock(&Giant); return (error); } Modified: user/dfr/gssapi/6/sys/nfsclient/nfs_node.c ============================================================================== --- user/dfr/gssapi/6/sys/nfsclient/nfs_node.c Mon Nov 10 10:41:58 2008 (r184811) +++ user/dfr/gssapi/6/sys/nfsclient/nfs_node.c Mon Nov 10 13:23:15 2008 (r184812) @@ -227,6 +227,13 @@ nfs_reclaim(struct vop_reclaim_args *ap) vprint("nfs_reclaim: pushing active", vp); /* + * If the NLM is running, give it a chance to abort pending + * locks. + */ + if (nfs_reclaim_p) + nfs_reclaim_p(ap); + + /* * Destroy the vm object and flush associated pages. */ vnode_destroy_vobject(vp); Modified: user/dfr/gssapi/6/sys/nfsclient/nfs_vfsops.c ============================================================================== --- user/dfr/gssapi/6/sys/nfsclient/nfs_vfsops.c Mon Nov 10 10:41:58 2008 (r184811) +++ user/dfr/gssapi/6/sys/nfsclient/nfs_vfsops.c Mon Nov 10 13:23:15 2008 (r184812) @@ -480,6 +480,7 @@ nfs_mountroot(struct mount *mp, struct t (l >> 24) & 0xff, (l >> 16) & 0xff, (l >> 8) & 0xff, (l >> 0) & 0xff, nd->root_hostnam); printf("NFS ROOT: %s\n", buf); + nd->root_args.hostname = buf; if ((error = nfs_mountdiskless(buf, MNT_RDONLY, &nd->root_saddr, &nd->root_args, td, &vp, mp)) != 0) { return (error); @@ -529,6 +530,7 @@ nfs_decode_args(struct mount *mp, struct int s; int adjsock; int maxio; + char *p; s = splnet(); @@ -689,6 +691,11 @@ nfs_decode_args(struct mount *mp, struct PSOCK, "nfscon", 0); } } + + strlcpy(nmp->nm_hostname, argp->hostname, sizeof(nmp->nm_hostname)); + p = index(nmp->nm_hostname, ':'); + if (p) + *p = '\0'; } static const char *nfs_opts[] = { "from", "nfs_args", NULL }; Modified: user/dfr/gssapi/6/sys/nfsclient/nfs_vnops.c ============================================================================== --- user/dfr/gssapi/6/sys/nfsclient/nfs_vnops.c Mon Nov 10 10:41:58 2008 (r184811) +++ user/dfr/gssapi/6/sys/nfsclient/nfs_vnops.c Mon Nov 10 13:23:15 2008 (r184812) @@ -197,6 +197,8 @@ static int nfs_renameit(struct vnode *sd struct proc *nfs_iodwant[NFS_MAXASYNCDAEMON]; struct nfsmount *nfs_iodmount[NFS_MAXASYNCDAEMON]; int nfs_numasync = 0; +vop_advlock_t *nfs_advlock_p = nfs_dolock; +vop_reclaim_t *nfs_reclaim_p = NULL; #define DIRHDSIZ (sizeof (struct dirent) - (MAXNAMLEN + 1)) SYSCTL_DECL(_vfs_nfs); @@ -2900,13 +2902,25 @@ done: static int nfs_advlock(struct vop_advlock_args *ap) { + struct vnode *vp = ap->a_vp; + u_quad_t size; + int error; - if ((VFSTONFS(ap->a_vp->v_mount)->nm_flag & NFSMNT_NOLOCKD) != 0) { - struct nfsnode *np = VTONFS(ap->a_vp); - - return (lf_advlock(ap, &(np->n_lockf), np->n_size)); + error = vn_lock(vp, LK_SHARED, curthread); + if (error) + return (error); + if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NOLOCKD) != 0) { + size = VTONFS(vp)->n_size; + VOP_UNLOCK(vp, 0, curthread); + error = lf_advlock(ap, &(VTONFS(vp)->n_lockf), size); + } else { + if (nfs_advlock_p) + error = nfs_advlock_p(ap); + else + error = ENOLCK; } - return (nfs_dolock(ap)); + + return (error); } /* Modified: user/dfr/gssapi/6/sys/nfsclient/nfsmount.h ============================================================================== --- user/dfr/gssapi/6/sys/nfsclient/nfsmount.h Mon Nov 10 10:41:58 2008 (r184811) +++ user/dfr/gssapi/6/sys/nfsclient/nfsmount.h Mon Nov 10 13:23:15 2008 (r184812) @@ -89,6 +89,7 @@ struct nfsmount { int nm_tprintf_initial_delay; /* initial delay */ int nm_tprintf_delay; /* interval for messages */ struct nfs_tcp_mountstate nm_nfstcpstate; + char nm_hostname[MNAMELEN]; /* server's name */ /* NFSv4 */ uint64_t nm_clientid; Modified: user/dfr/gssapi/6/sys/nfsclient/nfsnode.h ============================================================================== --- user/dfr/gssapi/6/sys/nfsclient/nfsnode.h Mon Nov 10 10:41:58 2008 (r184811) +++ user/dfr/gssapi/6/sys/nfsclient/nfsnode.h Mon Nov 10 13:23:15 2008 (r184812) @@ -202,6 +202,9 @@ extern struct vop_vector nfs4_vnodeops; extern struct buf_ops buf_ops_nfs; extern struct buf_ops buf_ops_nfs4; +extern vop_advlock_t *nfs_advlock_p; +extern vop_reclaim_t *nfs_reclaim_p; + /* * Prototypes for NFS vnode operations */ Modified: user/dfr/gssapi/6/sys/nlm/nlm.h ============================================================================== --- user/dfr/gssapi/6/sys/nlm/nlm.h Mon Nov 10 10:41:58 2008 (r184811) +++ user/dfr/gssapi/6/sys/nlm/nlm.h Mon Nov 10 13:23:15 2008 (r184812) @@ -36,7 +36,17 @@ MALLOC_DECLARE(M_NLM); #endif +/* + * This value is added to host system IDs when recording NFS client + * locks in the local lock manager. + */ +#define NLM_SYSID_CLIENT 0x1000000 + struct nlm_host; +struct vnode; + +extern struct timeval nlm_zero_tv; +extern int nlm_nsm_state; /* * Copy a struct netobj. @@ -47,61 +57,140 @@ extern void nlm_copy_netobj(struct netob /* * Search for an existing NLM host that matches the given name * (typically the caller_name element of an nlm4_lock). If none is - * found, create a new host. If 'rqstp' is non-NULL, record the remote + * found, create a new host. If 'addr' is non-NULL, record the remote * address of the host so that we can call it back for async - * responses. + * responses. If 'vers' is greater than zero then record the NLM + * program version to use to communicate with this client. The host + * reference count is incremented - the caller must call + * nlm_host_release when it has finished using it. */ extern struct nlm_host *nlm_find_host_by_name(const char *name, - struct svc_req *rqstp); + const struct sockaddr *addr, rpcvers_t vers); /* * Search for an existing NLM host that matches the given remote * address. If none is found, create a new host with the requested * address and remember 'vers' as the NLM protocol version to use for - * that host. + * that host. The host reference count is incremented - the caller + * must call nlm_host_release when it has finished using it. */ extern struct nlm_host *nlm_find_host_by_addr(const struct sockaddr *addr, int vers); /* + * Register this NLM host with the local NSM so that we can be + * notified if it reboots. + */ +extern void nlm_host_monitor(struct nlm_host *host, int state); + +/* + * Decrement the host reference count, freeing resources if the + * reference count reaches zero. + */ +extern void nlm_host_release(struct nlm_host *host); + +/* * Return an RPC client handle that can be used to talk to the NLM * running on the given host. */ extern CLIENT *nlm_host_get_rpc(struct nlm_host *host); /* + * Return the system ID for a host. + */ +extern int nlm_host_get_sysid(struct nlm_host *host); + +/* + * Return the remote NSM state value for a host. + */ +extern int nlm_host_get_state(struct nlm_host *host); + +/* + * When sending a blocking lock request, we need to track the request + * in our waiting lock list. We add an entry to the waiting list + * before we send the lock RPC so that we can cope with a granted + * message arriving at any time. Call this function before sending the + * lock rpc. If the lock succeeds, call nlm_deregister_wait_lock with + * the handle this function returns, otherwise nlm_wait_lock. Both + * will remove the entry from the waiting list. + */ +extern void *nlm_register_wait_lock(struct nlm4_lock *lock, struct vnode *vp); + +/* + * Deregister a blocking lock request. Call this if the lock succeeded + * without blocking. + */ +extern void nlm_deregister_wait_lock(void *handle); + +/* + * Wait for a granted callback for a blocked lock request, waiting at + * most timo ticks. If no granted message is received within the + * timeout, return EWOULDBLOCK. If a signal interrupted the wait, + * return EINTR - the caller must arrange to send a cancellation to + * the server. In both cases, the request is removed from the waiting + * list. + */ +extern int nlm_wait_lock(void *handle, int timo); + +/* + * Cancel any pending waits for this vnode - called on forcible unmounts. + */ +extern void nlm_cancel_wait(struct vnode *vp); + +/* * Called when a host restarts. */ extern void nlm_sm_notify(nlm_sm_status *argp); /* - * Implementation for lock testing RPCs. Returns the NLM host that - * matches the RPC arguments. + * Implementation for lock testing RPCs. If the request was handled + * successfully and rpcp is non-NULL, *rpcp is set to an RPC client + * handle which can be used to send an async rpc reply. Returns zero + * if the request was handled, or a suitable unix error code + * otherwise. + */ +extern int nlm_do_test(nlm4_testargs *argp, nlm4_testres *result, + struct svc_req *rqstp, CLIENT **rpcp); + +/* + * Implementation for lock setting RPCs. If the request was handled + * successfully and rpcp is non-NULL, *rpcp is set to an RPC client + * handle which can be used to send an async rpc reply. Returns zero + * if the request was handled, or a suitable unix error code + * otherwise. */ -extern struct nlm_host *nlm_do_test(nlm4_testargs *argp, - nlm4_testres *result, struct svc_req *rqstp); +extern int nlm_do_lock(nlm4_lockargs *argp, nlm4_res *result, + struct svc_req *rqstp, bool_t monitor, CLIENT **rpcp); /* - * Implementation for lock setting RPCs. Returns the NLM host that - * matches the RPC arguments. If monitor is TRUE, set up an NSM - * monitor for this host. + * Implementation for cancelling a pending lock request. If the + * request was handled successfully and rpcp is non-NULL, *rpcp is set + * to an RPC client handle which can be used to send an async rpc + * reply. Returns zero if the request was handled, or a suitable unix + * error code otherwise. */ -extern struct nlm_host *nlm_do_lock(nlm4_lockargs *argp, - nlm4_res *result, struct svc_req *rqstp, bool_t monitor); +extern int nlm_do_cancel(nlm4_cancargs *argp, nlm4_res *result, + struct svc_req *rqstp, CLIENT **rpcp); /* - * Implementation for cancelling a pending lock request. Returns the - * NLM host that matches the RPC arguments. + * Implementation for unlocking RPCs. If the request was handled + * successfully and rpcp is non-NULL, *rpcp is set to an RPC client + * handle which can be used to send an async rpc reply. Returns zero + * if the request was handled, or a suitable unix error code + * otherwise. */ -extern struct nlm_host *nlm_do_cancel(nlm4_cancargs *argp, - nlm4_res *result, struct svc_req *rqstp); +extern int nlm_do_unlock(nlm4_unlockargs *argp, nlm4_res *result, + struct svc_req *rqstp, CLIENT **rpcp); /* - * Implementation for unlocking RPCs. Returns the NLM host that - * matches the RPC arguments. + * Implementation for granted RPCs. If the request was handled + * successfully and rpcp is non-NULL, *rpcp is set to an RPC client + * handle which can be used to send an async rpc reply. Returns zero + * if the request was handled, or a suitable unix error code + * otherwise. */ -extern struct nlm_host *nlm_do_unlock(nlm4_unlockargs *argp, - nlm4_res *result, struct svc_req *rqstp); +extern int nlm_do_granted(nlm4_testargs *argp, nlm4_res *result, + struct svc_req *rqstp, CLIENT **rpcp); /* * Free all locks associated with the hostname argp->name. @@ -109,10 +198,17 @@ extern struct nlm_host *nlm_do_unlock(nl extern void nlm_do_free_all(nlm4_notify *argp); /* - * Find an RPC transport that can be used to communicate with the - * userland part of lockd. + * Recover client lock state after a server reboot. + */ +extern void nlm_client_recovery(struct nlm_host *); + +/* + * Interface from NFS client code to the NLM. */ -extern CLIENT *nlm_user_lockd(void); +struct vop_advlock_args; +struct vop_reclaim_args; +extern int nlm_advlock(struct vop_advlock_args *ap); +extern int nlm_reclaim(struct vop_reclaim_args *ap); #endif Copied and modified: user/dfr/gssapi/6/sys/nlm/nlm_advlock.c (from r180025, head/sys/nlm/nlm_advlock.c) ============================================================================== --- head/sys/nlm/nlm_advlock.c Thu Jun 26 10:21:54 2008 (r180025, copy source) +++ user/dfr/gssapi/6/sys/nlm/nlm_advlock.c Mon Nov 10 13:23:15 2008 (r184812) @@ -131,14 +131,14 @@ nlm_down(struct nlm_feedback_arg *nf, st if (nmp == NULL) return; - mtx_lock(&nmp->nm_mtx); + mtx_lock(&Giant); if (!(nmp->nm_state & NFSSTA_LOCKTIMEO)) { nmp->nm_state |= NFSSTA_LOCKTIMEO; - mtx_unlock(&nmp->nm_mtx); + mtx_unlock(&Giant); vfs_event_signal(&nmp->nm_mountp->mnt_stat.f_fsid, VQ_NOTRESPLOCK, 0); } else { - mtx_unlock(&nmp->nm_mtx); + mtx_unlock(&Giant); } nf->nf_printed = TRUE; @@ -156,14 +156,14 @@ nlm_up(struct nlm_feedback_arg *nf, stru nlm_msg(td, nmp->nm_mountp->mnt_stat.f_mntfromname, msg, 0); - mtx_lock(&nmp->nm_mtx); + mtx_lock(&Giant); if (nmp->nm_state & NFSSTA_LOCKTIMEO) { nmp->nm_state &= ~NFSSTA_LOCKTIMEO; - mtx_unlock(&nmp->nm_mtx); + mtx_unlock(&Giant); vfs_event_signal(&nmp->nm_mountp->mnt_stat.f_fsid, VQ_NOTRESPLOCK, 1); } else { - mtx_unlock(&nmp->nm_mtx); + mtx_unlock(&Giant); } } @@ -246,7 +246,7 @@ nlm_advlock_internal(struct vnode *vp, v retries = INT_MAX; if (unlock_vp) - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp, 0, td); /* * We need to switch to mount-point creds so that we can send @@ -475,7 +475,8 @@ nlm_reclaim(struct vop_reclaim_args *ap) { nlm_cancel_wait(ap->a_vp); - lf_iteratelocks_vnode(ap->a_vp, nlm_reclaim_free_lock, NULL); + lf_iteratelocks_vnode(ap->a_vp, VTONFS(ap->a_vp)->n_lockf, + nlm_reclaim_free_lock, NULL); return (0); } @@ -501,7 +502,7 @@ nlm_client_recover_lock(struct vnode *vp if (nr->nr_state != state) return (ERESTART); - error = vn_lock(vp, LK_SHARED); + error = vn_lock(vp, LK_SHARED, td); if (error) return (error); @@ -713,7 +714,7 @@ nlm_record_lock(struct vnode *vp, int op newfl.l_pid = svid; newfl.l_sysid = NLM_SYSID_CLIENT | sysid; - error = lf_advlockasync(&a, &vp->v_lockf, size); + error = lf_advlockasync(&a, &VTONFS(vp)->n_lockf, size); KASSERT(error == 0, ("Failed to register NFS lock locally - error=%d", error)); } @@ -843,6 +844,7 @@ nlm_setlock(struct nlm_host *host, struc CLNT_RELEASE(client); if (stat != RPC_SUCCESS) { + static int never; /* * We need to cope * with temporary @@ -854,7 +856,8 @@ nlm_setlock(struct nlm_host *host, struc * until the server * wakes up again. */ - pause("nlmcancel", 10*hz); + tsleep(&never, 0, + "nlmcancel", 10*hz); } } while (stat != RPC_SUCCESS); Modified: user/dfr/gssapi/6/sys/nlm/nlm_prot.h ============================================================================== --- user/dfr/gssapi/6/sys/nlm/nlm_prot.h Mon Nov 10 10:41:58 2008 (r184811) +++ user/dfr/gssapi/6/sys/nlm/nlm_prot.h Mon Nov 10 13:23:15 2008 (r184812) @@ -280,129 +280,129 @@ typedef struct nlm4_notify nlm4_notify; #define NLM_SM ((unsigned long)(0)) #define NLM_SM_NOTIFY ((unsigned long)(1)) -extern enum clnt_stat nlm_sm_notify_0(struct nlm_sm_status *, void *, CLIENT *); +extern enum clnt_stat nlm_sm_notify_0(struct nlm_sm_status *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_sm_notify_0_svc(struct nlm_sm_status *, void *, struct svc_req *); #define NLM_VERS ((unsigned long)(1)) #define NLM_TEST ((unsigned long)(1)) -extern enum clnt_stat nlm_test_1(struct nlm_testargs *, nlm_testres *, CLIENT *); +extern enum clnt_stat nlm_test_1(struct nlm_testargs *, nlm_testres *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_test_1_svc(struct nlm_testargs *, nlm_testres *, struct svc_req *); #define NLM_LOCK ((unsigned long)(2)) -extern enum clnt_stat nlm_lock_1(struct nlm_lockargs *, nlm_res *, CLIENT *); +extern enum clnt_stat nlm_lock_1(struct nlm_lockargs *, nlm_res *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_lock_1_svc(struct nlm_lockargs *, nlm_res *, struct svc_req *); #define NLM_CANCEL ((unsigned long)(3)) -extern enum clnt_stat nlm_cancel_1(struct nlm_cancargs *, nlm_res *, CLIENT *); +extern enum clnt_stat nlm_cancel_1(struct nlm_cancargs *, nlm_res *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_cancel_1_svc(struct nlm_cancargs *, nlm_res *, struct svc_req *); #define NLM_UNLOCK ((unsigned long)(4)) -extern enum clnt_stat nlm_unlock_1(struct nlm_unlockargs *, nlm_res *, CLIENT *); +extern enum clnt_stat nlm_unlock_1(struct nlm_unlockargs *, nlm_res *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_unlock_1_svc(struct nlm_unlockargs *, nlm_res *, struct svc_req *); #define NLM_GRANTED ((unsigned long)(5)) -extern enum clnt_stat nlm_granted_1(struct nlm_testargs *, nlm_res *, CLIENT *); +extern enum clnt_stat nlm_granted_1(struct nlm_testargs *, nlm_res *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_granted_1_svc(struct nlm_testargs *, nlm_res *, struct svc_req *); #define NLM_TEST_MSG ((unsigned long)(6)) -extern enum clnt_stat nlm_test_msg_1(struct nlm_testargs *, void *, CLIENT *); +extern enum clnt_stat nlm_test_msg_1(struct nlm_testargs *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_test_msg_1_svc(struct nlm_testargs *, void *, struct svc_req *); #define NLM_LOCK_MSG ((unsigned long)(7)) -extern enum clnt_stat nlm_lock_msg_1(struct nlm_lockargs *, void *, CLIENT *); +extern enum clnt_stat nlm_lock_msg_1(struct nlm_lockargs *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_lock_msg_1_svc(struct nlm_lockargs *, void *, struct svc_req *); #define NLM_CANCEL_MSG ((unsigned long)(8)) -extern enum clnt_stat nlm_cancel_msg_1(struct nlm_cancargs *, void *, CLIENT *); +extern enum clnt_stat nlm_cancel_msg_1(struct nlm_cancargs *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_cancel_msg_1_svc(struct nlm_cancargs *, void *, struct svc_req *); #define NLM_UNLOCK_MSG ((unsigned long)(9)) -extern enum clnt_stat nlm_unlock_msg_1(struct nlm_unlockargs *, void *, CLIENT *); +extern enum clnt_stat nlm_unlock_msg_1(struct nlm_unlockargs *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_unlock_msg_1_svc(struct nlm_unlockargs *, void *, struct svc_req *); #define NLM_GRANTED_MSG ((unsigned long)(10)) -extern enum clnt_stat nlm_granted_msg_1(struct nlm_testargs *, void *, CLIENT *); +extern enum clnt_stat nlm_granted_msg_1(struct nlm_testargs *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_granted_msg_1_svc(struct nlm_testargs *, void *, struct svc_req *); #define NLM_TEST_RES ((unsigned long)(11)) -extern enum clnt_stat nlm_test_res_1(nlm_testres *, void *, CLIENT *); +extern enum clnt_stat nlm_test_res_1(nlm_testres *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_test_res_1_svc(nlm_testres *, void *, struct svc_req *); #define NLM_LOCK_RES ((unsigned long)(12)) -extern enum clnt_stat nlm_lock_res_1(nlm_res *, void *, CLIENT *); +extern enum clnt_stat nlm_lock_res_1(nlm_res *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_lock_res_1_svc(nlm_res *, void *, struct svc_req *); #define NLM_CANCEL_RES ((unsigned long)(13)) -extern enum clnt_stat nlm_cancel_res_1(nlm_res *, void *, CLIENT *); +extern enum clnt_stat nlm_cancel_res_1(nlm_res *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_cancel_res_1_svc(nlm_res *, void *, struct svc_req *); #define NLM_UNLOCK_RES ((unsigned long)(14)) -extern enum clnt_stat nlm_unlock_res_1(nlm_res *, void *, CLIENT *); +extern enum clnt_stat nlm_unlock_res_1(nlm_res *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_unlock_res_1_svc(nlm_res *, void *, struct svc_req *); #define NLM_GRANTED_RES ((unsigned long)(15)) -extern enum clnt_stat nlm_granted_res_1(nlm_res *, void *, CLIENT *); +extern enum clnt_stat nlm_granted_res_1(nlm_res *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_granted_res_1_svc(nlm_res *, void *, struct svc_req *); extern int nlm_prog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #define NLM_VERSX ((unsigned long)(3)) #define NLM_SHARE ((unsigned long)(20)) -extern enum clnt_stat nlm_share_3(nlm_shareargs *, nlm_shareres *, CLIENT *); +extern enum clnt_stat nlm_share_3(nlm_shareargs *, nlm_shareres *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_share_3_svc(nlm_shareargs *, nlm_shareres *, struct svc_req *); #define NLM_UNSHARE ((unsigned long)(21)) -extern enum clnt_stat nlm_unshare_3(nlm_shareargs *, nlm_shareres *, CLIENT *); +extern enum clnt_stat nlm_unshare_3(nlm_shareargs *, nlm_shareres *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_unshare_3_svc(nlm_shareargs *, nlm_shareres *, struct svc_req *); #define NLM_NM_LOCK ((unsigned long)(22)) -extern enum clnt_stat nlm_nm_lock_3(nlm_lockargs *, nlm_res *, CLIENT *); +extern enum clnt_stat nlm_nm_lock_3(nlm_lockargs *, nlm_res *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_nm_lock_3_svc(nlm_lockargs *, nlm_res *, struct svc_req *); #define NLM_FREE_ALL ((unsigned long)(23)) -extern enum clnt_stat nlm_free_all_3(nlm_notify *, void *, CLIENT *); +extern enum clnt_stat nlm_free_all_3(nlm_notify *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm_free_all_3_svc(nlm_notify *, void *, struct svc_req *); extern int nlm_prog_3_freeresult(SVCXPRT *, xdrproc_t, caddr_t); #define NLM_VERS4 ((unsigned long)(4)) #define NLM4_TEST ((unsigned long)(1)) -extern enum clnt_stat nlm4_test_4(nlm4_testargs *, nlm4_testres *, CLIENT *); +extern enum clnt_stat nlm4_test_4(nlm4_testargs *, nlm4_testres *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_test_4_svc(nlm4_testargs *, nlm4_testres *, struct svc_req *); #define NLM4_LOCK ((unsigned long)(2)) -extern enum clnt_stat nlm4_lock_4(nlm4_lockargs *, nlm4_res *, CLIENT *); +extern enum clnt_stat nlm4_lock_4(nlm4_lockargs *, nlm4_res *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_lock_4_svc(nlm4_lockargs *, nlm4_res *, struct svc_req *); #define NLM4_CANCEL ((unsigned long)(3)) -extern enum clnt_stat nlm4_cancel_4(nlm4_cancargs *, nlm4_res *, CLIENT *); +extern enum clnt_stat nlm4_cancel_4(nlm4_cancargs *, nlm4_res *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_cancel_4_svc(nlm4_cancargs *, nlm4_res *, struct svc_req *); #define NLM4_UNLOCK ((unsigned long)(4)) -extern enum clnt_stat nlm4_unlock_4(nlm4_unlockargs *, nlm4_res *, CLIENT *); +extern enum clnt_stat nlm4_unlock_4(nlm4_unlockargs *, nlm4_res *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_unlock_4_svc(nlm4_unlockargs *, nlm4_res *, struct svc_req *); #define NLM4_GRANTED ((unsigned long)(5)) -extern enum clnt_stat nlm4_granted_4(nlm4_testargs *, nlm4_res *, CLIENT *); +extern enum clnt_stat nlm4_granted_4(nlm4_testargs *, nlm4_res *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_granted_4_svc(nlm4_testargs *, nlm4_res *, struct svc_req *); #define NLM4_TEST_MSG ((unsigned long)(6)) -extern enum clnt_stat nlm4_test_msg_4(nlm4_testargs *, void *, CLIENT *); +extern enum clnt_stat nlm4_test_msg_4(nlm4_testargs *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_test_msg_4_svc(nlm4_testargs *, void *, struct svc_req *); #define NLM4_LOCK_MSG ((unsigned long)(7)) -extern enum clnt_stat nlm4_lock_msg_4(nlm4_lockargs *, void *, CLIENT *); +extern enum clnt_stat nlm4_lock_msg_4(nlm4_lockargs *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_lock_msg_4_svc(nlm4_lockargs *, void *, struct svc_req *); #define NLM4_CANCEL_MSG ((unsigned long)(8)) -extern enum clnt_stat nlm4_cancel_msg_4(nlm4_cancargs *, void *, CLIENT *); +extern enum clnt_stat nlm4_cancel_msg_4(nlm4_cancargs *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_cancel_msg_4_svc(nlm4_cancargs *, void *, struct svc_req *); #define NLM4_UNLOCK_MSG ((unsigned long)(9)) -extern enum clnt_stat nlm4_unlock_msg_4(nlm4_unlockargs *, void *, CLIENT *); +extern enum clnt_stat nlm4_unlock_msg_4(nlm4_unlockargs *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_unlock_msg_4_svc(nlm4_unlockargs *, void *, struct svc_req *); #define NLM4_GRANTED_MSG ((unsigned long)(10)) -extern enum clnt_stat nlm4_granted_msg_4(nlm4_testargs *, void *, CLIENT *); +extern enum clnt_stat nlm4_granted_msg_4(nlm4_testargs *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_granted_msg_4_svc(nlm4_testargs *, void *, struct svc_req *); #define NLM4_TEST_RES ((unsigned long)(11)) -extern enum clnt_stat nlm4_test_res_4(nlm4_testres *, void *, CLIENT *); +extern enum clnt_stat nlm4_test_res_4(nlm4_testres *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_test_res_4_svc(nlm4_testres *, void *, struct svc_req *); #define NLM4_LOCK_RES ((unsigned long)(12)) -extern enum clnt_stat nlm4_lock_res_4(nlm4_res *, void *, CLIENT *); +extern enum clnt_stat nlm4_lock_res_4(nlm4_res *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_lock_res_4_svc(nlm4_res *, void *, struct svc_req *); #define NLM4_CANCEL_RES ((unsigned long)(13)) -extern enum clnt_stat nlm4_cancel_res_4(nlm4_res *, void *, CLIENT *); +extern enum clnt_stat nlm4_cancel_res_4(nlm4_res *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_cancel_res_4_svc(nlm4_res *, void *, struct svc_req *); #define NLM4_UNLOCK_RES ((unsigned long)(14)) -extern enum clnt_stat nlm4_unlock_res_4(nlm4_res *, void *, CLIENT *); +extern enum clnt_stat nlm4_unlock_res_4(nlm4_res *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_unlock_res_4_svc(nlm4_res *, void *, struct svc_req *); #define NLM4_GRANTED_RES ((unsigned long)(15)) -extern enum clnt_stat nlm4_granted_res_4(nlm4_res *, void *, CLIENT *); +extern enum clnt_stat nlm4_granted_res_4(nlm4_res *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_granted_res_4_svc(nlm4_res *, void *, struct svc_req *); #define NLM4_SHARE ((unsigned long)(20)) -extern enum clnt_stat nlm4_share_4(nlm4_shareargs *, nlm4_shareres *, CLIENT *); +extern enum clnt_stat nlm4_share_4(nlm4_shareargs *, nlm4_shareres *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_share_4_svc(nlm4_shareargs *, nlm4_shareres *, struct svc_req *); #define NLM4_UNSHARE ((unsigned long)(21)) -extern enum clnt_stat nlm4_unshare_4(nlm4_shareargs *, nlm4_shareres *, CLIENT *); +extern enum clnt_stat nlm4_unshare_4(nlm4_shareargs *, nlm4_shareres *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_unshare_4_svc(nlm4_shareargs *, nlm4_shareres *, struct svc_req *); #define NLM4_NM_LOCK ((unsigned long)(22)) -extern enum clnt_stat nlm4_nm_lock_4(nlm4_lockargs *, nlm4_res *, CLIENT *); +extern enum clnt_stat nlm4_nm_lock_4(nlm4_lockargs *, nlm4_res *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_nm_lock_4_svc(nlm4_lockargs *, nlm4_res *, struct svc_req *); #define NLM4_FREE_ALL ((unsigned long)(23)) -extern enum clnt_stat nlm4_free_all_4(nlm4_notify *, void *, CLIENT *); +extern enum clnt_stat nlm4_free_all_4(nlm4_notify *, void *, CLIENT *, struct rpc_callextra *, struct timeval); extern bool_t nlm4_free_all_4_svc(nlm4_notify *, void *, struct svc_req *); extern int nlm_prog_4_freeresult(SVCXPRT *, xdrproc_t, caddr_t); Modified: user/dfr/gssapi/6/sys/nlm/nlm_prot_clnt.c ============================================================================== --- user/dfr/gssapi/6/sys/nlm/nlm_prot_clnt.c Mon Nov 10 10:41:58 2008 (r184811) +++ user/dfr/gssapi/6/sys/nlm/nlm_prot_clnt.c Mon Nov 10 13:23:15 2008 (r184812) @@ -17,356 +17,353 @@ __RCSID("$NetBSD: nlm_prot.x,v 1.6 2000/ #endif /* not lint */ __FBSDID("$FreeBSD$"); -/* Default timeout can be changed using clnt_control() */ -static struct timeval TIMEOUT = { 25, 0 }; - enum clnt_stat -nlm_sm_notify_0(struct nlm_sm_status *argp, void *clnt_res, CLIENT *clnt) +nlm_sm_notify_0(struct nlm_sm_status *argp, void *clnt_res, CLIENT *clnt, struct rpc_callextra *ext, struct timeval timo) { - return (clnt_call(clnt, NLM_SM_NOTIFY, + return (CLNT_CALL_EXT(clnt, ext, NLM_SM_NOTIFY, (xdrproc_t) xdr_nlm_sm_status, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) clnt_res, - TIMEOUT)); + timo)); } enum clnt_stat -nlm_test_1(struct nlm_testargs *argp, nlm_testres *clnt_res, CLIENT *clnt) +nlm_test_1(struct nlm_testargs *argp, nlm_testres *clnt_res, CLIENT *clnt, struct rpc_callextra *ext, struct timeval timo) { - return (clnt_call(clnt, NLM_TEST, + return (CLNT_CALL_EXT(clnt, ext, NLM_TEST, (xdrproc_t) xdr_nlm_testargs, (caddr_t) argp, (xdrproc_t) xdr_nlm_testres, (caddr_t) clnt_res, - TIMEOUT)); + timo)); } enum clnt_stat -nlm_lock_1(struct nlm_lockargs *argp, nlm_res *clnt_res, CLIENT *clnt) +nlm_lock_1(struct nlm_lockargs *argp, nlm_res *clnt_res, CLIENT *clnt, struct rpc_callextra *ext, struct timeval timo) { - return (clnt_call(clnt, NLM_LOCK, + return (CLNT_CALL_EXT(clnt, ext, NLM_LOCK, (xdrproc_t) xdr_nlm_lockargs, (caddr_t) argp, (xdrproc_t) xdr_nlm_res, (caddr_t) clnt_res, - TIMEOUT)); + timo)); } enum clnt_stat -nlm_cancel_1(struct nlm_cancargs *argp, nlm_res *clnt_res, CLIENT *clnt) +nlm_cancel_1(struct nlm_cancargs *argp, nlm_res *clnt_res, CLIENT *clnt, struct rpc_callextra *ext, struct timeval timo) { - return (clnt_call(clnt, NLM_CANCEL, + return (CLNT_CALL_EXT(clnt, ext, NLM_CANCEL, (xdrproc_t) xdr_nlm_cancargs, (caddr_t) argp, (xdrproc_t) xdr_nlm_res, (caddr_t) clnt_res, - TIMEOUT)); + timo)); } enum clnt_stat -nlm_unlock_1(struct nlm_unlockargs *argp, nlm_res *clnt_res, CLIENT *clnt) +nlm_unlock_1(struct nlm_unlockargs *argp, nlm_res *clnt_res, CLIENT *clnt, struct rpc_callextra *ext, struct timeval timo) { - return (clnt_call(clnt, NLM_UNLOCK, + return (CLNT_CALL_EXT(clnt, ext, NLM_UNLOCK, (xdrproc_t) xdr_nlm_unlockargs, (caddr_t) argp, (xdrproc_t) xdr_nlm_res, (caddr_t) clnt_res, - TIMEOUT)); + timo)); } enum clnt_stat -nlm_granted_1(struct nlm_testargs *argp, nlm_res *clnt_res, CLIENT *clnt) +nlm_granted_1(struct nlm_testargs *argp, nlm_res *clnt_res, CLIENT *clnt, struct rpc_callextra *ext, struct timeval timo) { - return (clnt_call(clnt, NLM_GRANTED, + return (CLNT_CALL_EXT(clnt, ext, NLM_GRANTED, (xdrproc_t) xdr_nlm_testargs, (caddr_t) argp, (xdrproc_t) xdr_nlm_res, (caddr_t) clnt_res, - TIMEOUT)); + timo)); } enum clnt_stat -nlm_test_msg_1(struct nlm_testargs *argp, void *clnt_res, CLIENT *clnt) +nlm_test_msg_1(struct nlm_testargs *argp, void *clnt_res, CLIENT *clnt, struct rpc_callextra *ext, struct timeval timo) { - return (clnt_call(clnt, NLM_TEST_MSG, + return (CLNT_CALL_EXT(clnt, ext, NLM_TEST_MSG, (xdrproc_t) xdr_nlm_testargs, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) clnt_res, - TIMEOUT)); + timo)); } enum clnt_stat -nlm_lock_msg_1(struct nlm_lockargs *argp, void *clnt_res, CLIENT *clnt) +nlm_lock_msg_1(struct nlm_lockargs *argp, void *clnt_res, CLIENT *clnt, struct rpc_callextra *ext, struct timeval timo) { - return (clnt_call(clnt, NLM_LOCK_MSG, + return (CLNT_CALL_EXT(clnt, ext, NLM_LOCK_MSG, (xdrproc_t) xdr_nlm_lockargs, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) clnt_res, - TIMEOUT)); + timo)); } enum clnt_stat -nlm_cancel_msg_1(struct nlm_cancargs *argp, void *clnt_res, CLIENT *clnt) +nlm_cancel_msg_1(struct nlm_cancargs *argp, void *clnt_res, CLIENT *clnt, struct rpc_callextra *ext, struct timeval timo) { - return (clnt_call(clnt, NLM_CANCEL_MSG, + return (CLNT_CALL_EXT(clnt, ext, NLM_CANCEL_MSG, (xdrproc_t) xdr_nlm_cancargs, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) clnt_res, - TIMEOUT)); + timo)); } enum clnt_stat -nlm_unlock_msg_1(struct nlm_unlockargs *argp, void *clnt_res, CLIENT *clnt) +nlm_unlock_msg_1(struct nlm_unlockargs *argp, void *clnt_res, CLIENT *clnt, struct rpc_callextra *ext, struct timeval timo) { - return (clnt_call(clnt, NLM_UNLOCK_MSG, + return (CLNT_CALL_EXT(clnt, ext, NLM_UNLOCK_MSG, (xdrproc_t) xdr_nlm_unlockargs, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) clnt_res, - TIMEOUT)); + timo)); } enum clnt_stat -nlm_granted_msg_1(struct nlm_testargs *argp, void *clnt_res, CLIENT *clnt) +nlm_granted_msg_1(struct nlm_testargs *argp, void *clnt_res, CLIENT *clnt, struct rpc_callextra *ext, struct timeval timo) { - return (clnt_call(clnt, NLM_GRANTED_MSG, + return (CLNT_CALL_EXT(clnt, ext, NLM_GRANTED_MSG, (xdrproc_t) xdr_nlm_testargs, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) clnt_res, - TIMEOUT)); + timo)); } enum clnt_stat -nlm_test_res_1(nlm_testres *argp, void *clnt_res, CLIENT *clnt) *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***