afs_DoBulkStat: don't call afs_Analyze without holding the GLOCK
authorMarc Dionne <marc.c.dionne@gmail.com>
Sun, 5 Sep 2010 14:48:52 +0000 (10:48 -0400)
committerDerrick Brashear <shadow@dementia.org>
Sun, 5 Sep 2010 15:49:25 +0000 (08:49 -0700)
Limit the scope of the GUNLOCK-GLOCK blocks to cover only the RX
calls.  This prevents afs_Analyze from being called without the
GLOCK, which causes an oops in afs_icl_Event4() where there's
an ASSERT_GLOCK.

Change-Id: Ifa6942d08f22479c0affba3ebd1fc9bf4063d8a5
Reviewed-on: http://gerrit.openafs.org/2668
Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/afs/VNOPS/afs_vnop_lookup.c

index bd415f2..7bdbb2c 100644 (file)
@@ -930,19 +930,22 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp)
        if (tcp) {
            hostp = tcp->srvr->server;
            XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_BULKSTATUS);
-           RX_AFS_GUNLOCK();
 
            if (!(tcp->srvr->server->flags & SNO_INLINEBULK)) {
            retryonce:
+               RX_AFS_GUNLOCK();
                code =
                    RXAFS_InlineBulkStatus(tcp->id, &fidParm, &statParm,
                                           &cbParm, &volSync);
+               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)) {
@@ -960,11 +963,12 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp)
                }
            } else {
                inlinebulk = 0;
+               RX_AFS_GUNLOCK();
                code =
                    RXAFS_BulkStatus(tcp->id, &fidParm, &statParm, &cbParm,
                                     &volSync);
+               RX_AFS_GLOCK();
            }
-           RX_AFS_GLOCK();
            XSTATS_END_TIME;
        } else
            code = -1;