return 1;
}
+static int
+afs_CheckBulkStatus(struct afs_conn *tc, int nFids, AFSBulkStats *statParm,
+ AFSCBs *cbParm)
+{
+ int i;
+ int code;
+
+ if (statParm->AFSBulkStats_len != nFids || cbParm->AFSCBs_len != nFids) {
+ return VBUSY;
+ }
+ for (i = 0; i < nFids; i++) {
+ if (statParm->AFSBulkStats_val[i].errorCode) {
+ continue;
+ }
+ code = afs_CheckFetchStatus(tc, &statParm->AFSBulkStats_val[i]);
+ if (code) {
+ return code;
+ }
+ }
+
+ return 0;
+}
+
extern int BlobScan(struct dcache * afile, afs_int32 ablob);
/* called with an unlocked directory and directory cookie. Areqp
RX_AFS_GLOCK();
}
XSTATS_END_TIME;
+
+ if (code == 0) {
+ code = afs_CheckBulkStatus(tcp, fidIndex, &statParm, &cbParm);
+ }
} else
code = -1;
} while (afs_Analyze
void afs_vcacheInit(int astatSize);
extern struct vcache *afs_FindVCache(struct VenusFid *afid, afs_int32 * retry,
afs_int32 flag);
+extern int afs_CheckFetchStatus(struct afs_conn *tc,
+ struct AFSFetchStatus *status);
extern afs_int32 afs_FetchStatus(struct vcache *avc, struct VenusFid *afid,
struct vrequest *areq,
struct AFSFetchStatus *Outsp);
afs_PutVolume(volp, READ_LOCK);
}
+/**
+ * Check if a given AFSFetchStatus structure is sane.
+ *
+ * @param[in] tc The server from which we received the status
+ * @param[in] status The status we received
+ *
+ * @return whether the given structure is valid or not
+ * @retval 0 the structure is fine
+ * @retval nonzero the structure looks like garbage; act as if we received
+ * the returned error code from the server
+ */
+int
+afs_CheckFetchStatus(struct afs_conn *tc, struct AFSFetchStatus *status)
+{
+ if (status->errorCode ||
+ status->InterfaceVersion != 1 ||
+ !(status->FileType > Invalid && status->FileType <= SymbolicLink) ||
+ status->ParentVnode == 0 || status->ParentUnique == 0) {
+
+ return VBUSY;
+ }
+ return 0;
+}
+
/*!
* Must be called with avc write-locked
* don't absolutely have to invalidate the hint unless the dv has
XSTATS_END_TIME;
+ if (code == 0) {
+ code = afs_CheckFetchStatus(tc, Outsp);
+ }
+
} else
code = -1;
} while (afs_Analyze