FreeBSD/sys/fs/nfsclient/nfs_clstate.c
/*
 * Try an open against the server. Just call nfsrpc_openrpc(), retrying while
 * NFSERR_DELAY. Also, try system credentials, if the passed in credentials
 * fail.
 */
Try an open against the server.
Try an open against the server .
static int
nfscl_tryopen(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen,
    u_int8_t *newfhp, int newfhlen, u_int32_t mode, struct nfsclopen *op,
    u_int8_t *name, int namelen, struct nfscldeleg **ndpp,
    int reclaim, u_int32_t delegtype, struct ucred *cred, NFSPROC_T *p)
{
	int error;
	do {
		error = nfsrpc_openrpc(nmp, vp, fhp, fhlen, newfhp, newfhlen,
		    mode, op, name, namelen, ndpp, reclaim, delegtype, cred, p,
		    0, 0);
		if (error == NFSERR_DELAY)
			(void) nfs_catnap(PZERO, error, "nfstryop");
	} while (error == NFSERR_DELAY);
	if (error == EAUTH || error == EACCES) {
		newnfs_setroot(cred);
		do {
		    error = nfsrpc_openrpc(nmp, vp, fhp, fhlen, newfhp,
			newfhlen, mode, op, name, namelen, ndpp, reclaim,
			delegtype, cred, p, 1, 0);
		    if (error == NFSERR_DELAY)
			(void) nfs_catnap(PZERO, error, "nfstryop");
		} while (error == NFSERR_DELAY);
	}
	return (error);
}
static int nfscl_tryopen ( struct nfsmount * nmp , vnode_t vp , u_int8_t * fhp , int fhlen , u_int8_t * newfhp , int newfhlen , u_int32_t mode , struct nfsclopen * op , u_int8_t * name , int namelen , struct nfscldeleg * * ndpp , int reclaim , u_int32_t delegtype , struct ucred * cred , NFSPROC_T * p ) { int error ; do { error = nfsrpc_openrpc ( nmp , vp , fhp , fhlen , newfhp , newfhlen , mode , op , name , namelen , ndpp , reclaim , delegtype , cred , p , 0 , 0 ) ; if ( error == NFSERR_DELAY ) ( void ) nfs_catnap ( PZERO , error , " " ) ; } while ( error == NFSERR_DELAY ) ; if ( error == EAUTH || error == EACCES ) { newnfs_setroot ( cred ) ; do { error = nfsrpc_openrpc ( nmp , vp , fhp , fhlen , newfhp , newfhlen , mode , op , name , namelen , ndpp , reclaim , delegtype , cred , p , 1 , 0 ) ; if ( error == NFSERR_DELAY ) ( void ) nfs_catnap ( PZERO , error , " " ) ; } while ( error == NFSERR_DELAY ) ; } return ( error ) ; }
Try an open against the server.
Try an open against the server .
/* Try again using system credentials */