From 142dcf54c108b0901aabbf30b87fd6343d1a9ef5 Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Sun, 3 Jun 2001 17:34:34 +0000 Subject: [PATCH 1/1] vol-volser-more-liberal-information-in-log-messages-20010602 hopefully no one is processing these logs in a way this breaks. make error and volname information available as part of error message --- src/vol/volume.c | 28 ++++++++++++++++++++++++++-- src/volser/volprocs.c | 10 +++++----- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/vol/volume.c b/src/vol/volume.c index 2032ff2..0fb985e 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -551,11 +551,15 @@ VAttachVolumeByName_r(ec, partition, name, mode) if (vp->specialStatus == VBUSY) isbusy = 1; VDetachVolume_r(ec, vp); + if ( *ec ) { + Log("VAttachVolume: Error detaching volume (%s)\n", name); + } } } if (!(partp = VGetPartition_r(partition, 0))) { *ec = VNOVOL; + Log("VAttachVolume: Error getting partition (%s)\n", partition); goto done; } @@ -567,6 +571,7 @@ VAttachVolumeByName_r(ec, partition, name, mode) if ((fd = open(path, O_RDONLY)) == -1 || fstat(fd,&status) == -1) { close(fd); VOL_LOCK + Log("VAttachVolume: Error opening/statting volume header file (%s)\n", path); *ec = VNOVOL; goto done; } @@ -630,6 +635,7 @@ VAttachVolumeByName_r(ec, partition, name, mode) #endif VUpdateVolume_r(ec,vp); if (*ec) { + Log("VAttachVolume: Error updating volume\n"); if (vp) VPutVolume_r(vp); goto done; @@ -646,6 +652,7 @@ VAttachVolumeByName_r(ec, partition, name, mode) V_dontSalvage(vp) = DONT_SALVAGE; VAddToVolumeUpdateList_r(ec,vp); if (*ec) { + Log("VAttachVolume: Error adding volume to update list\n"); if (vp) VPutVolume_r(vp); goto done; @@ -699,6 +706,10 @@ private Volume *attach2(ec, path, header, partp, isbusy) (char *)&V_disk(vp), sizeof(V_disk(vp)), VOLUMEINFOMAGIC, VOLUMEINFOVERSION); VOL_LOCK + if (*ec) { + Log("VAttachVolume: Error reading diskDataHandle vol header %s; error=%d\n", + path, *ec); + } if (!*ec) { struct IndexFileHeader iHead; @@ -718,6 +729,10 @@ private Volume *attach2(ec, path, header, partp, isbusy) (char *)&iHead, sizeof(iHead), SMALLINDEXMAGIC, SMALLINDEXVERSION); VOL_LOCK + if (*ec) { + Log("VAttachVolume: Error reading smallVnode vol header %s; error=%d\n", + path, *ec); + } } if (!*ec) { struct IndexFileHeader iHead; @@ -726,6 +741,10 @@ private Volume *attach2(ec, path, header, partp, isbusy) (char *)&iHead, sizeof(iHead), LARGEINDEXMAGIC, LARGEINDEXVERSION); VOL_LOCK + if (*ec) { + Log("VAttachVolume: Error reading largeVnode vol header %s; error=%d\n", + path, *ec); + } } #ifdef AFS_NAMEI_ENV if (!*ec) { @@ -735,11 +754,15 @@ private Volume *attach2(ec, path, header, partp, isbusy) (char *)&stamp, sizeof(stamp), LINKTABLEMAGIC, LINKTABLEVERSION); VOL_LOCK + if (*ec) { + Log("VAttachVolume: Error reading namei vol header %s; error=%d\n", + path, *ec); + } } #endif if (*ec) { - Log("VAttachVolume: Error attaching volume %s; volume needs salvage\n", - path); + Log("VAttachVolume: Error attaching volume %s; volume needs salvage; error=%d\n", + path, *ec); FreeVolume(vp); return NULL; } @@ -782,6 +805,7 @@ private Volume *attach2(ec, path, header, partp, isbusy) VOL_LOCK if (*ec) { FreeVolume(vp); + Log("VAttachVolume: error getting bitmap for volume (%s)\n", path); return NULL; } } diff --git a/src/volser/volprocs.c b/src/volser/volprocs.c index 9dee487..554b40f 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -1782,7 +1782,7 @@ volEntries *volumeInfo; pntr->status = 0; /*things are messed up */ strcpy(pntr->name,volname); pntr->volid = volid; - Log("1 Volser: ListVolumes: Could not attach volume %u\n",volid); + Log("1 Volser: ListVolumes: Could not attach volume %u (%s:%s), error=%d\n",volid,pname,volname,error); goto drop; } if(tv->header->diskstuff.destroyMe == DESTROY_ME) { @@ -1790,7 +1790,7 @@ volEntries *volumeInfo; pntr->status = 0; strcpy(pntr->name,volname); pntr->volid = volid; - Log("1 Volser: ListVolumes: Volume %u will be destroyed on next salvage\n",volid); + Log("1 Volser: ListVolumes: Volume %u (%s) will be destroyed on next salvage\n",volid,volname); goto drop; } @@ -1799,7 +1799,7 @@ volEntries *volumeInfo; pntr->status = 0; strcpy(pntr->name,volname); pntr->volid = volid; - Log("1 Volser: ListVolumes: Volume %u needs to be salvaged\n",volid); + Log("1 Volser: ListVolumes: Volume %u (%s) needs to be salvaged\n",volid,volname); goto drop; } @@ -2153,7 +2153,7 @@ volEntries *volumeInfo; pntr->status = 0; /*things are messed up */ strcpy(pntr->name,volname); pntr->volid = volid; - Log("1 Volser: ListVolumes: Could not attach volume %u\n",volid); + Log("1 Volser: ListVolumes: Could not attach volume %u (%s) error=%d\n",volid,volname,error); goto drop; } if(tv->header->diskstuff.needsSalvaged){ @@ -2161,7 +2161,7 @@ volEntries *volumeInfo; pntr->status = 0; strcpy(pntr->name,volname); pntr->volid = volid; - Log("1 Volser: ListVolumes: Volume %u needs to be salvaged\n",volid); + Log("1 Volser: ListVolumes: Volume %u (%s) needs to be salvaged\n",volid, volname); goto drop; } -- 1.9.4