afs_Conn must be called within the analyze loop
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Sat, 17 Oct 2009 07:49:03 +0000 (08:49 +0100)
committerDerrick Brashear <shadow|account-1000005@unknown>
Sat, 17 Oct 2009 23:19:14 +0000 (16:19 -0700)
afs_Analyze calls afs_PutConn, so each pass through the
afs_Analyze loop must call afs_Conn to get a new connection handle.

afs_CacheStoreVCache (part of the fetchstore refactoring) wasn't doing
this, and so producing garbage data upon retries.

Reviewed-on: http://gerrit.openafs.org/674
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/afs/afs_fetchstore.c

index f94ad9e..7b9bf05 100644 (file)
@@ -593,28 +593,26 @@ afs_CacheStoreVCache(struct dcache **dcList, struct vcache *avc,
                       ICL_HANDLE_OFFSET(base), ICL_TYPE_OFFSET,
                       ICL_HANDLE_OFFSET(bytes), ICL_TYPE_OFFSET,
                       ICL_HANDLE_OFFSET(length));
-           tc = afs_Conn(&avc->f.fid, areq, 0);
 
            do {
+               tc = afs_Conn(&avc->f.fid, areq, 0);
+
 #ifdef AFS_64BIT_CLIENT
              restart:
 #endif
                code = rxfs_storeInit(avc, tc, base, bytes, length,
-                                       sync, &ops, &rock);
-               if ( code )
-                   goto nocall;
-
-               code = afs_CacheStoreDCaches(avc, dclist, bytes, anewDV,
-                       &doProcessFS, &OutStatus, nchunks, nomore, ops, rock);
+                                     sync, &ops, &rock);
+               if ( !code ) {
+                   code = afs_CacheStoreDCaches(avc, dclist, bytes, anewDV,
+                                                &doProcessFS, &OutStatus,
+                                                nchunks, nomore, ops, rock);
+               }
 
-nocall:
 #ifdef AFS_64BIT_CLIENT
                if (code == RXGEN_OPCODE && !afs_serverHasNo64Bit(tc)) {
                    afs_serverSetNo64Bit(tc);
                    goto restart;
                }
-#else
-               continue;       /* dummy, label before block end won't work */
 #endif /* AFS_64BIT_CLIENT */
            } while (afs_Analyze
                     (tc, code, &avc->f.fid, areq,