FreeBSD/sys/fs/nfsclient/nfs_clstate.c
/*
 * Take the empty lock owner and move it to the local lhp list if the
 * associated process no longer exists.
 */
Take the empty lock owner and move it to the local lhp list if the
associated process no longer exists.
Take the empty lock owner and move it to the local lhp list if the associated process no longer exists .
static void
nfscl_emptylockowner(struct nfscllockowner *lp,
    struct nfscllockownerfhhead *lhp)
{
	struct nfscllockownerfh *lfhp, *mylfhp;
	struct nfscllockowner *nlp;
	int fnd_it;
	if ((lp->nfsl_lockflags & F_POSIX) == 0)
		return;
	fnd_it = 0;
	mylfhp = NULL;
	SLIST_FOREACH(lfhp, lhp, nfslfh_list) {
		if (lfhp->nfslfh_len == lp->nfsl_open->nfso_fhlen &&
		    !NFSBCMP(lfhp->nfslfh_fh, lp->nfsl_open->nfso_fh,
		    lfhp->nfslfh_len))
			mylfhp = lfhp;
		LIST_FOREACH(nlp, &lfhp->nfslfh_lock, nfsl_list)
			if (!NFSBCMP(nlp->nfsl_owner, lp->nfsl_owner,
			    NFSV4CL_LOCKNAMELEN))
				fnd_it = 1;
	}
	if (fnd_it == 0 && nfscl_procdoesntexist(lp->nfsl_owner) == 0)
		return;
	if (mylfhp == NULL) {
		mylfhp = malloc(sizeof(struct nfscllockownerfh), M_TEMP,
		    M_NOWAIT);
		if (mylfhp == NULL)
			return;
		mylfhp->nfslfh_len = lp->nfsl_open->nfso_fhlen;
		NFSBCOPY(lp->nfsl_open->nfso_fh, mylfhp->nfslfh_fh,
		    mylfhp->nfslfh_len);
		LIST_INIT(&mylfhp->nfslfh_lock);
		SLIST_INSERT_HEAD(lhp, mylfhp, nfslfh_list);
	}
	LIST_REMOVE(lp, nfsl_list);
	LIST_INSERT_HEAD(&mylfhp->nfslfh_lock, lp, nfsl_list);
}
static void nfscl_emptylockowner ( struct nfscllockowner * lp , struct nfscllockownerfhhead * lhp ) { struct nfscllockownerfh * lfhp , * mylfhp ; struct nfscllockowner * nlp ; int fnd_it ; if ( ( lp -> nfsl_lockflags & F_POSIX ) == 0 ) return ; fnd_it = 0 ; mylfhp = NULL ; SLIST_FOREACH ( lfhp , lhp , nfslfh_list ) { if ( lfhp -> nfslfh_len == lp -> nfsl_open -> nfso_fhlen && ! NFSBCMP ( lfhp -> nfslfh_fh , lp -> nfsl_open -> nfso_fh , lfhp -> nfslfh_len ) ) mylfhp = lfhp ; LIST_FOREACH ( nlp , & lfhp -> nfslfh_lock , nfsl_list ) if ( ! NFSBCMP ( nlp -> nfsl_owner , lp -> nfsl_owner , NFSV4CL_LOCKNAMELEN ) ) fnd_it = 1 ; } if ( fnd_it == 0 && nfscl_procdoesntexist ( lp -> nfsl_owner ) == 0 ) return ; if ( mylfhp == NULL ) { mylfhp = malloc ( sizeof ( struct nfscllockownerfh ) , M_TEMP , M_NOWAIT ) ; if ( mylfhp == NULL ) return ; mylfhp -> nfslfh_len = lp -> nfsl_open -> nfso_fhlen ; NFSBCOPY ( lp -> nfsl_open -> nfso_fh , mylfhp -> nfslfh_fh , mylfhp -> nfslfh_len ) ; LIST_INIT ( & mylfhp -> nfslfh_lock ) ; SLIST_INSERT_HEAD ( lhp , mylfhp , nfslfh_list ) ; } LIST_REMOVE ( lp , nfsl_list ) ; LIST_INSERT_HEAD ( & mylfhp -> nfslfh_lock , lp , nfsl_list ) ; }
Take the empty lock owner and move it to the local lhp list if the
 associated process no longer exists.
Take the empty lock owner and move it to the local lhp list if the associated process no longer exists .
/* If not a Posix lock owner, just return. */ /*
	 * First, search to see if this lock owner is already in the list.
	 * If it is, then the associated process no longer exists.
	 */ /* If not found, check if process still exists. */ /* Move the lock owner over to the local list. */