state->valid = 1;
state->did_eval = 0;
state->need_release = 0;
- state->nonblock = 0;
}
/*
- * afs_EvalFakeStat
- *
- * Automatically does the equivalent of EvalMountPoint for vcache entries
- * which are mount points. Remembers enough state to properly release
- * the volume root vcache when afs_PutFakeStat() is called.
+ * afs_EvalFakeStat_int
*
- * State variable must be initialized by afs_InitFakeState() beforehand.
+ * The actual implementation of afs_EvalFakeStat and afs_TryEvalFakeStat,
+ * which is called by those wrapper functions.
*
- * Returns 0 when everything succeeds and *avcp points to the vcache entry
- * that should be used for the real vnode operation. Returns non-zero if
- * something goes wrong and the error code should be returned to the user.
+ * Only issues RPCs if canblock is non-zero.
*/
-int
-afs_EvalFakeStat(avcp, state, areq)
+static int
+afs_EvalFakeStat_int(avcp, state, areq, canblock)
struct vcache **avcp;
struct afs_fakestat_state *state;
struct vrequest *areq;
+ int canblock;
{
struct vcache *tvc, *root_vp;
struct volume *tvolp = NULL;
code = afs_VerifyVCache(tvc, areq);
if (code)
goto done;
- if (!state->nonblock) {
+ if (canblock) {
ObtainWriteLock(&tvc->lock, 599);
code = EvalMountPoint(tvc, NULL, &tvolp, areq);
ReleaseWriteLock(&tvc->lock);
}
}
if (tvc->mvid && (tvc->states & CMValid)) {
- if (state->nonblock) {
+ if (!canblock) {
afs_int32 retry;
do {
root_vp = afs_GetVCache(tvc->mvid, areq, NULL, NULL, WRITE_LOCK);
}
if (!root_vp) {
- code = state->nonblock ? 0 : ENOENT;
+ code = canblock ? ENOENT : 0;
goto done;
}
if (tvolp) {
*avcp = root_vp;
code = 0;
} else {
- code = state->nonblock ? 0 : ENOENT;
+ code = canblock ? ENOENT : 0;
}
done:
}
/*
+ * afs_EvalFakeStat
+ *
+ * Automatically does the equivalent of EvalMountPoint for vcache entries
+ * which are mount points. Remembers enough state to properly release
+ * the volume root vcache when afs_PutFakeStat() is called.
+ *
+ * State variable must be initialized by afs_InitFakeState() beforehand.
+ *
+ * Returns 0 when everything succeeds and *avcp points to the vcache entry
+ * that should be used for the real vnode operation. Returns non-zero if
+ * something goes wrong and the error code should be returned to the user.
+ */
+int
+afs_EvalFakeStat(avcp, state, areq)
+ struct vcache **avcp;
+ struct afs_fakestat_state *state;
+ struct vrequest *areq;
+{
+ return afs_EvalFakeStat_int(avcp, state, areq, 1);
+}
+
+/*
* afs_TryEvalFakeStat
*
* Same as afs_EvalFakeStat, but tries not to talk to remote servers
struct afs_fakestat_state *state;
struct vrequest *areq;
{
- state->nonblock = 1;
- return afs_EvalFakeStat(avcp, state, areq);
+ return afs_EvalFakeStat_int(avcp, state, areq, 0);
}
/*