From: Derrick Brashear Date: Thu, 20 Sep 2007 05:09:45 +0000 (+0000) Subject: DEVEL15-dafs-loadvolumeheader-before-we-need-it-20070920 X-Git-Tag: openafs-devel-1_5_25~2 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=11db4ed9ca4ffe62cd74e671d6c0595a0f82bb98;p=packages%2Fo%2Fopenafs.git DEVEL15-dafs-loadvolumeheader-before-we-need-it-20070920 make sure we have a header instead of potentially dereffing null (cherry picked from commit 1aad009863a20306faae2996523a7a4c5efab18b) --- diff --git a/src/vol/volume.c b/src/vol/volume.c index 3e6f54868..42fca0b2c 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -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);