#include <afs/param.h>
#include <roken.h>
+#include <afs/opr.h>
#include <ctype.h>
#include <stddef.h>
#endif
#endif
#else /* AFS_VFSINCL_ENV */
-#if !defined(AFS_AIX_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_ARM_DARWIN_ENV)
+#if !defined(AFS_AIX_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_DARWIN_ENV)
#include <sys/fs.h>
#endif
#endif /* AFS_VFSINCL_ENV */
#include "partition.h"
#include "volume_inline.h"
#include "common.h"
-#include "afs/afs_assert.h"
#include "vutils.h"
#include <afs/dir.h>
SYNC_response res;
memset(&res, 0, sizeof(res));
- if (FSYNC_VolOp(volid, VPartitionPath(partp), FSYNC_VOL_NEEDVOLUME, mode, &res)
+ if (FSYNC_VolOp(volid, partp->name, FSYNC_VOL_NEEDVOLUME, mode, &res)
!= SYNC_OK) {
if (res.hdr.reason == FSYNC_SALVAGE) {
#if defined(AFS_DEMAND_ATTACH_FS) && defined(FSSYNC_BUILD_CLIENT)
if (!peek && *ec == 0 && retry == 0 && VMustCheckoutVolume(mode)) {
- code = FSYNC_VerifyCheckout(volid, VPartitionPath(partp), FSYNC_VOL_NEEDVOLUME, mode);
+ code = FSYNC_VerifyCheckout(volid, partp->name, FSYNC_VOL_NEEDVOLUME, mode);
if (code == SYNC_DENIED) {
/* must retry checkout; fileserver no longer thinks we have
/* check to see if we should set the specialStatus flag */
if (VVolOpSetVBusy_r(vp, vp->pending_vol_op)) {
- vp->specialStatus = VBUSY;
+ /* don't overwrite specialStatus if it was already set to
+ * something else (e.g. VMOVED) */
+ if (!vp->specialStatus) {
+ vp->specialStatus = VBUSY;
+ }
}
break;
if (!*ec) {
read_header = 1;
- vp->specialStatus = (byte) (isbusy ? VBUSY : 0);
+ /* ensure that we don't override specialStatus if it was set to
+ * something else (e.g. VMOVED) */
+ if (isbusy && !vp->specialStatus) {
+ vp->specialStatus = VBUSY;
+ }
vp->shuttingDown = 0;
vp->goingOffline = 0;
vp->nUsers = 1;
}
if (V_attachState(vp) == VOL_STATE_PREATTACHED) {
+ if (vp->specialStatus) {
+ *ec = vp->specialStatus;
+ vp = NULL;
+ break;
+ }
avp = VAttachVolumeByVp_r(ec, vp, 0);
if (avp) {
if (vp != avp) {
notifyServer = vp->needsPutBack;
if (V_destroyMe(vp) == DESTROY_ME)
useDone = FSYNC_VOL_LEAVE_OFF;
-#ifdef AFS_DEMAND_ATTACH_FS
+# ifdef AFS_DEMAND_ATTACH_FS
else if (!V_blessed(vp) || !V_inService(vp))
useDone = FSYNC_VOL_LEAVE_OFF;
-#endif
+# endif
+ }
+# ifdef AFS_DEMAND_ATTACH_FS
+ if (V_needsSalvaged(vp)) {
+ notifyServer = 0;
+ VRequestSalvage_r(ec, vp, SALVSYNC_NEEDED, 0);
}
+# endif
tpartp = vp->partition;
volume = V_id(vp);
#endif /* FSSYNC_BUILD_CLIENT */
VOfflineForSalvage_r(vp);
}
}
+ /* If we are non-fileserver, we're telling the fileserver to
+ * salvage the vol, so we don't need to give it back separately. */
+ vp->needsPutBack = 0;
+
*ec = VSALVAGING;
} else {
Log("VRequestSalvage: volume %u online salvaged too many times; forced offline.\n", vp->hashid);
* set the volume to an exclusive state and drop the lock
* around the SALVSYNC call
*/
- strlcpy(partName, VPartitionPath(vp->partition), sizeof(partName));
+ strlcpy(partName, vp->partition->name, sizeof(partName));
state_save = VChangeState_r(vp, VOL_STATE_SALVSYNC_REQ);
VOL_UNLOCK;
void
VPrintCacheStats_r(void)
{
- afs_uint32 get_hi, get_lo, load_hi, load_lo;
struct VnodeClassInfo *vcp;
vcp = &VnodeClassInfo[vLarge];
Log("Large vnode cache, %d entries, %d allocs, %d gets (%d reads), %d writes\n", vcp->cacheSize, vcp->allocs, vcp->gets, vcp->reads, vcp->writes);
vcp = &VnodeClassInfo[vSmall];
Log("Small vnode cache,%d entries, %d allocs, %d gets (%d reads), %d writes\n", vcp->cacheSize, vcp->allocs, vcp->gets, vcp->reads, vcp->writes);
- SplitInt64(VStats.hdr_gets, get_hi, get_lo);
- SplitInt64(VStats.hdr_loads, load_hi, load_lo);
- Log("Volume header cache, %d entries, %d gets, %d replacements\n",
- VStats.hdr_cache_size, get_lo, load_lo);
+ Log("Volume header cache, %d entries, %"AFS_INT64_FMT" gets, "
+ "%"AFS_INT64_FMT" replacements\n",
+ VStats.hdr_cache_size, VStats.hdr_gets, VStats.hdr_loads);
}
void