FreeBSD/sys/fs/nfsclient/nfs_clstate.c
/*
 * Called when an NFSERR_EXPIRED is received from the server.
 */
Called when an NFSERR_EXPIRED is received from the server.
Called when an NFSERR_EXPIRED is received from the server .
static void
nfscl_expireclient(struct nfsclclient *clp, struct nfsmount *nmp,
    struct ucred *cred, NFSPROC_T *p)
{
	struct nfsclowner *owp, *nowp, *towp;
	struct nfsclopen *op, *nop, *top;
	struct nfscldeleg *dp, *ndp;
	int ret, printed = 0;
	dp = TAILQ_FIRST(&clp->nfsc_deleg);
	while (dp != NULL) {
	    ndp = TAILQ_NEXT(dp, nfsdl_list);
	    owp = LIST_FIRST(&dp->nfsdl_owner);
	    while (owp != NULL) {
		nowp = LIST_NEXT(owp, nfsow_list);
		op = LIST_FIRST(&owp->nfsow_open);
		if (op != NULL) {
		    if (LIST_NEXT(op, nfso_list) != NULL)
			panic("nfsclexp");
		    LIST_FOREACH(towp, &clp->nfsc_owner, nfsow_list) {
			if (!NFSBCMP(towp->nfsow_owner, owp->nfsow_owner,
			    NFSV4CL_LOCKNAMELEN))
			    break;
		    }
		    if (towp != NULL) {
			LIST_FOREACH(top, &towp->nfsow_open, nfso_list) {
			    if (top->nfso_fhlen == op->nfso_fhlen &&
				!NFSBCMP(top->nfso_fh, op->nfso_fh,
				 op->nfso_fhlen)) {
				top->nfso_mode |= op->nfso_mode;
				top->nfso_opencnt += op->nfso_opencnt;
				break;
			    }
			}
			if (top == NULL) {
			    LIST_REMOVE(op, nfso_list);
			    op->nfso_own = towp;
			    LIST_INSERT_HEAD(&towp->nfsow_open, op, nfso_list);
			    newnfsstats.cllocalopens--;
			    newnfsstats.clopens++;
			}
		    } else {
			LIST_REMOVE(owp, nfsow_list);
			owp->nfsow_clp = clp;
			LIST_INSERT_HEAD(&clp->nfsc_owner, owp, nfsow_list);
			newnfsstats.cllocalopenowners--;
			newnfsstats.clopenowners++;
			newnfsstats.cllocalopens--;
			newnfsstats.clopens++;
		    }
		}
		owp = nowp;
	    }
	    if (!printed && !LIST_EMPTY(&dp->nfsdl_lock)) {
		printed = 1;
		printf("nfsv4 expired locks lost\n");
	    }
	    nfscl_cleandeleg(dp);
	    nfscl_freedeleg(&clp->nfsc_deleg, dp);
	    dp = ndp;
	}
	if (!TAILQ_EMPTY(&clp->nfsc_deleg))
	    panic("nfsclexp");
	LIST_FOREACH_SAFE(owp, &clp->nfsc_owner, nfsow_list, nowp) {
		owp->nfsow_seqid = 0;
		LIST_FOREACH_SAFE(op, &owp->nfsow_open, nfso_list, nop) {
			ret = nfscl_expireopen(clp, op, nmp, cred, p);
			if (ret && !printed) {
				printed = 1;
				printf("nfsv4 expired locks lost\n");
			}
		}
		if (LIST_EMPTY(&owp->nfsow_open))
			nfscl_freeopenowner(owp, 0);
	}
}
static void nfscl_expireclient ( struct nfsclclient * clp , struct nfsmount * nmp , struct ucred * cred , NFSPROC_T * p ) { struct nfsclowner * owp , * nowp , * towp ; struct nfsclopen * op , * nop , * top ; struct nfscldeleg * dp , * ndp ; int ret , printed = 0 ; dp = TAILQ_FIRST ( & clp -> nfsc_deleg ) ; while ( dp != NULL ) { ndp = TAILQ_NEXT ( dp , nfsdl_list ) ; owp = LIST_FIRST ( & dp -> nfsdl_owner ) ; while ( owp != NULL ) { nowp = LIST_NEXT ( owp , nfsow_list ) ; op = LIST_FIRST ( & owp -> nfsow_open ) ; if ( op != NULL ) { if ( LIST_NEXT ( op , nfso_list ) != NULL ) panic ( " " ) ; LIST_FOREACH ( towp , & clp -> nfsc_owner , nfsow_list ) { if ( ! NFSBCMP ( towp -> nfsow_owner , owp -> nfsow_owner , NFSV4CL_LOCKNAMELEN ) ) break ; } if ( towp != NULL ) { LIST_FOREACH ( top , & towp -> nfsow_open , nfso_list ) { if ( top -> nfso_fhlen == op -> nfso_fhlen && ! NFSBCMP ( top -> nfso_fh , op -> nfso_fh , op -> nfso_fhlen ) ) { top -> nfso_mode |= op -> nfso_mode ; top -> nfso_opencnt += op -> nfso_opencnt ; break ; } } if ( top == NULL ) { LIST_REMOVE ( op , nfso_list ) ; op -> nfso_own = towp ; LIST_INSERT_HEAD ( & towp -> nfsow_open , op , nfso_list ) ; newnfsstats . cllocalopens -- ; newnfsstats . clopens ++ ; } } else { LIST_REMOVE ( owp , nfsow_list ) ; owp -> nfsow_clp = clp ; LIST_INSERT_HEAD ( & clp -> nfsc_owner , owp , nfsow_list ) ; newnfsstats . cllocalopenowners -- ; newnfsstats . clopenowners ++ ; newnfsstats . cllocalopens -- ; newnfsstats . clopens ++ ; } } owp = nowp ; } if ( ! printed && ! LIST_EMPTY ( & dp -> nfsdl_lock ) ) { printed = 1 ; printf ( " \n " ) ; } nfscl_cleandeleg ( dp ) ; nfscl_freedeleg ( & clp -> nfsc_deleg , dp ) ; dp = ndp ; } if ( ! TAILQ_EMPTY ( & clp -> nfsc_deleg ) ) panic ( " " ) ; LIST_FOREACH_SAFE ( owp , & clp -> nfsc_owner , nfsow_list , nowp ) { owp -> nfsow_seqid = 0 ; LIST_FOREACH_SAFE ( op , & owp -> nfsow_open , nfso_list , nop ) { ret = nfscl_expireopen ( clp , op , nmp , cred , p ) ; if ( ret && ! printed ) { printed = 1 ; printf ( " \n " ) ; } } if ( LIST_EMPTY ( & owp -> nfsow_open ) ) nfscl_freeopenowner ( owp , 0 ) ; } }
Called when an NFSERR_EXPIRED is received from the server.
Called when an NFSERR_EXPIRED is received from the server .
/*
	 * First, merge locally issued Opens into the list for the server.
	 */ /* Merge opens in */ /* Just add the open to the owner list */ /* Just add the openowner to the client list */ /*
	 * Now, try and reopen against the server.
	 */