From: Andrew Deason Date: Fri, 22 Jul 2011 21:09:52 +0000 (-0500) Subject: libafs: Avoid duplicate afs_Analyze in bulk stat X-Git-Tag: upstream/1.6.0^2~23 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=bf236c0f8a2bb7aa10c776fc90b4fd00e6ada823;p=packages%2Fo%2Fopenafs.git libafs: Avoid duplicate afs_Analyze in bulk stat In afs_DoBulkStat, we can call afs_Analyze multiple times for the same set of connection objects. Since afs_Analyze puts its reference to the given afs_conn and rx_connection structures, calling it more than once can cause the reference counts on those objects to be lower than they should be. Instead of making another afs_Analyze call, just alter the error code inside the normal do/while afs_Analyze loop, so the 'loop' afs_Analyze call gets the appropriate error code from the first bulk stat'd entry. (cherry picked from commit ef28bc08c18e750f6100535665d5258a317a0a2b) Reviewed-on: http://gerrit.openafs.org/5086 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear Change-Id: I8bb484aade39830a56cb967a3e3167e63777e333 Reviewed-on: http://gerrit.openafs.org/5127 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index 8e7af1c58..850bc06ad 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -683,7 +683,6 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) struct volume *volp = 0; /* volume ptr */ struct VenusFid dotdot = {0, {0, 0, 0}}; int flagIndex = 0; /* First file with bulk fetch flag set */ - int inlinebulk = 0; /* Did we use InlineBulk RPC or not? */ XSTATS_DECLS; dotdot.Cell = 0; dotdot.Fid.Unique = 0; @@ -945,7 +944,6 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_BULKSTATUS); if (!(tcp->srvr->server->flags & SNO_INLINEBULK)) { - retryonce: RX_AFS_GUNLOCK(); code = RXAFS_InlineBulkStatus(tcp->id, &fidParm, &statParm, @@ -953,29 +951,18 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) RX_AFS_GLOCK(); if (code == RXGEN_OPCODE) { tcp->srvr->server->flags |= SNO_INLINEBULK; - inlinebulk = 0; RX_AFS_GUNLOCK(); code = RXAFS_BulkStatus(tcp->id, &fidParm, &statParm, &cbParm, &volSync); RX_AFS_GLOCK(); - } else { - inlinebulk = 1; - if (!code && ((&statsp[0])->errorCode)) { - /* - * If this is an error needing retry, do so. - * Retryable errors are all whole-volume or - * whole-server. - */ - if (afs_Analyze(tcp, (&statsp[0])->errorCode, - &adp->f.fid, areqp, - AFS_STATS_FS_RPCIDX_BULKSTATUS, - SHARED_LOCK, NULL) != 0) - goto retryonce; - } + } else if (!code) { + /* The InlineBulkStatus call itself succeeded, but we + * may have failed to stat the first entry. Use the error + * from the first entry for processing. */ + code = (&statsp[0])->errorCode; } } else { - inlinebulk = 0; RX_AFS_GUNLOCK(); code = RXAFS_BulkStatus(tcp->id, &fidParm, &statParm, &cbParm, @@ -1287,16 +1274,6 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) if (volp) afs_PutVolume(volp, READ_LOCK); - /* If we did the InlineBulk RPC pull out the return code */ - if (inlinebulk && code == 0) { - if ((&statsp[0])->errorCode) { - afs_Analyze(tcp, (&statsp[0])->errorCode, &adp->f.fid, areqp, - AFS_STATS_FS_RPCIDX_BULKSTATUS, SHARED_LOCK, NULL); - code = (&statsp[0])->errorCode; - } - } else { - code = 0; - } done2: osi_FreeLargeSpace((char *)fidsp); osi_Free((char *)statsp, AFSCBMAX * sizeof(AFSFetchStatus));