#ifndef WCOREDUMP
#define WCOREDUMP(x) ((x) & 0200)
#endif
-#include <rx/xdr.h>
+#include <afs/opr.h>
+#ifdef AFS_PTHREAD_ENV
+# include <opr/lock.h>
+#endif
+
#include <afs/afsint.h>
#if !defined(AFS_SGI_ENV) && !defined(AFS_NT40_ENV)
#if defined(AFS_VFSINCL_ENV)
#include <afs/dir.h>
#include <afs/afsutil.h>
#include <afs/fileutil.h>
+#include <rx/rx_queue.h>
#include "nfs.h"
#include "lwp.h"
static void MaybeAskOnline(struct SalvInfo *salvinfo, VolumeId volumeId);
static void AskError(struct SalvInfo *salvinfo, VolumeId volumeId);
-#if defined(AFS_DEMAND_ATTACH_FS) || defined(AFS_DEMAND_ATTACH_UTIL)
+#ifdef AFS_DEMAND_ATTACH_FS
static int LockVolume(struct SalvInfo *salvinfo, VolumeId volumeId);
-#endif /* AFS_DEMAND_ATTACH_FS || AFS_DEMAND_ATTACH_UTIL */
+#endif /* AFS_DEMAND_ATTACH_FS */
/* Uniquifier stored in the Inode */
static Unique
FILE *mntfp;
struct mntent *mntent;
- osi_Assert(mntfp = setmntent(MOUNTED, "r"));
+ opr_Verify(mntfp = setmntent(MOUNTED, "r"));
while (mntent = getmntent(mntfp)) {
if (!strcmp(part, mntent->mnt_dir))
break;
* job to finish. When it's done, clean up after it.
*/
pid = wait(&wstatus);
- osi_Assert(pid != -1);
+ opr_Assert(pid != -1);
for (j = 0; j < numjobs; j++) { /* Find which job it is */
if (pid == jobs[j]->pid)
break;
}
- osi_Assert(j < numjobs);
+ opr_Assert(j < numjobs);
if (WCOREDUMP(wstatus)) { /* Say if the job core dumped */
Log("Salvage of %s core dumped!\n", jobs[j]->partP->name);
}
Abort("Raced too many times with fileserver restarts while trying to "
"checkout/lock volumes; Aborted\n");
}
-#if defined(AFS_DEMAND_ATTACH_FS) || defined(AFS_DEMAND_ATTACH_UTIL)
+#ifdef AFS_DEMAND_ATTACH_FS
if (tries > 1) {
/* unlock all previous volume locks, since we're about to lock them
* again */
VLockFileReinit(&partP->volLockFile);
}
-#endif /* AFS_DEMAND_ATTACH_FS || AFS_DEMAND_ATTACH_UTIL */
+#endif /* AFS_DEMAND_ATTACH_FS */
salvinfo->fileSysPartition = partP;
salvinfo->fileSysDevice = salvinfo->fileSysPartition->device;
#endif
if (singleVolumeNumber) {
-#if !(defined(AFS_DEMAND_ATTACH_FS) || defined(AFS_DEMAND_ATTACH_UTIL))
+#ifndef AFS_DEMAND_ATTACH_FS
/* only non-DAFS locks the partition when salvaging a single volume;
* DAFS will lock the individual volumes in the VG */
VLockPartition(partP->name);
-#endif /* !(AFS_DEMAND_ATTACH_FS || AFS_DEMAND_ATTACH_UTIL) */
+#endif /* !AFS_DEMAND_ATTACH_FS */
ForceSalvage = 1;
salvinfo->useFSYNC = 1;
AskOffline(salvinfo, singleVolumeNumber);
-#if defined(AFS_DEMAND_ATTACH_FS) || defined(AFS_DEMAND_ATTACH_UTIL)
+#ifdef AFS_DEMAND_ATTACH_FS
if (LockVolume(salvinfo, singleVolumeNumber)) {
goto retry;
}
-#endif /* AFS_DEMAND_ATTACH_FS || AFS_DEMAND_ATTACH_UTIL */
+#endif /* AFS_DEMAND_ATTACH_FS */
} else {
salvinfo->useFSYNC = 0;
DIR *dirp;
struct dirent *dp;
- osi_Assert((dirp = opendir(salvinfo->fileSysPath)) != NULL);
+ opr_Verify((dirp = opendir(salvinfo->fileSysPath)) != NULL);
while ((dp = readdir(dirp))) {
if (!strncmp(dp->d_name, "salvage.inodes.", 15)
|| !strncmp(dp->d_name, "salvage.temp.", 13)) {
if (!Testing && singleVolumeNumber) {
int foundSVN = 0;
-#if defined(AFS_DEMAND_ATTACH_FS) || defined(AFS_DEMAND_ATTACH_UTIL)
+#ifdef AFS_DEMAND_ATTACH_FS
/* unlock vol headers so the fs can attach them when we AskOnline */
VLockFileReinit(&salvinfo->fileSysPartition->volLockFile);
-#endif /* AFS_DEMAND_ATTACH_FS || AFS_DEMAND_ATTACH_UTIL */
+#endif /* AFS_DEMAND_ATTACH_FS */
/* Step through the volumeSummary list and set all volumes on-line.
* Most volumes were taken off-line in GetVolumeSummary.
afs_int32 code;
code = VDestroyVolumeDiskHeader(salvinfo->fileSysPartition, vsp->header.id, vsp->header.parent);
if (code) {
- Log("Error %ld destroying volume disk header for volume %lu\n",
+ Log("Error %ld destroying volume disk header for volume %" AFS_VOLID_FMT "\n",
afs_printable_int32_ld(code),
- afs_printable_uint32_lu(vsp->header.id));
+ afs_printable_VolumeId_lu(vsp->header.id));
}
/* make sure we actually delete the header file; ENOENT
}
int
-OnlyOneVolume(struct ViceInodeInfo *inodeinfo, afs_uint32 singleVolumeNumber, void *rock)
+OnlyOneVolume(struct ViceInodeInfo *inodeinfo, VolumeId singleVolumeNumber, void *rock)
{
if (inodeinfo->u.vnode.vnodeNumber == INODESPECIAL)
return (inodeinfo->u.special.parentId == singleVolumeNumber);
}
st_size = OS_SIZE(summaryFile);
- osi_Assert(st_size >= 0);
+ opr_Assert(st_size >= 0);
if (st_size != 0) {
int ret;
salvinfo->inodeSummary = malloc(st_size);
- osi_Assert(salvinfo->inodeSummary != NULL);
+ opr_Assert(salvinfo->inodeSummary != NULL);
/* For GNU we need to do lseek to get the file pointer moved. */
- osi_Assert(OS_SEEK(summaryFile, 0, SEEK_SET) == 0);
+ opr_Assert(OS_SEEK(summaryFile, 0, SEEK_SET) == 0);
ret = OS_READ(summaryFile, salvinfo->inodeSummary, st_size);
- osi_Assert(ret == st_size);
+ opr_Assert(ret == st_size);
}
salvinfo->nVolumesInInodeFile = st_size / sizeof(struct InodeSummary);
for (i = 0; i < salvinfo->nVolumesInInodeFile; i++) {
}
if (code) {
- Log("fileserver refused VGCQuery request for volume %lu on "
+ Log("fileserver refused VGCQuery request for volume %" AFS_VOLID_FMT " on "
"partition %s, code %ld reason %ld\n",
- afs_printable_uint32_lu(singleVolumeNumber),
+ afs_printable_VolumeId_lu(singleVolumeNumber),
salvinfo->fileSysPartition->name,
afs_printable_int32_ld(code),
afs_printable_int32_ld(res.hdr.reason));
}
if (q_res.rw != singleVolumeNumber) {
- Log("fileserver requested salvage of clone %lu; scheduling salvage of volume group %lu...\n",
- afs_printable_uint32_lu(singleVolumeNumber),
- afs_printable_uint32_lu(q_res.rw));
+ Log("fileserver requested salvage of clone %" AFS_VOLID_FMT "; scheduling salvage of volume group %" AFS_VOLID_FMT "...\n",
+ afs_printable_VolumeId_lu(singleVolumeNumber),
+ afs_printable_VolumeId_lu(q_res.rw));
#ifdef SALVSYNC_BUILD_CLIENT
if (SALVSYNC_LinkVolume(q_res.rw,
singleVolumeNumber,
}
salvinfo->volumeSummaryp = calloc(VOL_VG_MAX_VOLS, sizeof(struct VolumeSummary));
- osi_Assert(salvinfo->volumeSummaryp != NULL);
+ opr_Assert(salvinfo->volumeSummaryp != NULL);
salvinfo->nVolumes = 0;
vsp = salvinfo->volumeSummaryp;
if (programType == salvageServer) {
#ifdef SALVSYNC_BUILD_CLIENT
- Log("fileserver requested salvage of clone %u; scheduling salvage of volume group %u...\n",
- summary.header.id, summary.header.parent);
+ Log("fileserver requested salvage of clone %" AFS_VOLID_FMT "; scheduling salvage of volume group %" AFS_VOLID_FMT "...\n",
+ afs_printable_VolumeId_lu(summary.header.id),
+ afs_printable_VolumeId_lu(summary.header.parent));
if (SALVSYNC_LinkVolume(summary.header.parent,
summary.header.id,
dp->name,
Exit(SALSRV_EXIT_VOLGROUP_LINK);
} else {
- Log("%u is a read-only volume; not salvaged\n",
- singleVolumeNumber);
+ Log("%" AFS_VOLID_FMT " is a read-only volume; not salvaged\n",
+ afs_printable_VolumeId_lu(singleVolumeNumber));
Exit(1);
}
}
}
snprintf(nameShouldBe, sizeof nameShouldBe,
- VFORMAT, afs_printable_uint32_lu(summary.header.id));
+ VFORMAT, afs_printable_VolumeId_lu(summary.header.id));
if (strcmp(nameShouldBe, base)) {
AskOffline(salvinfo, summary.header.id);
-#if defined(AFS_DEMAND_ATTACH_FS) || defined(AFS_DEMAND_ATTACH_UTIL)
+#ifdef AFS_DEMAND_ATTACH_FS
if (!badname) {
/* don't lock the volume if the header is bad, since we're
* about to delete it anyway. */
return -1;
}
}
-#endif /* AFS_DEMAND_ATTACH_FS || AFS_DEMAND_ATTACH_UTIL */
+#endif /* AFS_DEMAND_ATTACH_FS */
}
}
if (badname) {
}
salvinfo->volumeSummaryp = calloc(nvols, sizeof(struct VolumeSummary));
- osi_Assert(salvinfo->volumeSummaryp != NULL);
+ opr_Assert(salvinfo->volumeSummaryp != NULL);
params.singleVolumeNumber = singleVolumeNumber;
params.vsp = salvinfo->volumeSummaryp;
INODESPECIAL, VI_LINKTABLE, isp->RWvolumeId);
if (!VALID_INO(ino))
Abort
- ("Unable to allocate link table inode for volume %u (error = %d)\n",
- isp->RWvolumeId, errno);
+ ("Unable to allocate link table inode for volume %" AFS_VOLID_FMT " (error = %d)\n",
+ afs_printable_VolumeId_lu(isp->RWvolumeId), errno);
IH_INIT(salvinfo->VGLinkH, salvinfo->fileSysDevice, isp->RWvolumeId, ino);
fdP = IH_OPEN(salvinfo->VGLinkH);
if (fdP == NULL)
- Abort("Can't open link table for volume %u (error = %d)\n",
- isp->RWvolumeId, errno);
+ Abort("Can't open link table for volume %" AFS_VOLID_FMT " (error = %d)\n",
+ afs_printable_VolumeId_lu(isp->RWvolumeId), errno);
if (FDH_TRUNC(fdP, sizeof(version) + sizeof(short)) < 0)
- Abort("Can't truncate link table for volume %u (error = %d)\n",
- isp->RWvolumeId, errno);
+ Abort("Can't truncate link table for volume %" AFS_VOLID_FMT " (error = %d)\n",
+ afs_printable_VolumeId_lu(isp->RWvolumeId), errno);
version.magic = LINKTABLEMAGIC;
version.version = LINKTABLEVERSION;
if (FDH_PWRITE(fdP, (char *)&version, sizeof(version), 0)
!= sizeof(version))
- Abort("Can't truncate link table for volume %u (error = %d)\n",
- isp->RWvolumeId, errno);
+ Abort("Can't truncate link table for volume %" AFS_VOLID_FMT " (error = %d)\n",
+ afs_printable_VolumeId_lu(isp->RWvolumeId), errno);
FDH_REALLYCLOSE(fdP);
allInodes = inodes - isp->index; /* this would the base of all the inodes
* for the partition, if all the inodes
* had been read into memory */
- osi_Assert(OS_SEEK
+ opr_Verify(OS_SEEK
(salvinfo->inodeFd, isp->index * sizeof(struct ViceInodeInfo),
SEEK_SET) != -1);
- osi_Assert(OS_READ(salvinfo->inodeFd, inodes, size) == size);
+ opr_Verify(OS_READ(salvinfo->inodeFd, inodes, size) == size);
/* Don't try to salvage a read write volume if there isn't one on this
* partition */
nBytes = FDH_PREAD(fdP, (char *)&header, sizeof(struct versionStamp), 0);
if (nBytes != sizeof(struct versionStamp)
|| header.magic != LINKTABLEMAGIC) {
- Log("Bad linktable header for volume %u.\n", isp->RWvolumeId);
+ Log("Bad linktable header for volume %" AFS_VOLID_FMT ".\n", afs_printable_VolumeId_lu(isp->RWvolumeId));
FDH_REALLYCLOSE(fdP);
fdP = NULL;
}
}
if (!VALID_INO(ino) || fdP == NULL) {
- Log("%s link table for volume %u.\n",
- Testing ? "Would have recreated" : "Recreating", isp->RWvolumeId);
+ Log("%s link table for volume %" AFS_VOLID_FMT ".\n",
+ Testing ? "Would have recreated" : "Recreating", afs_printable_VolumeId_lu(isp->RWvolumeId));
if (Testing) {
IH_INIT(salvinfo->VGLinkH, salvinfo->fileSysDevice, -1, -1);
} else {
}
#endif
if (!Showmode)
- Log("%s VOLUME %u%s.\n", rw ? "SALVAGING" : "CHECKING CLONED",
- lisp->volumeId, (Testing ? "(READONLY mode)" : ""));
+ Log("%s VOLUME %" AFS_VOLID_FMT "%s.\n", rw ? "SALVAGING" : "CHECKING CLONED",
+ afs_printable_VolumeId_lu(lisp->volumeId), (Testing ? "(READONLY mode)" : ""));
/* Check inodes twice. The second time do things seriously. This
* way the whole RO volume can be deleted, below, if anything goes wrong */
for (check = 1; check >= 0; check--) {
#endif
if (ip->linkCount != 0 && TraceBadLinkCounts) {
TraceBadLinkCounts--; /* Limit reports, per volume */
- Log("#### DEBUG #### Link count incorrect by %d; inode %s, size %llu, p=(%u,%u,%u,%u)\n", ip->linkCount, PrintInode(stmp, ip->inodeNumber), (afs_uintmax_t) ip->byteCount, ip->u.param[0], ip->u.param[1], ip->u.param[2], ip->u.param[3]);
+ Log("#### DEBUG #### Link count incorrect by %d; inode %s, size %llu, p=(%u,%u,%u,%u)\n", ip->linkCount, PrintInode(stmp, ip->inodeNumber), (afs_uintmax_t) ip->byteCount, ip->u.param[0], ip->u.param[1], ip->u.param[2], ip->u.param[3]); /* VolumeId in param */
}
while (ip->linkCount > 0) {
/* below used to assert, not break */
continue;
}
if (!Showmode) {
- Log("Duplicate special %d inodes for volume %u found (%s, %s);\n",
- ip->u.special.type, isp->volumeId,
+ Log("Duplicate special %d inodes for volume %" AFS_VOLID_FMT " found (%s, %s);\n",
+ ip->u.special.type, afs_printable_VolumeId_lu(isp->volumeId),
PrintInode(stmp1, ip->inodeNumber),
PrintInode(stmp2, (ip+1)->inodeNumber));
}
}
} else {
if (!Showmode)
- Log("cannot determine which is correct; salvage of volume %u aborted\n", isp->volumeId);
+ Log("cannot determine which is correct; salvage of volume %" AFS_VOLID_FMT " aborted\n", afs_printable_VolumeId_lu(isp->volumeId));
if (skip) {
free(skip);
}
char path[64];
char headerName[64];
snprintf(headerName, sizeof headerName, VFORMAT,
- afs_printable_uint32_lu(isp->volumeId));
+ afs_printable_VolumeId_lu(isp->volumeId));
snprintf(path, sizeof path, "%s" OS_DIRSEP "%s",
salvinfo->fileSysPath, headerName);
if (check) {
- Log("No header file for volume %u\n", isp->volumeId);
+ Log("No header file for volume %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(isp->volumeId));
return -1;
}
if (!Showmode)
- Log("No header file for volume %u; %screating %s\n",
- isp->volumeId, (Testing ? "it would have been " : ""),
+ Log("No header file for volume %" AFS_VOLID_FMT "; %screating %s\n",
+ afs_printable_VolumeId_lu(isp->volumeId), (Testing ? "it would have been " : ""),
path);
isp->volSummary = calloc(1, sizeof(struct VolumeSummary));
sizeof(struct VolumeHeader));
if (Testing) {
if (!Showmode)
- Log("It would have written a new header file for volume %u\n",
- isp->volumeId);
+ Log("It would have written a new header file for volume %" AFS_VOLID_FMT "\n",
+ afs_printable_VolumeId_lu(isp->volumeId));
} else {
afs_int32 code;
VolumeHeaderToDisk(&diskHeader, &tempHeader);
code = (*writefunc)(&diskHeader, salvinfo->fileSysPartition);
if (code) {
- Log("Error %ld writing volume header file for volume %lu\n",
+ Log("Error %ld writing volume header file for volume %" AFS_VOLID_FMT "\n",
afs_printable_int32_ld(code),
- afs_printable_uint32_lu(diskHeader.id));
+ afs_printable_VolumeId_lu(diskHeader.id));
return -1;
}
}
header.volumeInfo.stamp = sp->stamp;
header.volumeInfo.id = isp->volumeId;
header.volumeInfo.parentId = isp->RWvolumeId;
- sprintf(header.volumeInfo.name, "bogus.%u", isp->volumeId);
- Log("Warning: the name of volume %u is now \"bogus.%u\"\n",
- isp->volumeId, isp->volumeId);
+ sprintf(header.volumeInfo.name, "bogus.%" AFS_VOLID_FMT, afs_printable_VolumeId_lu(isp->volumeId));
+ Log("Warning: the name of volume %" AFS_VOLID_FMT " is now \"bogus.%" AFS_VOLID_FMT "\"\n",
+ afs_printable_VolumeId_lu(isp->volumeId), afs_printable_VolumeId_lu(isp->volumeId));
header.volumeInfo.inService = 0;
header.volumeInfo.blessed = 0;
/* The + 1000 is a hack in case there are any files out in venus caches */
if (salvinfo->VolInfo.updateDate) {
strcpy(update, TimeStamp(salvinfo->VolInfo.updateDate, 0));
if (!Showmode)
- Log("%s (%u) %supdated %s\n", salvinfo->VolInfo.name,
- salvinfo->VolInfo.id,
+ Log("%s (%" AFS_VOLID_FMT ") %supdated %s\n", salvinfo->VolInfo.name,
+ afs_printable_VolumeId_lu(salvinfo->VolInfo.id),
(Testing ? "it would have been " : ""), update);
} else {
strcpy(update, TimeStamp(salvinfo->VolInfo.creationDate, 0));
if (!Showmode)
- Log("%s (%u) not updated (created %s)\n",
- salvinfo->VolInfo.name, salvinfo->VolInfo.id, update);
+ Log("%s (%" AFS_VOLID_FMT ") not updated (created %s)\n",
+ salvinfo->VolInfo.name, afs_printable_VolumeId_lu(salvinfo->VolInfo.id), update);
}
}
IH_INIT(handle, salvinfo->fileSysDevice, volSummary->header.parent, ino);
fdP = IH_OPEN(handle);
- osi_Assert(fdP != NULL);
+ opr_Assert(fdP != NULL);
file = FDH_FDOPEN(fdP, "r+");
- osi_Assert(file != NULL);
+ opr_Assert(file != NULL);
vcp = &VnodeClassInfo[class];
size = OS_SIZE(fdP->fd_fd);
- osi_Assert(size != -1);
+ opr_Assert(size != -1);
nVnodes = (size / vcp->diskSize) - 1;
if (nVnodes > 0) {
- osi_Assert((nVnodes + 1) * vcp->diskSize == size);
- osi_Assert(STREAM_ASEEK(file, vcp->diskSize) == 0);
+ opr_Assert((nVnodes + 1) * vcp->diskSize == size);
+ opr_Verify(STREAM_ASEEK(file, vcp->diskSize) == 0);
} else {
nVnodes = 0;
}
}
} /* VNDISK_GET_INO(vnode) != 0 */
vnodeDone:
- osi_Assert(!(vnodeChanged && check));
+ opr_Assert(!(vnodeChanged && check));
if (vnodeChanged && !Testing) {
- osi_Assert(IH_IWRITE
- (handle, vnodeIndexOffset(vcp, vnodeNumber),
- (char *)vnode, vcp->diskSize)
- == vcp->diskSize);
+ opr_Verify(IH_IWRITE(handle,
+ vnodeIndexOffset(vcp, vnodeNumber),
+ (char *)vnode, vcp->diskSize)
+ == vcp->diskSize);
salvinfo->VolumeChanged = 1; /* For break call back */
}
}
IH_IREAD(salvinfo->vnodeInfo[vLarge].handle,
vnodeIndexOffset(vcp, dir->vnodeNumber), (char *)&vnode,
sizeof(vnode));
- osi_Assert(code == sizeof(vnode));
+ opr_Assert(code == sizeof(vnode));
oldinode = VNDISK_GET_INO(&vnode);
/* Increment the version number by a whole lot to avoid problems with
* clients that were promised new version numbers--but the file server
IH_CREATE(dir->ds_linkH, salvinfo->fileSysDevice, salvinfo->fileSysPath, 0, dir->rwVid,
dir->vnodeNumber, vnode.uniquifier, vnode.dataVersion +=
200);
- osi_Assert(VALID_INO(newinode));
- osi_Assert(CopyInode(salvinfo->fileSysDevice, oldinode, newinode, dir->rwVid) == 0);
+ opr_Assert(VALID_INO(newinode));
+ opr_Verify(CopyInode(salvinfo->fileSysDevice, oldinode, newinode,
+ dir->rwVid) == 0);
vnode.cloned = 0;
VNDISK_SET_INO(&vnode, newinode);
code =
IH_IWRITE(salvinfo->vnodeInfo[vLarge].handle,
vnodeIndexOffset(vcp, dir->vnodeNumber), (char *)&vnode,
sizeof(vnode));
- osi_Assert(code == sizeof(vnode));
+ opr_Assert(code == sizeof(vnode));
SetSalvageDirHandle(&dir->dirHandle, dir->dirHandle.dirh_handle->ih_vid,
salvinfo->fileSysDevice, newinode,
IH_IREAD(salvinfo->vnodeInfo[vLarge].handle,
vnodeIndexOffset(vcp, dir->vnodeNumber), (char *)&vnode,
sizeof(vnode));
- osi_Assert(lcode == sizeof(vnode));
+ opr_Assert(lcode == sizeof(vnode));
oldinode = VNDISK_GET_INO(&vnode);
/* Increment the version number by a whole lot to avoid problems with
* clients that were promised new version numbers--but the file server
IH_CREATE(dir->ds_linkH, salvinfo->fileSysDevice, salvinfo->fileSysPath, 0, dir->rwVid,
dir->vnodeNumber, vnode.uniquifier, vnode.dataVersion +=
200);
- osi_Assert(VALID_INO(newinode));
+ opr_Assert(VALID_INO(newinode));
SetSalvageDirHandle(&newdir, dir->rwVid, salvinfo->fileSysDevice, newinode,
&salvinfo->VolumeChanged);
if (code) {
Log("also failed to decrement link count on new inode");
}
- osi_Assert(1 == 2);
+ opr_Assert(0);
}
Log("Checking the results of the directory salvage...\n");
if (!DirOK(&newdir)) {
Log("Directory salvage failed!!!; restoring old version of the directory.\n");
code = IH_DEC(dir->ds_linkH, newinode, dir->rwVid);
- osi_Assert(code == 0);
- osi_Assert(1 == 2);
+ opr_Assert(code == 0);
+ opr_Assert(0);
}
vnode.cloned = 0;
VNDISK_SET_INO(&vnode, newinode);
IH_IWRITE(salvinfo->vnodeInfo[vLarge].handle,
vnodeIndexOffset(vcp, dir->vnodeNumber), (char *)&vnode,
sizeof(vnode));
- osi_Assert(lcode == sizeof(vnode));
-#if 0
-#ifdef AFS_NT40_ENV
- nt_sync(salvinfo->fileSysDevice);
-#else
- sync(); /* this is slow, but hopefully rarely called. We don't have
- * an open FD on the file itself to fsync.
- */
-#endif
-#else
- salvinfo->vnodeInfo[vLarge].handle->ih_synced = 1;
-#endif
+ opr_Assert(lcode == sizeof(vnode));
+ IH_CONDSYNC(salvinfo->vnodeInfo[vLarge].handle);
+
/* make sure old directory file is really closed */
fdP = IH_OPEN(dir->dirHandle.dirh_handle);
FDH_REALLYCLOSE(fdP);
code = IH_DEC(dir->ds_linkH, oldinode, dir->rwVid);
- osi_Assert(code == 0);
+ opr_Assert(code == 0);
dir->dirHandle = newdir;
}
}
if (!Testing) {
CopyOnWrite(salvinfo, dir);
- osi_Assert(afs_dir_Delete(&dir->dirHandle, name) == 0);
+ opr_Verify(afs_dir_Delete(&dir->dirHandle, name) == 0);
}
return 0;
}
Log("dir vnode %d: invalid entry: %s" OS_DIRSEP "%s has no inode (vnode %d, unique %d)%s\n", dir->vnodeNumber, (dir->name ? dir->name : "??"), name, vnodeNumber, unique, (Testing ? "-- would have deleted" : " -- deleted"));
if (!Testing) {
CopyOnWrite(salvinfo, dir);
- osi_Assert(Delete(&dir->dirHandle, name) == 0);
+ opr_Verify(afs_dir_Delete(&dir->dirHandle, name) == 0);
}
return 0;
}
if (!unique) {
if (!Testing) {
CopyOnWrite(salvinfo, dir);
- osi_Assert(afs_dir_Delete(&dir->dirHandle, name) == 0);
+ opr_Verify(afs_dir_Delete(&dir->dirHandle, name) == 0);
}
return 0;
}
* or if the directory is orphaned.
*/
if (!vnodeEssence->unique || (vnodeEssence->unique) != unique) {
- if (!vnodeEssence->unique
- && ((strcmp(name, "..") == 0) || (strcmp(name, ".") == 0))) {
- /* This is an orphaned directory. Don't delete the . or ..
- * entry. Otherwise, it will get created in the next
- * salvage and deleted again here. So Just skip it.
- */
- return 0;
- }
-
todelete = ((!vnodeEssence->unique || dirOrphaned) ? 1 : 0);
- if (!Showmode) {
- Log("dir vnode %u: %s" OS_DIRSEP "%s (vnode %u): unique changed from %u to %u %s\n", dir->vnodeNumber, (dir->name ? dir->name : "??"), name, vnodeNumber, unique, vnodeEssence->unique, (!todelete ? "" : (Testing ? "-- would have deleted" : "-- deleted")));
- }
- if (!Testing) {
- AFSFid fid;
- fid.Vnode = vnodeNumber;
- fid.Unique = vnodeEssence->unique;
- CopyOnWrite(salvinfo, dir);
- osi_Assert(afs_dir_Delete(&dir->dirHandle, name) == 0);
- if (!todelete)
- osi_Assert(afs_dir_Create(&dir->dirHandle, name, &fid) == 0);
+ if (todelete
+ && ((strcmp(name, "..") == 0) || (strcmp(name, ".") == 0))) {
+ if (dirOrphaned) {
+ /* This is an orphaned directory. Don't delete the . or ..
+ * entry. Otherwise, it will get created in the next
+ * salvage and deleted again here. So Just skip it.
+ * */
+ return 0;
+ }
+ /* (vnodeEssence->unique == 0 && ('.' || '..'));
+ * Entries arriving here should be deleted, but the directory
+ * is not orphaned. Therefore, the entry must be pointing at
+ * the wrong vnode. Skip the 'else' clause and fall through;
+ * the code below will repair the entry so it correctly points
+ * at the vnode of the current directory (if '.') or the parent
+ * directory (if '..'). */
+ } else {
+ if (!Showmode) {
+ Log("dir vnode %u: %s" OS_DIRSEP "%s (vnode %u): unique changed from %u to %u %s\n",
+ dir->vnodeNumber, (dir->name ? dir->name : "??"), name, vnodeNumber, unique,
+ vnodeEssence->unique, (!todelete ? "" : (Testing ? "-- would have deleted" : "-- deleted")));
+ }
+ if (!Testing) {
+ AFSFid fid;
+ fid.Vnode = vnodeNumber;
+ fid.Unique = vnodeEssence->unique;
+ CopyOnWrite(salvinfo, dir);
+ opr_Verify(afs_dir_Delete(&dir->dirHandle, name) == 0);
+ if (!todelete)
+ opr_Verify(afs_dir_Create(&dir->dirHandle, name, &fid) == 0);
+ }
+ if (todelete)
+ return 0; /* no need to continue */
}
- if (todelete)
- return 0; /* no need to continue */
}
if (strcmp(name, ".") == 0) {
if (!Testing) {
AFSFid fid;
CopyOnWrite(salvinfo, dir);
- osi_Assert(afs_dir_Delete(&dir->dirHandle, ".") == 0);
+ opr_Verify(afs_dir_Delete(&dir->dirHandle, ".") == 0);
fid.Vnode = dir->vnodeNumber;
fid.Unique = dir->unique;
- osi_Assert(afs_dir_Create(&dir->dirHandle, ".", &fid) == 0);
+ opr_Verify(afs_dir_Create(&dir->dirHandle, ".", &fid) == 0);
vnodeNumber = fid.Vnode; /* Get the new Essence */
unique = fid.Unique;
vnodeEssence = CheckVnodeNumber(salvinfo, vnodeNumber);
struct VnodeEssence *dotdot;
pa.Vnode = dir->parent;
dotdot = CheckVnodeNumber(salvinfo, pa.Vnode);
- osi_Assert(dotdot != NULL); /* XXX Should not be assert */
+ opr_Assert(dotdot != NULL); /* XXX Should not be assert */
pa.Unique = dotdot->unique;
} else {
pa.Vnode = dir->vnodeNumber;
Log("directory vnode %u.%u: bad '..' entry (was %u.%u); fixed\n", dir->vnodeNumber, dir->unique, vnodeNumber, unique);
if (!Testing) {
CopyOnWrite(salvinfo, dir);
- osi_Assert(afs_dir_Delete(&dir->dirHandle, "..") == 0);
- osi_Assert(afs_dir_Create(&dir->dirHandle, "..", &pa) == 0);
+ opr_Verify(afs_dir_Delete(&dir->dirHandle, "..") == 0);
+ opr_Verify(afs_dir_Create(&dir->dirHandle, "..", &pa) == 0);
}
vnodeNumber = pa.Vnode; /* Get the new Essence */
}
if (!Testing) {
CopyOnWrite(salvinfo, dir);
- osi_Assert(afs_dir_Delete(&dir->dirHandle, name) == 0);
+ opr_Verify(afs_dir_Delete(&dir->dirHandle, name) == 0);
}
vnodeEssence->claimed = 0; /* Not claimed: Orphaned */
vnodeEssence->todelete = 1; /* Will later delete vnode and decr inode */
if (nBytes == size) {
buf[size] = '\0';
if ( (*buf != '#' && *buf != '%') || buf[strlen(buf)-1] != '.' ) {
- Log("Volume %u (%s) mount point %s" OS_DIRSEP "%s to '%s' invalid, %s to symbolic link\n",
- dir->dirHandle.dirh_handle->ih_vid, dir->vname, dir->name ? dir->name : "??", name, buf,
+ Log("Volume %" AFS_VOLID_FMT " (%s) mount point %s" OS_DIRSEP "%s to '%s' invalid, %s to symbolic link\n",
+ afs_printable_VolumeId_lu(dir->dirHandle.dirh_handle->ih_vid), dir->vname, dir->name ? dir->name : "??", name, buf,
Testing ? "would convert" : "converted");
vnodeEssence->modeBits |= 0111;
vnodeEssence->changed = 1;
- } else if (ShowMounts) Log("In volume %u (%s) found mountpoint %s" OS_DIRSEP "%s to '%s'\n",
- dir->dirHandle.dirh_handle->ih_vid, dir->vname,
- dir->name ? dir->name : "??", name, buf);
+ } else if (ShowMounts)
+ Log("In volume %" AFS_VOLID_FMT " (%s) found mountpoint %s" OS_DIRSEP "%s to '%s'\n",
+ afs_printable_VolumeId_lu(dir->dirHandle.dirh_handle->ih_vid),
+ dir->vname, dir->name ? dir->name : "??", name, buf);
} else {
Log("Volume %s cound not read mount point vnode %u size %d code %d\n",
dir->vname, vnodeNumber, (int)size, (int)nBytes);
}
if (!Testing) {
CopyOnWrite(salvinfo, dir);
- osi_Assert(afs_dir_Delete(&dir->dirHandle, name) == 0);
+ opr_Verify(afs_dir_Delete(&dir->dirHandle, name) == 0);
}
return 0;
}
IH_INIT(vip->handle, salvinfo->fileSysDevice, rwVId, ino);
fdP = IH_OPEN(vip->handle);
- osi_Assert(fdP != NULL);
+ opr_Assert(fdP != NULL);
file = FDH_FDOPEN(fdP, "r+");
- osi_Assert(file != NULL);
+ opr_Assert(file != NULL);
size = OS_SIZE(fdP->fd_fd);
- osi_Assert(size != -1);
+ opr_Assert(size != -1);
vip->nVnodes = (size / vcp->diskSize) - 1;
if (vip->nVnodes > 0) {
- osi_Assert((vip->nVnodes + 1) * vcp->diskSize == size);
- osi_Assert(STREAM_ASEEK(file, vcp->diskSize) == 0);
- osi_Assert((vip->vnodes = (struct VnodeEssence *)
- calloc(vip->nVnodes, sizeof(struct VnodeEssence))) != NULL);
+ opr_Assert((vip->nVnodes + 1) * vcp->diskSize == size);
+ opr_Verify(STREAM_ASEEK(file, vcp->diskSize) == 0);
+ opr_Verify((vip->vnodes = calloc(vip->nVnodes,
+ sizeof(struct VnodeEssence)))
+ != NULL);
if (class == vLarge) {
- osi_Assert((vip->inodes = (Inode *)
- calloc(vip->nVnodes, sizeof(Inode))) != NULL);
+ opr_Verify((vip->inodes = calloc(vip->nVnodes, sizeof(Inode)))
+ != NULL);
} else {
vip->inodes = NULL;
}
judge_params.salvinfo = salvinfo;
judge_params.dir = &dir;
- osi_Assert(afs_dir_EnumerateDir(&dirHandle, JudgeEntry,
+ opr_Verify(afs_dir_EnumerateDir(&dirHandle, JudgeEntry,
&judge_params) == 0);
}
DFlush();
if (dir.copied && !Testing) {
code = IH_DEC(dir.ds_linkH, dirHandle.dirh_handle->ih_ino, rwVid);
- osi_Assert(code == 0);
+ opr_Assert(code == 0);
dirVnodeInfo->inodes[i] = dir.dirHandle.dirh_inode;
}
salvinfo->vnodeInfo[vLarge].vnodes = calloc(1, sizeof(struct VnodeEssence));
salvinfo->vnodeInfo[vLarge].inodes = calloc(1, sizeof(Inode));
- osi_Assert(salvinfo->vnodeInfo[vLarge].vnodes);
- osi_Assert(salvinfo->vnodeInfo[vLarge].inodes);
+ opr_Assert(salvinfo->vnodeInfo[vLarge].vnodes);
+ opr_Assert(salvinfo->vnodeInfo[vLarge].inodes);
}
vep = &salvinfo->vnodeInfo[vLarge].vnodes[vnodeIdToBitNumber(1)];
vid = rwIsp->volSummary->header.id;
IH_INIT(h, salvinfo->fileSysDevice, vid, rwIsp->volSummary->header.volumeInfo);
nBytes = IH_IREAD(h, 0, (char *)&volHeader, sizeof(volHeader));
- osi_Assert(nBytes == sizeof(volHeader));
- osi_Assert(volHeader.stamp.magic == VOLUMEINFOMAGIC);
- osi_Assert(volHeader.destroyMe != DESTROY_ME);
+ opr_Assert(nBytes == sizeof(volHeader));
+ opr_Assert(volHeader.stamp.magic == VOLUMEINFOMAGIC);
+ opr_Assert(volHeader.destroyMe != DESTROY_ME);
/* (should not have gotten this far with DESTROY_ME flag still set!) */
DistilVnodeEssence(salvinfo, vid, vLarge,
&salvinfo->VolumeChanged);
pa.Vnode = LFVnode;
pa.Unique = LFUnique;
- osi_Assert(afs_dir_Delete(&dh, "..") == 0);
- osi_Assert(afs_dir_Create(&dh, "..", &pa) == 0);
+ opr_Verify(afs_dir_Delete(&dh, "..") == 0);
+ opr_Verify(afs_dir_Create(&dh, "..", &pa) == 0);
/* The original parent's link count was decremented above.
* Here we increment the new parent's link count.
ThisUnique += 50; /* Try creating a different file */
}
- osi_Assert(code == 0);
+ opr_Assert(code == 0);
Log("Attaching orphaned %s to volume's root dir as %s\n",
((class == vLarge) ? "directory" : "file"), npath);
}
code =
IH_DEC(oldrootdir.ds_linkH, oldrootdir.dirHandle.dirh_inode,
oldrootdir.rwVid);
- osi_Assert(code == 0);
+ opr_Assert(code == 0);
/* dirVnodeInfo->inodes[?] is not updated with new inode number */
}
IH_IREAD(salvinfo->vnodeInfo[class].handle,
vnodeIndexOffset(vcp, vnodeNumber),
(char *)&vnode, sizeof(vnode));
- osi_Assert(nBytes == sizeof(vnode));
+ opr_Assert(nBytes == sizeof(vnode));
vnode.parent = vnp->parent;
oldCount = vnode.linkCount;
if (orphaned) {
if (!vnp->todelete) {
/* Orphans should have already been attached (if requested) */
- osi_Assert(orphans != ORPH_ATTACH);
+ opr_Assert(orphans != ORPH_ATTACH);
oblocks += vnp->blockCount;
ofiles++;
}
if (VNDISK_GET_INO(&vnode)) {
code =
IH_DEC(alinkH, VNDISK_GET_INO(&vnode), vid);
- osi_Assert(code == 0);
+ opr_Assert(code == 0);
}
memset(&vnode, 0, sizeof(vnode));
}
IH_IWRITE(salvinfo->vnodeInfo[class].handle,
vnodeIndexOffset(vcp, vnodeNumber),
(char *)&vnode, sizeof(vnode));
- osi_Assert(nBytes == sizeof(vnode));
+ opr_Assert(nBytes == sizeof(vnode));
}
salvinfo->VolumeChanged = 1;
}
/* Make sure the uniquifer is big enough: maxunique is the real maxUniquifier */
if (volHeader.uniquifier < (maxunique + 1)) {
if (!Showmode)
- Log("Volume uniquifier is too low; fixed\n");
+ Log("Volume uniquifier %u is too low (max uniq %u); fixed\n", volHeader.uniquifier, maxunique);
/* Plus 2,000 in case there are workstations out there with
* cached vnodes that have since been deleted
*/
}
#endif /* FSSYNC_BUILD_CLIENT */
-#if defined(AFS_DEMAND_ATTACH_FS) || defined(AFS_DEMAND_ATTACH_UTIL)
+#ifdef AFS_DEMAND_ATTACH_FS
if (!salvinfo->useFSYNC) {
/* A volume's contents have changed, but the fileserver will not
* break callbacks on the volume until it tries to load the vol
salvinfo->VolumeChanged = 0;
if (!Testing) {
nBytes = IH_IWRITE(h, 0, (char *)&volHeader, sizeof(volHeader));
- osi_Assert(nBytes == sizeof(volHeader));
+ opr_Assert(nBytes == sizeof(volHeader));
}
if (!Showmode) {
- Log("%sSalvaged %s (%u): %d files, %d blocks\n",
- (Testing ? "It would have " : ""), volHeader.name, volHeader.id,
+ Log("%sSalvaged %s (%" AFS_VOLID_FMT "): %d files, %d blocks\n",
+ (Testing ? "It would have " : ""), volHeader.name, afs_printable_VolumeId_lu(volHeader.id),
FilesInVolume, BlocksInVolume);
}
VolumeDiskData volHeader;
nBytes = IH_IREAD(h, 0, (char *)&volHeader, sizeof(volHeader));
- osi_Assert(nBytes == sizeof(volHeader));
- osi_Assert(volHeader.stamp.magic == VOLUMEINFOMAGIC);
+ opr_Assert(nBytes == sizeof(volHeader));
+ opr_Assert(volHeader.stamp.magic == VOLUMEINFOMAGIC);
volHeader.inUse = 0;
volHeader.needsSalvaged = 0;
volHeader.inService = 1;
volHeader.dontSalvage = DONT_SALVAGE;
if (!Testing) {
nBytes = IH_IWRITE(h, 0, (char *)&volHeader, sizeof(volHeader));
- osi_Assert(nBytes == sizeof(volHeader));
+ opr_Assert(nBytes == sizeof(volHeader));
}
}
if (isp->volSummary && !isp->volSummary->deleted) {
if (deleteMe) {
if (!Showmode)
- Log("Volume %u (is only a partial volume--probably an attempt was made to move/restore it when a machine crash occured.\n", isp->volumeId);
+ Log("Volume %" AFS_VOLID_FMT " (is only a partial volume--probably an attempt was made to move/restore it when a machine crash occured.\n", afs_printable_VolumeId_lu(isp->volumeId));
if (!Showmode)
Log("It will be deleted on this server (you may find it elsewhere)\n");
} else {
if (!Showmode)
- Log("Volume %u needs to be salvaged. Since it is read-only, however,\n", isp->volumeId);
+ Log("Volume %" AFS_VOLID_FMT " needs to be salvaged. Since it is read-only, however,\n", afs_printable_VolumeId_lu(isp->volumeId));
if (!Showmode)
Log("it will be deleted instead. It should be recloned.\n");
}
code = VDestroyVolumeDiskHeader(salvinfo->fileSysPartition, isp->volumeId, isp->RWvolumeId);
if (code) {
- Log("Error %ld destroying volume disk header for volume %lu\n",
+ Log("Error %ld destroying volume disk header for volume %" AFS_VOLID_FMT "\n",
afs_printable_int32_ld(code),
- afs_printable_uint32_lu(isp->volumeId));
+ afs_printable_VolumeId_lu(isp->volumeId));
}
/* make sure we actually delete the header file; ENOENT
}
}
} else if (!check) {
- Log("%s salvage was unsuccessful: read-write volume %u\n", message,
- isp->volumeId);
- Abort("Salvage of volume %u aborted\n", isp->volumeId);
+ Log("%s salvage was unsuccessful: read-write volume %" AFS_VOLID_FMT "\n", message,
+ afs_printable_VolumeId_lu(isp->volumeId));
+ Abort("Salvage of volume %" AFS_VOLID_FMT " aborted\n", afs_printable_VolumeId_lu(isp->volumeId));
}
}
-#if defined(AFS_DEMAND_ATTACH_FS) || defined(AFS_DEMAND_ATTACH_UTIL)
+#ifdef AFS_DEMAND_ATTACH_FS
/**
* Locks a volume on disk for salvaging.
*
* case). But if it's there enough that we can read it, but
* somehow we cannot write to it to signify we're salvaging it,
* we've got a big problem and we cannot continue. */
- osi_Assert(IH_IWRITE(h, 0, (char*)&volHeader, sizeof(volHeader)) == sizeof(volHeader));
+ opr_Verify(IH_IWRITE(h, 0, (char*)&volHeader, sizeof(volHeader))
+ == sizeof(volHeader));
IH_RELEASE(h);
}
return 0;
}
-#endif /* AFS_DEMAND_ATTACH_FS || AFS_DEMAND_ATTACH_UTIL */
+#endif /* AFS_DEMAND_ATTACH_FS */
static void
AskError(struct SalvInfo *salvinfo, VolumeId volumeId)
Log("AskOffline: fssync protocol mismatch (bad command word '%d'); salvage aborting.\n",
FSYNC_VOL_OFF);
if (AskDAFS()) {
-#if defined(AFS_DEMAND_ATTACH_FS) || defined(AFS_DEMAND_ATTACH_UTIL)
+#ifdef AFS_DEMAND_ATTACH_FS
Log("AskOffline: please make sure dafileserver, davolserver, salvageserver and dasalvager binaries are same version.\n");
#else
Log("AskOffline: fileserver is DAFS but we are not.\n");
#endif
} else {
-#if defined(AFS_DEMAND_ATTACH_FS) || defined(AFS_DEMAND_ATTACH_UTIL)
+#ifdef AFS_DEMAND_ATTACH_FS
Log("AskOffline: fileserver is not DAFS but we are.\n");
#else
Log("AskOffline: please make sure fileserver, volserver and salvager binaries are same version.\n");
if (code == SYNC_OK) {
break;
} else if (code == SYNC_DENIED) {
- Log("AskOnline: file server denied online request to volume %u partition %s; trying again...\n", volumeId, salvinfo->fileSysPartition->name);
+ Log("AskOnline: file server denied online request to volume %" AFS_VOLID_FMT " partition %s; trying again...\n", afs_printable_VolumeId_lu(volumeId), salvinfo->fileSysPartition->name);
} else if (code == SYNC_BAD_COMMAND) {
Log("AskOnline: fssync protocol mismatch (bad command word '%d')\n",
FSYNC_VOL_ON);
if (code == SYNC_OK) {
break;
} else if (code == SYNC_DENIED) {
- Log("AskOnline: file server denied DONE request to volume %u partition %s; trying again...\n", volumeId, salvinfo->fileSysPartition->name);
+ Log("AskOnline: file server denied DONE request to volume %" AFS_VOLID_FMT " partition %s; trying again...\n", afs_printable_VolumeId_lu(volumeId), salvinfo->fileSysPartition->name);
} else if (code == SYNC_BAD_COMMAND) {
Log("AskOnline: fssync protocol mismatch (bad command word '%d')\n",
FSYNC_VOL_DONE);
if (AskDAFS()) {
-#if defined(AFS_DEMAND_ATTACH_FS) || defined(AFS_DEMAND_ATTACH_UTIL)
+#ifdef AFS_DEMAND_ATTACH_FS
Log("AskOnline: please make sure dafileserver, davolserver, salvageserver and dasalvager binaries are same version.\n");
#else
Log("AskOnline: fileserver is DAFS but we are not.\n");
#endif
} else {
-#if defined(AFS_DEMAND_ATTACH_FS) || defined(AFS_DEMAND_ATTACH_UTIL)
+#ifdef AFS_DEMAND_ATTACH_FS
Log("AskOnline: fileserver is not DAFS but we are.\n");
#else
Log("AskOnline: please make sure fileserver, volserver and salvager binaries are same version.\n");
IH_INIT(srcH, device, rwvolume, inode1);
srcFdP = IH_OPEN(srcH);
- osi_Assert(srcFdP != NULL);
+ opr_Assert(srcFdP != NULL);
IH_INIT(destH, device, rwvolume, inode2);
destFdP = IH_OPEN(destH);
while ((nBytes = FDH_PREAD(srcFdP, buf, sizeof(buf), size)) > 0) {
- osi_Assert(FDH_PWRITE(destFdP, buf, nBytes, size) == nBytes);
+ opr_Verify(FDH_PWRITE(destFdP, buf, nBytes, size) == nBytes);
size += nBytes;
}
- osi_Assert(nBytes == 0);
+ opr_Assert(nBytes == 0);
FDH_REALLYCLOSE(srcFdP);
FDH_REALLYCLOSE(destFdP);
IH_RELEASE(srcH);
afs_sfsize_t st_size;
st_size = OS_SIZE(salvinfo->inodeFd);
- osi_Assert(st_size >= 0);
+ opr_Assert(st_size >= 0);
buf = malloc(st_size);
- osi_Assert(buf != NULL);
+ opr_Assert(buf != NULL);
nInodes = st_size / sizeof(struct ViceInodeInfo);
- osi_Assert(OS_READ(salvinfo->inodeFd, buf, st_size) == st_size);
+ opr_Verify(OS_READ(salvinfo->inodeFd, buf, st_size) == st_size);
for (ip = buf; nInodes--; ip++) {
- Log("Inode:%s, linkCount=%d, size=%#llx, p=(%u,%u,%u,%u)\n",
+ Log("Inode:%s, linkCount=%d, size=%#llx, p=(%" AFS_VOLID_FMT ",%u,%u,%u)\n", /* VolumeId in param */
PrintInode(stmp, ip->inodeNumber), ip->linkCount,
- (afs_uintmax_t) ip->byteCount, ip->u.param[0], ip->u.param[1],
+ (afs_uintmax_t) ip->byteCount,
+ afs_printable_VolumeId_lu(ip->u.param[0]), ip->u.param[1],
ip->u.param[2], ip->u.param[3]);
}
free(buf);
for (i = 0; i < salvinfo->nVolumesInInodeFile; i++) {
isp = &salvinfo->inodeSummary[i];
- Log("VID:%u, RW:%u, index:%d, nInodes:%d, nSpecialInodes:%d, maxUniquifier:%u, volSummary\n", isp->volumeId, isp->RWvolumeId, isp->index, isp->nInodes, isp->nSpecialInodes, isp->maxUniquifier);
+ Log("VID:%" AFS_VOLID_FMT ", RW:%" AFS_VOLID_FMT ", index:%d, nInodes:%d, nSpecialInodes:%d, maxUniquifier:%u, volSummary\n", afs_printable_VolumeId_lu(isp->volumeId), afs_printable_VolumeId_lu(isp->RWvolumeId), isp->index, isp->nInodes, isp->nSpecialInodes, isp->maxUniquifier);
}
}
int f;
#ifdef AFS_NT40_ENV
f = 0;
- osi_Assert(0); /* Fork is never executed in the NT code path */
+ opr_Assert(0); /* Fork is never executed in the NT code path */
#else
f = fork();
- osi_Assert(f >= 0);
+ opr_Assert(f >= 0);
#ifdef AFS_DEMAND_ATTACH_FS
if ((f == 0) && (programType == salvageServer)) {
/* we are a salvageserver child */
#ifdef AFS_DEMAND_ATTACH_FS
if (programType == salvageServer) {
+ /* release all volume locks before closing down our SYNC channels.
+ * the fileserver may try to online volumes we have checked out when
+ * we close down FSSYNC, so we should make sure we don't have those
+ * volumes locked when it does */
+ struct DiskPartition64 *dp;
+ int i;
+ for (i = 0; i <= VOLMAXPARTS; i++) {
+ dp = VGetPartitionById(i, 0);
+ if (dp) {
+ VLockFileReinit(&dp->volLockFile);
+ }
+ }
# ifdef SALVSYNC_BUILD_CLIENT
VDisconnectSALV();
# endif
int status;
int pid;
pid = wait(&status);
- osi_Assert(pid != -1);
+ opr_Assert(pid != -1);
if (WCOREDUMP(status))
Log("\"%s\" core dumped!\n", prog);
if (WIFSIGNALED(status) != 0 || WEXITSTATUS(status) != 0)
strcpy(oldSlvgLog, log_path);
strcat(oldSlvgLog, ".old");
if (!logFile) {
- renamefile(log_path, oldSlvgLog);
+ rk_rename(log_path, oldSlvgLog);
logFile = afs_fopen(log_path, "a");
if (!logFile) { /* still nothing, use stdout */
{
char *p;
p = strdup(s);
- osi_Assert(p != NULL);
+ opr_Assert(p != NULL);
return p;
}