libafs: Set tvcp->callback before BulkStatus

When we call InlineBulkStatus or BulkStatus, we currently do not touch
tvcp->callback for any of the vcaches before making the call. This can
cause us to not notice an InitCallBackState issued by the fileserver
before the BulkStatus call returns, since the InitCallBackState
handler looks at tvcp->callback to determine what vcaches to clear
callbacks for. In turn, this can cause us to think we have a callback
agreement with the fileserver on one of the BulkStatus'd files, when
the fileserver does not actually have such a callback agreement.

So, set tvcp->callback to the server we are contacting, so if we get
an InitCallBackState call from that fileserver, the CBulkFetching
state will be cleared, and we will correctly discard the callback
information for that vcache.

Reviewed-on: http://gerrit.openafs.org/2548
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 37817796c4890683a7e41ed0f3a2fa6a53e1edc7)

Change-Id: I3bb9bd6b8c9f7e5ef9f63a62d80cf70629990db6
Reviewed-on: http://gerrit.openafs.org/5647
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
Andrew Deason 2010-08-12 14:38:55 -05:00 committed by Derrick Brashear
parent 17a10864e2
commit 40291c76c3

View File

@ -810,6 +810,36 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp)
tcp = afs_Conn(&adp->fid, areqp, SHARED_LOCK, &rxconn); tcp = afs_Conn(&adp->fid, areqp, SHARED_LOCK, &rxconn);
if (tcp) { if (tcp) {
hostp = tcp->srvr->server; hostp = tcp->srvr->server;
for (i = 0; i < fidIndex; i++) {
/* we must set tvcp->callback before the BulkStatus call, so
* we can detect concurrent InitCallBackState's */
afid.Cell = adp->fid.Cell;
afid.Fid.Volume = adp->fid.Fid.Volume;
afid.Fid.Vnode = fidsp[i].Vnode;
afid.Fid.Unique = fidsp[i].Unique;
do {
retry = 0;
ObtainReadLock(&afs_xvcache);
tvcp = afs_FindVCache(&afid, &retry, 0 /* !stats&!lru */);
ReleaseReadLock(&afs_xvcache);
} while (tvcp && retry);
if (!tvcp) {
continue;
}
if ((tvcp->states & CBulkFetching) &&
(tvcp->m.Length == statSeqNo)) {
tvcp->callback = hostp;
}
afs_PutVCache(tvcp);
tvcp = NULL;
}
XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_BULKSTATUS); XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_BULKSTATUS);
RX_AFS_GUNLOCK(); RX_AFS_GUNLOCK();