From 123c79c2b9a7b1b761df2b67900fe64adb54e091 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Mon, 12 Jul 2010 15:47:15 -0500 Subject: [PATCH] Avoid thread-unsafe PrintInode in threaded code Some potentially-threaded callers were calling PrintInode with a NULL first argument, which is not threadsafe. Alter them to use local storage. (cherry picked from commit 38cf31463e3f3c675de727c1e793e117a90e6d20) Reviewed-on: http://gerrit.openafs.org/2593 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear Change-Id: I4b6e0f8c41180c017739dbfdb4f2ecbce96df8ec Reviewed-on: http://gerrit.openafs.org/3886 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/viced/afsfileprocs.c | 16 ++++++++++------ src/viced/physio.c | 10 ++++++---- src/vol/clone.c | 5 +++-- src/vol/listinodes.c | 14 ++++++++------ src/vol/vnode.c | 8 +++++--- src/vol/vol-salvage.c | 24 ++++++++++++++---------- src/vol/vutil.c | 9 +++++---- src/volser/dumpstuff.c | 5 +++-- src/volser/vol-dump.c | 10 ++++++---- 9 files changed, 60 insertions(+), 41 deletions(-) diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 4d8d0c1cc..5b49535a0 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -1319,6 +1319,7 @@ DeleteTarget(Vnode * parentptr, Volume * volptr, Vnode ** targetptr, DirHandle childdir; /* Handle for dir package I/O */ Error errorCode = 0; int code; + afs_ino_str_t stmp; /* watch for invalid names */ if (!strcmp(Name, ".") || !strcmp(Name, "..")) @@ -1387,7 +1388,7 @@ DeleteTarget(Vnode * parentptr, Volume * volptr, Vnode ** targetptr, if (errorCode == -1) { ViceLog(0, ("DT: inode=%s, name=%s, errno=%d\n", - PrintInode(NULL, VN_GET_INO(*targetptr)), Name, + PrintInode(stmp, VN_GET_INO(*targetptr)), Name, errno)); if (errno != ENOENT) { @@ -1723,6 +1724,7 @@ Alloc_NewVnode(Vnode * parentptr, DirHandle * dir, Volume * volptr, Error temp; Inode inode = 0; Inode nearInode; /* hint for inode allocation in solaris */ + afs_ino_str_t stmp; if ((errorCode = AdjustDiskUsage(volptr, BlocksPreallocatedForVnode, @@ -1778,7 +1780,7 @@ Alloc_NewVnode(Vnode * parentptr, DirHandle * dir, Volume * volptr, if (IH_DEC(V_linkHandle(volptr), inode, V_parentId(volptr))) ViceLog(0, ("Alloc_NewVnode: partition %s idec %s failed\n", - volptr->partition->name, PrintInode(NULL, inode))); + volptr->partition->name, PrintInode(stmp, inode))); IH_RELEASE((*targetptr)->handle); return errorCode; @@ -1794,7 +1796,7 @@ Alloc_NewVnode(Vnode * parentptr, DirHandle * dir, Volume * volptr, if (IH_DEC(V_linkHandle(volptr), inode, V_parentId(volptr))) ViceLog(0, ("Alloc_NewVnode: partition %s idec %s failed\n", - volptr->partition->name, PrintInode(NULL, inode))); + volptr->partition->name, PrintInode(stmp, inode))); IH_RELEASE((*targetptr)->handle); return (errorCode); } @@ -3860,6 +3862,7 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName, struct client *t_client; /* tmp ptr to client data */ struct in_addr logHostAddr; /* host ip holder for inet_ntoa */ struct rx_connection *tcon = rx_ConnectionOf(acall); + afs_ino_str_t stmp; FidZero(&olddir); FidZero(&newdir); @@ -4148,7 +4151,7 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName, if (errorCode == -1) { ViceLog(0, ("Del: inode=%s, name=%s, errno=%d\n", - PrintInode(NULL, VN_GET_INO(newfileptr)), + PrintInode(stmp, VN_GET_INO(newfileptr)), NewName, errno)); if ((errno != ENOENT) && (errno != EIO) && (errno != ENXIO)) @@ -7264,6 +7267,7 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid, ssize_t nBytes; FdHandle_t *fdP, *origfdP = NULL; struct in_addr logHostAddr; /* host ip holder for inet_ntoa */ + afs_ino_str_t stmp; #if FS_STATS_DETAILED /* @@ -7296,7 +7300,7 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid, */ ViceLog(25, ("StoreData_RXStyle : Opening inode %s\n", - PrintInode(NULL, VN_GET_INO(targetptr)))); + PrintInode(stmp, VN_GET_INO(targetptr)))); fdP = IH_OPEN(targetptr->handle); if (fdP == NULL) return ENOENT; @@ -7312,7 +7316,7 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid, afs_fsize_t size; ViceLog(25, ("StoreData_RXStyle : inode %s has more than onelink\n", - PrintInode(NULL, VN_GET_INO(targetptr)))); + PrintInode(stmp, VN_GET_INO(targetptr)))); /* other volumes share this data, better copy it first */ /* Adjust the disk block count by the creation of the new inode. diff --git a/src/viced/physio.c b/src/viced/physio.c index 3d23cbdc1..b56465d51 100644 --- a/src/viced/physio.c +++ b/src/viced/physio.c @@ -52,13 +52,14 @@ ReallyRead(DirHandle * file, int block, char *data) int code; ssize_t rdlen; FdHandle_t *fdP; + afs_ino_str_t stmp; fdP = IH_OPEN(file->dirh_handle); if (fdP == NULL) { code = errno; ViceLog(0, ("ReallyRead(): open failed device %X inode %s errno %d\n", - file->dirh_handle->ih_dev, PrintInode(NULL, + file->dirh_handle->ih_dev, PrintInode(stmp, file->dirh_handle-> ih_ino), code)); return code; @@ -71,7 +72,7 @@ ReallyRead(DirHandle * file, int block, char *data) code = EIO; ViceLog(0, ("ReallyRead(): read failed device %X inode %s errno %d\n", - file->dirh_handle->ih_dev, PrintInode(NULL, + file->dirh_handle->ih_dev, PrintInode(stmp, file->dirh_handle-> ih_ino), code)); FDH_REALLYCLOSE(fdP); @@ -88,12 +89,13 @@ ReallyWrite(DirHandle * file, int block, char *data) { ssize_t count; FdHandle_t *fdP; + afs_ino_str_t stmp; fdP = IH_OPEN(file->dirh_handle); if (fdP == NULL) { ViceLog(0, ("ReallyWrite(): open failed device %X inode %s errno %d\n", - file->dirh_handle->ih_dev, PrintInode(NULL, + file->dirh_handle->ih_dev, PrintInode(stmp, file->dirh_handle-> ih_ino), errno)); lpErrno = errno; @@ -102,7 +104,7 @@ ReallyWrite(DirHandle * file, int block, char *data) if ((count = FDH_PWRITE(fdP, data, PAGESIZE, ((afs_foff_t)block) * PAGESIZE)) != PAGESIZE) { ViceLog(0, ("ReallyWrite(): write failed device %X inode %s errno %d\n", - file->dirh_handle->ih_dev, PrintInode(NULL, + file->dirh_handle->ih_dev, PrintInode(stmp, file->dirh_handle-> ih_ino), errno)); lpCount = count; diff --git a/src/vol/clone.c b/src/vol/clone.c index b856cdb9d..945253a60 100644 --- a/src/vol/clone.c +++ b/src/vol/clone.c @@ -170,6 +170,7 @@ DoCloneIndex(Volume * rwvp, Volume * clvp, VnodeClass class, int reclone) afs_foff_t offset = 0; afs_int32 dircloned, inodeinced; afs_int32 filecount = 0, diskused = 0; + afs_ino_str_t stmp; struct VnodeClassInfo *vcp = &VnodeClassInfo[class]; int ReadWriteOriginal = VolumeWriteable(rwvp); @@ -256,7 +257,7 @@ DoCloneIndex(Volume * rwvp, Volume * clvp, VnodeClass class, int reclone) if (IH_INC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) == -1) { Log("IH_INC failed: %"AFS_PTR_FMT", %s, %u errno %d\n", - V_linkHandle(rwvp), PrintInode(NULL, rwinode), + V_linkHandle(rwvp), PrintInode(stmp, rwinode), V_parentId(rwvp), errno); VForceOffline(rwvp); ERROR_EXIT(EIO); @@ -309,7 +310,7 @@ DoCloneIndex(Volume * rwvp, Volume * clvp, VnodeClass class, int reclone) if (IH_DEC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) == -1) { Log("IH_DEC failed: %"AFS_PTR_FMT", %s, %u errno %d\n", - V_linkHandle(rwvp), PrintInode(NULL, rwinode), + V_linkHandle(rwvp), PrintInode(stmp, rwinode), V_parentId(rwvp), errno); VForceOffline(rwvp); ERROR_EXIT(EIO); diff --git a/src/vol/listinodes.c b/src/vol/listinodes.c index f266f45da..beed24553 100644 --- a/src/vol/listinodes.c +++ b/src/vol/listinodes.c @@ -488,6 +488,7 @@ xfs_VerifyInode(char *dir, uint64_t pino, char *name, i_list_inode_t * info, char tmpName[32]; b64_string_t stmp; int tag; + afs_ino_str_t stmp; *rename = 0; (void)sprintf(path, "%s/%s", dir, name); @@ -495,7 +496,7 @@ xfs_VerifyInode(char *dir, uint64_t pino, char *name, i_list_inode_t * info, if (info->ili_magic != XFS_VICEMAGIC) { Log("%s magic for %s/%s (inode %s) from %d to %d\n", Testing ? "Would have changed" : "Changing", dir, name, - PrintInode(NULL, info->ili_info.inodeNumber), info->ili_magic, + PrintInode(stmp, info->ili_info.inodeNumber), info->ili_magic, XFS_VICEMAGIC); if (!Testing) update_chown = 1; @@ -505,7 +506,7 @@ xfs_VerifyInode(char *dir, uint64_t pino, char *name, i_list_inode_t * info, if (info->ili_vno != AFS_XFS_VNO_CLIP(vno)) { Log("%s volume id for %s/%s (inode %s) from %d to %d\n", Testing ? "Would have changed" : "Changing", dir, name, - PrintInode(NULL, info->ili_info.inodeNumber), info->ili_vno, + PrintInode(stmp, info->ili_info.inodeNumber), info->ili_vno, AFS_XFS_VNO_CLIP(vno)); if (!Testing) update_chown = 1; @@ -538,7 +539,7 @@ xfs_VerifyInode(char *dir, uint64_t pino, char *name, i_list_inode_t * info, if (strncmp(name, tmpName, strlen(tmpName))) { Log("%s name %s (inode %s) in directory %s, unique=%d, tag=%d\n", Testing ? "Would have returned bad" : "Bad", name, - PrintInode(NULL, info->ili_info.inodeNumber), dir, + PrintInode(stmp, info->ili_info.inodeNumber), dir, info->ili_info.param[2], info->ili_tag); if (!Testing) *rename = 1; @@ -554,7 +555,7 @@ xfs_VerifyInode(char *dir, uint64_t pino, char *name, i_list_inode_t * info, p = strchr(tmpName + 1, '.'); if (!p) { Log("No tag found on name %s (inode %s)in directory, %s.\n", - name, PrintInode(NULL, info->ili_info.inodeNumber), dir, + name, PrintInode(stmp, info->ili_info.inodeNumber), dir, Testing ? "would have renamed" : "will rename"); if (!Testing) *rename = 1; @@ -562,7 +563,7 @@ xfs_VerifyInode(char *dir, uint64_t pino, char *name, i_list_inode_t * info, tag = base64_to_int(p + 1); Log("%s the tag for %s (inode %s) from %d to %d.\n", Testing ? "Would have changed" : "Will change", path, - PrintInode(NULL, info->ili_info.inodeNumber), dir, tag, + PrintInode(stmp, info->ili_info.inodeNumber), dir, tag, info->ili_tag); if (!Testing) update_tag = 1; @@ -1500,8 +1501,9 @@ inode_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId) /* Unlink the old special inode; otherwise we will get duplicate * special inodes if we recreate the RO again */ if (IH_DEC(ih, specinos[j].inodeNumber, volumeId) == -1) { + afs_ino_str_t stmp; Log("IH_DEC failed: %x, %s, %u errno %d\n", ih, - PrintInode(NULL, specinos[j].inodeNumber), volumeId, errno); + PrintInode(stmp, specinos[j].inodeNumber), volumeId, errno); } IH_RELEASE(ih); diff --git a/src/vol/vnode.c b/src/vol/vnode.c index 463afc562..a111cc7a6 100644 --- a/src/vol/vnode.c +++ b/src/vol/vnode.c @@ -874,6 +874,7 @@ VnLoad(Error * ec, Volume * vp, Vnode * vnp, ssize_t nBytes; IHandle_t *ihP = vp->vnodeIndex[class].handle; FdHandle_t *fdP; + afs_ino_str_t stmp; *ec = 0; vcp->reads++; @@ -889,7 +890,7 @@ VnLoad(Error * ec, Volume * vp, Vnode * vnp, fdP = IH_OPEN(ihP); if (fdP == NULL) { Log("VnLoad: can't open index dev=%u, i=%s\n", vp->device, - PrintInode(NULL, vp->vnodeIndex[class].handle->ih_ino)); + PrintInode(stmp, vp->vnodeIndex[class].handle->ih_ino)); *ec = VIO; goto error_encountered_nolock; } else if ((nBytes = FDH_PREAD(fdP, (char *)&vnp->disk, vcp->diskSize, vnodeIndexOffset(vcp, Vn_id(vnp)))) @@ -898,7 +899,7 @@ VnLoad(Error * ec, Volume * vp, Vnode * vnp, * or the inode table is full. */ if (nBytes == BAD_IGET) { Log("VnLoad: bad inumber %s\n", - PrintInode(NULL, vp->vnodeIndex[class].handle->ih_ino)); + PrintInode(stmp, vp->vnodeIndex[class].handle->ih_ino)); *ec = VIO; dosalv = 0; } else if (nBytes == -1 && errno == EIO) { @@ -996,6 +997,7 @@ VnStore(Error * ec, Volume * vp, Vnode * vnp, afs_foff_t offset; IHandle_t *ihP = vp->vnodeIndex[class].handle; FdHandle_t *fdP; + afs_ino_str_t stmp; #ifdef AFS_DEMAND_ATTACH_FS VnState vn_state_save; #endif @@ -1021,7 +1023,7 @@ VnStore(Error * ec, Volume * vp, Vnode * vnp, FDH_REALLYCLOSE(fdP); if (nBytes == BAD_IGET) { Log("VnStore: bad inumber %s\n", - PrintInode(NULL, + PrintInode(stmp, vp->vnodeIndex[class].handle->ih_ino)); *ec = VIO; VOL_LOCK; diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index dce10e019..801009423 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -1950,6 +1950,7 @@ DoSalvageVolumeGroup(struct InodeSummary *isp, int nVols) /* Fix actual inode counts */ if (!Showmode) { + afs_ino_str_t stmp; Log("totalInodes %d\n",totalInodes); for (ip = inodes; totalInodes; ip++, totalInodes--) { static int TraceBadLinkCounts = 0; @@ -1962,14 +1963,14 @@ DoSalvageVolumeGroup(struct InodeSummary *isp, int nVols) #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(NULL, 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]); } while (ip->linkCount > 0) { /* below used to assert, not break */ if (!Testing) { if (IH_DEC(VGLinkH, ip->inodeNumber, ip->u.param[0])) { Log("idec failed. inode %s errno %d\n", - PrintInode(NULL, ip->inodeNumber), errno); + PrintInode(stmp, ip->inodeNumber), errno); break; } } @@ -1980,7 +1981,7 @@ DoSalvageVolumeGroup(struct InodeSummary *isp, int nVols) if (!Testing) { if (IH_INC(VGLinkH, ip->inodeNumber, ip->u.param[0])) { Log("iinc failed. inode %s errno %d\n", - PrintInode(NULL, ip->inodeNumber), errno); + PrintInode(stmp, ip->inodeNumber), errno); break; } } @@ -2176,11 +2177,12 @@ SalvageVolumeHeaderFile(struct InodeSummary *isp, } } for (i = 0; i < isp->nSpecialInodes; i++) { + afs_ino_str_t stmp; ip = &inodes[isp->index + i]; if (ip->u.special.type <= 0 || ip->u.special.type > MAXINODETYPE) { if (check) { Log("Rubbish header inode %s of type %d\n", - PrintInode(NULL, ip->inodeNumber), + PrintInode(stmp, ip->inodeNumber), ip->u.special.type); if (skip) { free(skip); @@ -2188,17 +2190,17 @@ SalvageVolumeHeaderFile(struct InodeSummary *isp, return -1; } Log("Rubbish header inode %s of type %d; deleted\n", - PrintInode(NULL, ip->inodeNumber), + PrintInode(stmp, ip->inodeNumber), ip->u.special.type); } else if (!stuff[ip->u.special.type - 1].obsolete) { if (skip && skip[i]) { if (orphans == ORPH_REMOVE) { Log("Removing orphan special inode %s of type %d\n", - PrintInode(NULL, ip->inodeNumber), ip->u.special.type); + PrintInode(stmp, ip->inodeNumber), ip->u.special.type); continue; } else { Log("Ignoring orphan special inode %s of type %d\n", - PrintInode(NULL, ip->inodeNumber), ip->u.special.type); + PrintInode(stmp, ip->inodeNumber), ip->u.special.type); /* fall through to the ip->linkCount--; line below */ } } else { @@ -2699,13 +2701,14 @@ SalvageIndex(Inode ino, VnodeClass class, int RW, ip++; nInodes--; } else { /* no matching inode */ + afs_ino_str_t stmp; if (VNDISK_GET_INO(vnode) != 0 || vnode->type == vDirectory) { /* No matching inode--get rid of the vnode */ if (check) { if (VNDISK_GET_INO(vnode)) { if (!Showmode) { - Log("Vnode %d (unique %u): corresponding inode %s is missing\n", vnodeNumber, vnode->uniquifier, PrintInode(NULL, VNDISK_GET_INO(vnode))); + Log("Vnode %d (unique %u): corresponding inode %s is missing\n", vnodeNumber, vnode->uniquifier, PrintInode(stmp, VNDISK_GET_INO(vnode))); } } else { if (!Showmode) @@ -2717,7 +2720,7 @@ SalvageIndex(Inode ino, VnodeClass class, int RW, if (VNDISK_GET_INO(vnode)) { if (!Showmode) { time_t serverModifyTime = vnode->serverModifyTime; - Log("Vnode %d (unique %u): corresponding inode %s is missing; vnode deleted, vnode mod time=%s", vnodeNumber, vnode->uniquifier, PrintInode(NULL, VNDISK_GET_INO(vnode)), ctime(&serverModifyTime)); + Log("Vnode %d (unique %u): corresponding inode %s is missing; vnode deleted, vnode mod time=%s", vnodeNumber, vnode->uniquifier, PrintInode(stmp, VNDISK_GET_INO(vnode)), ctime(&serverModifyTime)); } } else { if (!Showmode) { @@ -4339,6 +4342,7 @@ PrintInodeList(void) struct ViceInodeInfo *buf; struct afs_stat status; int nInodes; + afs_ino_str_t stmp; osi_Assert(afs_fstat(inodeFd, &status) == 0); buf = (struct ViceInodeInfo *)malloc(status.st_size); @@ -4347,7 +4351,7 @@ PrintInodeList(void) osi_Assert(read(inodeFd, buf, status.st_size) == status.st_size); for (ip = buf; nInodes--; ip++) { Log("Inode:%s, linkCount=%d, size=%#llx, p=(%u,%u,%u,%u)\n", - PrintInode(NULL, ip->inodeNumber), ip->linkCount, + PrintInode(stmp, ip->inodeNumber), ip->linkCount, (afs_uintmax_t) ip->byteCount, ip->u.param[0], ip->u.param[1], ip->u.param[2], ip->u.param[3]); } diff --git a/src/vol/vutil.c b/src/vol/vutil.c index 555f7ea13..261fd12cd 100644 --- a/src/vol/vutil.c +++ b/src/vol/vutil.c @@ -122,6 +122,7 @@ VCreateVolume_r(Error * ec, char *partname, VolId volumeId, VolId parentId) Inode nearInode = 0; char *part, *name; struct stat st; + afs_ino_str_t stmp; # ifdef AFS_DEMAND_ATTACH_FS int locktype = 0; # endif /* AFS_DEMAND_ATTACH_FS */ @@ -260,13 +261,13 @@ VCreateVolume_r(Error * ec, char *partname, VolId volumeId, VolId parentId) fdP = IH_OPEN(handle); if (fdP == NULL) { Log("VCreateVolume: Problem iopen inode %s (err=%d)\n", - PrintInode(NULL, *(p->inode)), errno); + PrintInode(stmp, *(p->inode)), errno); goto bad; } if (FDH_PWRITE(fdP, (char *)&p->stamp, sizeof(p->stamp), 0) != sizeof(p->stamp)) { Log("VCreateVolume: Problem writing to inode %s (err=%d)\n", - PrintInode(NULL, *(p->inode)), errno); + PrintInode(stmp, *(p->inode)), errno); FDH_REALLYCLOSE(fdP); goto bad; } @@ -279,12 +280,12 @@ VCreateVolume_r(Error * ec, char *partname, VolId volumeId, VolId parentId) fdP = IH_OPEN(handle); if (fdP == NULL) { Log("VCreateVolume: Problem iopen inode %s (err=%d)\n", - PrintInode(NULL, tempHeader.volumeInfo), errno); + PrintInode(stmp, tempHeader.volumeInfo), errno); goto bad; } if (FDH_PWRITE(fdP, (char *)&vol, sizeof(vol), 0) != sizeof(vol)) { Log("VCreateVolume: Problem writing to inode %s (err=%d)\n", - PrintInode(NULL, tempHeader.volumeInfo), errno); + PrintInode(stmp, tempHeader.volumeInfo), errno); FDH_REALLYCLOSE(fdP); goto bad; } diff --git a/src/volser/dumpstuff.c b/src/volser/dumpstuff.c index 8008f81a5..cd2294c75 100644 --- a/src/volser/dumpstuff.c +++ b/src/volser/dumpstuff.c @@ -712,6 +712,7 @@ DumpFile(struct iod *iodp, int vnode, FdHandle_t * handleP) afs_foff_t howFar = 0; byte *p; afs_uint32 hi, lo; + afs_ino_str_t stmp; #ifndef AFS_NT40_ENV struct afs_stat status; #endif @@ -795,9 +796,9 @@ DumpFile(struct iod *iodp, int vnode, FdHandle_t * handleP) /* Record the read error */ if (n < 0) { n = 0; - Log("1 Volser: DumpFile: Error reading inode %s for vnode %d: %s\n", PrintInode(NULL, handleP->fd_ih->ih_ino), vnode, afs_error_message(errno)); + Log("1 Volser: DumpFile: Error reading inode %s for vnode %d: %s\n", PrintInode(stmp, handleP->fd_ih->ih_ino), vnode, afs_error_message(errno)); } else if (!pad) { - Log("1 Volser: DumpFile: Error reading inode %s for vnode %d\n", PrintInode(NULL, handleP->fd_ih->ih_ino), vnode); + Log("1 Volser: DumpFile: Error reading inode %s for vnode %d\n", PrintInode(stmp, handleP->fd_ih->ih_ino), vnode); } /* Pad the rest of the buffer with zeros. Remember offset we started diff --git a/src/volser/vol-dump.c b/src/volser/vol-dump.c index 78b25efff..912f0b417 100644 --- a/src/volser/vol-dump.c +++ b/src/volser/vol-dump.c @@ -566,6 +566,7 @@ DumpFile(int dumpfd, int vnode, FdHandle_t * handleP, struct VnodeDiskObject *v afs_foff_t howFar = 0; byte *p; afs_uint32 hi, lo; + afs_ino_str_t stmp; #ifndef AFS_NT40_ENV struct afs_stat status; #endif @@ -652,11 +653,11 @@ DumpFile(int dumpfd, int vnode, FdHandle_t * handleP, struct VnodeDiskObject *v if (n < 0) { n = 0; fprintf(stderr, "Error %d reading inode %s for vnode %d\n", - errno, PrintInode(NULL, handleP->fd_ih->ih_ino), + errno, PrintInode(stmp, handleP->fd_ih->ih_ino), vnode); } else if (!pad) { fprintf(stderr, "Error reading inode %s for vnode %d\n", - PrintInode(NULL, handleP->fd_ih->ih_ino), vnode); + PrintInode(stmp, handleP->fd_ih->ih_ino), vnode); } /* Pad the rest of the buffer with zeros. Remember offset we started @@ -695,6 +696,7 @@ DumpVnode(int dumpfd, struct VnodeDiskObject *v, int volid, int vnodeNumber, int code = 0; IHandle_t *ihP; FdHandle_t *fdP; + afs_ino_str_t stmp; if (verbose) fprintf(stderr, "dumping vnode %d\n", vnodeNumber); @@ -739,14 +741,14 @@ DumpVnode(int dumpfd, struct VnodeDiskObject *v, int volid, int vnodeNumber, if (fdP == NULL) { fprintf(stderr, "Unable to open inode %s for vnode %u (volume %i); not dumped, error %d\n", - PrintInode(NULL, VNDISK_GET_INO(v)), vnodeNumber, volid, + PrintInode(stmp, VNDISK_GET_INO(v)), vnodeNumber, volid, errno); } else { if (verbose) fprintf(stderr, "about to dump inode %s for vnode %u\n", - PrintInode(NULL, VNDISK_GET_INO(v)), vnodeNumber); + PrintInode(stmp, VNDISK_GET_INO(v)), vnodeNumber); code = DumpFile(dumpfd, vnodeNumber, fdP, v); FDH_CLOSE(fdP); } -- 2.39.5