diff --git a/src/volser/dumpstuff.c b/src/volser/dumpstuff.c index bcb2c84de2..3945d44837 100644 --- a/src/volser/dumpstuff.c +++ b/src/volser/dumpstuff.c @@ -1080,6 +1080,7 @@ DumpVnode(struct iod *iodp, struct VnodeDiskObject *v, int volid, VAclDiskSize(v)); } if (VNDISK_GET_INO(v)) { + afs_sfsize_t indexlen, disklen; IH_INIT(ihP, iodp->device, iodp->parentId, VNDISK_GET_INO(v)); fdP = IH_OPEN(ihP); if (fdP == NULL) { @@ -1087,6 +1088,17 @@ DumpVnode(struct iod *iodp, struct VnodeDiskObject *v, int volid, IH_RELEASE(ihP); return VOLSERREAD_DUMPERROR; } + VNDISK_GET_LEN(indexlen, v); + disklen = FDH_SIZE(fdP); + if (indexlen != disklen) { + FDH_REALLYCLOSE(fdP); + IH_RELEASE(ihP); + Log("DumpVnode: volume %lu vnode %lu has inconsistent length " + "(index %lu disk %lu); aborting dump\n", + (unsigned long)volid, (unsigned long)vnodeNumber, + (unsigned long)indexlen, (unsigned long)disklen); + return VOLSERREAD_DUMPERROR; + } code = DumpFile(iodp, vnodeNumber, fdP); FDH_CLOSE(fdP); IH_RELEASE(ihP);