/*
- * Copyright (c) 2006-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
#include <netinet/in.h>
#include <net/kpi_interface.h>
+#if CONFIG_NFS4
/*
* NFS_MAX_WHO is the maximum length of a string representation used
* in as an ace who, owner, or group. There is no explicit limit in the
dnp = nsp->nsr_dnp;
dvp = NFSTOV(dnp);
if ((error = vnode_get(dvp))) {
+ dvp = NULLVP;
nfs_node_unlock(np);
goto nfsmout;
}
}
return error;
}
+#endif /* CONFIG_NFS4 */
/*
* Parse an NFSv4 SECINFO array to an array of pseudo flavors.
nfsm_chain_get_secinfo(struct nfsm_chain *nmc, uint32_t *sec, int *seccountp)
{
int error = 0, secmax, seccount, srvcount;
- uint32_t flavor, val;
+ uint32_t flavor;
+
+#if CONFIG_NFS_GSS
+ uint32_t val;
u_char oid[12];
+#endif
seccount = srvcount = 0;
secmax = *seccountp;
switch (flavor) {
case RPCAUTH_NONE:
case RPCAUTH_SYS:
+#if CONFIG_NFS_GSS
case RPCAUTH_KRB5:
case RPCAUTH_KRB5I:
case RPCAUTH_KRB5P:
+#endif /* CONFIG_NFS_GSS */
sec[seccount++] = flavor;
break;
+#if CONFIG_NFS_GSS
case RPCSEC_GSS:
/* we only recognize KRB5, KRB5I, KRB5P */
nfsm_chain_get_32(error, nmc, val); /* OID length */
break;
}
break;
+#endif /* CONFIG_NFS_GSS */
}
srvcount--;
}
return error;
}
-
+#if CONFIG_NFS4
/*
* Fetch the FS_LOCATIONS attribute for the node found at directory/name.
*/
}
return error;
}
+#endif /* CONFIG_NFS4 */
/*
* Got the given error and need to start recovery (if not already started).
}
}
+#if CONFIG_NFS4
/*
* After recovery due to state expiry, check each node and
* drop any lingering delegation we thought we had.
lck_mtx_unlock(&np->n_openlock);
}
+#endif /* CONFIG_NFS4*/
/*
* Recover state for an NFS mount.
void
nfs_recover(struct nfsmount *nmp)
{
- struct timespec ts = { 1, 0 };
+ struct timespec ts = { .tv_sec = 1, .tv_nsec = 0 };
int error, lost, reopen;
struct nfs_open_owner *noop;
struct nfs_open_file *nofp;
struct nfs_file_lock *nflp, *nextnflp;
struct nfs_lock_owner *nlop;
thread_t thd = current_thread();
+#if CONFIG_NFS4
nfsnode_t np, nextnp;
+#endif
struct timeval now;
restart:
if (nmp->nm_vers < NFS_VER4) {
goto reclaim_locks;
}
+#if CONFIG_NFS4
if (nofp->nof_rw_drw) {
error = nfs4_open_reclaim_rpc(nofp, NFS_OPEN_SHARE_ACCESS_BOTH, NFS_OPEN_SHARE_DENY_BOTH);
}
nofp->nof_flags &= ~NFS_OPEN_FILE_REOPEN;
lck_mtx_unlock(&nofp->nof_lock);
}
-
+#endif /* CONFIG_NFS4 */
/*
* Scan this node's lock owner list for entries with this open owner,
* then walk the lock owner's held lock list recovering each lock.
break;
}
}
-
+#if CONFIG_NFS4
/*
* If we've determined that we need to reopen the file then we probably
* didn't receive any delegation we think we hold. We should attempt to
goto restart;
}
}
-
+#endif
if (lost) {
/* revoke open file state */
NP(nofp->nof_np, "nfs_recover: state lost for %d %p 0x%x",
if (!error) {
/* If state expired, make sure we're not holding onto any stale delegations */
lck_mtx_lock(&nmp->nm_lock);
+#if CONFIG_NFS4
if ((nmp->nm_vers >= NFS_VER4) && (nmp->nm_state & NFSSTA_RECOVER_EXPIRED)) {
recheckdeleg:
TAILQ_FOREACH_SAFE(np, &nmp->nm_delegations, n_dlink, nextnp) {
}
}
}
+#endif
nmp->nm_state &= ~(NFSSTA_RECOVER | NFSSTA_RECOVER_EXPIRED);
wakeup(&nmp->nm_state);
printf("nfs recovery completed for %s, 0x%x\n",