]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DEVEL15-dafs-loadvolumeheader-before-we-need-it-20070920
authorDerrick Brashear <shadow@dementia.org>
Thu, 20 Sep 2007 05:09:45 +0000 (05:09 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 20 Sep 2007 05:09:45 +0000 (05:09 +0000)
make sure we have a header instead of potentially dereffing null

(cherry picked from commit 1aad009863a20306faae2996523a7a4c5efab18b)

src/vol/volume.c

index 3e6f54868be773ccf148c3c3997c5909b4aa9805..42fca0b2cecd6e3b402c3ec3e1185d75a6e749cb 100644 (file)
@@ -2723,30 +2723,8 @@ GetVolume(Error * ec, Error * client_ec, VolId volumeId, Volume * hint, int flag
            vp = NULL;
            break;
        }
+#endif
 
-       if (vp->pending_vol_op && !VVolOpLeaveOnline_r(vp, vp->pending_vol_op)) {
-           if (client_ec) {
-               /* see CheckVnode() in afsfileprocs.c for an explanation
-                * of this error code logic */
-               afs_uint32 now = FT_ApproxTime();
-               if ((vp->stats.last_vol_op + (10 * 60)) >= now) {
-                   *client_ec = VBUSY;
-               } else {
-                   *client_ec = VRESTARTING;
-               }
-           }
-           *ec = VOFFLINE;
-           vp = NULL;
-           break;
-       }
-
-       if (V_attachState(vp) == VOL_STATE_UNATTACHED) {
-           *ec = VOFFLINE;
-           vp = NULL;
-           break;
-       }
-#endif /* AFS_DEMAND_ATTACH_FS */
-       
        LoadVolumeHeader(ec, vp);
        if (*ec) {
            VGET_CTR_INC(V6);
@@ -2770,6 +2748,30 @@ GetVolume(Error * ec, Error * client_ec, VolId volumeId, Volume * hint, int flag
            break;
        }
 
+#ifdef AFS_DEMAND_ATTACH_FS
+       if (vp->pending_vol_op && !VVolOpLeaveOnline_r(vp, vp->pending_vol_op)) {
+           if (client_ec) {
+               /* see CheckVnode() in afsfileprocs.c for an explanation
+                * of this error code logic */
+               afs_uint32 now = FT_ApproxTime();
+               if ((vp->stats.last_vol_op + (10 * 60)) >= now) {
+                   *client_ec = VBUSY;
+               } else {
+                   *client_ec = VRESTARTING;
+               }
+           }
+           *ec = VOFFLINE;
+           vp = NULL;
+           break;
+       }
+
+       if (V_attachState(vp) == VOL_STATE_UNATTACHED) {
+           *ec = VOFFLINE;
+           vp = NULL;
+           break;
+       }
+#endif /* AFS_DEMAND_ATTACH_FS */
+       
        VGET_CTR_INC(V7);
        if (vp->shuttingDown) {
            VGET_CTR_INC(V8);