FreeBSD/sys/fs/nfsclient/nfs_clstate.c
/*
 * Try a byte range lock. Just loop on nfsrpc_lock() while it returns
 * NFSERR_DELAY. Also, retry with system credentials, if the provided
 * cred don't work.
 */
Try a byte range lock. Just loop on nfsrpc_lock() while it returns
NFSERR_DELAY. Also, retry with system credentials, if the provided
cred don't work.
Try a byte range lock . Just loop on nfsrpc_lock () while it returns NFSERR_DELAY . Also retry with system credentials if the provided cred don ' t work .
static int
nfscl_trylock(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp,
    int fhlen, struct nfscllockowner *nlp, int newone, int reclaim,
    u_int64_t off, u_int64_t len, short type, struct ucred *cred, NFSPROC_T *p)
{
	struct nfsrv_descript nfsd, *nd = &nfsd;
	int error;
	do {
		error = nfsrpc_lock(nd, nmp, vp, fhp, fhlen, nlp, newone,
		    reclaim, off, len, type, cred, p, 0);
		if (!error && nd->nd_repstat == NFSERR_DELAY)
			(void) nfs_catnap(PZERO, (int)nd->nd_repstat,
			    "nfstrylck");
	} while (!error && nd->nd_repstat == NFSERR_DELAY);
	if (!error)
		error = nd->nd_repstat;
	if (error == EAUTH || error == EACCES) {
		newnfs_setroot(cred);
		do {
			error = nfsrpc_lock(nd, nmp, vp, fhp, fhlen, nlp,
			    newone, reclaim, off, len, type, cred, p, 1);
			if (!error && nd->nd_repstat == NFSERR_DELAY)
				(void) nfs_catnap(PZERO, (int)nd->nd_repstat,
				    "nfstrylck");
		} while (!error && nd->nd_repstat == NFSERR_DELAY);
		if (!error)
			error = nd->nd_repstat;
	}
	return (error);
}
static int nfscl_trylock ( struct nfsmount * nmp , vnode_t vp , u_int8_t * fhp , int fhlen , struct nfscllockowner * nlp , int newone , int reclaim , u_int64_t off , u_int64_t len , short type , struct ucred * cred , NFSPROC_T * p ) { struct nfsrv_descript nfsd , * nd = & nfsd ; int error ; do { error = nfsrpc_lock ( nd , nmp , vp , fhp , fhlen , nlp , newone , reclaim , off , len , type , cred , p , 0 ) ; if ( ! error && nd -> nd_repstat == NFSERR_DELAY ) ( void ) nfs_catnap ( PZERO , ( int ) nd -> nd_repstat , " " ) ; } while ( ! error && nd -> nd_repstat == NFSERR_DELAY ) ; if ( ! error ) error = nd -> nd_repstat ; if ( error == EAUTH || error == EACCES ) { newnfs_setroot ( cred ) ; do { error = nfsrpc_lock ( nd , nmp , vp , fhp , fhlen , nlp , newone , reclaim , off , len , type , cred , p , 1 ) ; if ( ! error && nd -> nd_repstat == NFSERR_DELAY ) ( void ) nfs_catnap ( PZERO , ( int ) nd -> nd_repstat , " " ) ; } while ( ! error && nd -> nd_repstat == NFSERR_DELAY ) ; if ( ! error ) error = nd -> nd_repstat ; } return ( error ) ; }
Try a byte range lock.
Try a byte range lock .
/* Try again using root credentials */