From: Michael Meffie Date: Tue, 27 Mar 2012 00:20:28 +0000 (-0400) Subject: volscan: option to ignore dir vnode magic X-Git-Tag: openafs-stable-1_8_0pre1~2537 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=22fbed08a6f23dbbc05fd567e6e8e21e4d1a9709 volscan: option to ignore dir vnode magic Option to ignore directory vnode magic when looking up the path names. Print which vnode failed when doing the checks. Change-Id: Id4b74ee9f139305025b849a007a4534b8ed04dbf Reviewed-on: http://gerrit.openafs.org/6979 Reviewed-by: Derrick Brashear Tested-by: BuildBot --- diff --git a/src/vol/vol-info.c b/src/vol/vol-info.c index 83a3320..5f09467 100644 --- a/src/vol/vol-info.c +++ b/src/vol/vol-info.c @@ -71,6 +71,7 @@ typedef enum { P_OUTPUT, P_DELIM, P_NOHEADING, + P_NOMAGIC, } volinfo_parm_t; /* @@ -187,6 +188,7 @@ static char Hostname[64] = ""; /**< This hostname, for volscan output. */ static int NeedDirIndex = 0; /**< Large vnode index handle is needed for path lookups. */ static char ColumnDelim[16] = " "; /**< Column delimiter char(s) */ static char PrintHeading = 0; /**< Print column heading */ +static int CheckMagic = 1; /**< Check directory vnode magic when looking up paths */ static unsigned int ModeMask[64]; static FdHandle_t *DirIndexFd = NULL; /**< Current large vnode index handle for path lookups. */ @@ -931,6 +933,9 @@ VolScan(struct cmd_syndesc *as, void *arock) } else { PrintHeading = 1; } + if (as->parms[P_NOMAGIC].items) { + CheckMagic = 0; + } if ((ti = as->parms[P_DELIM].items)) { strncpy(ColumnDelim, ti->data, 15); ColumnDelim[15] = '\0'; @@ -1457,6 +1462,8 @@ VolScanSyntax(void) "Output field delimiter"); cmd_AddParmAtOffset(ts, P_NOHEADING, "-noheading", CMD_FLAG, CMD_OPTIONAL, "Do not print the heading line"); + cmd_AddParmAtOffset(ts, P_NOMAGIC, "-ignore-magic", CMD_FLAG, CMD_OPTIONAL, + "Skip directory vnode magic checks when looking up paths."); } /** @@ -1751,12 +1758,16 @@ GetDirVnode(Volume * vp, VnodeId parent, VnodeDiskObject * pvn) afs_printable_uint32_lu(parent), (long long unsigned)offset); return -1; } - if (pvn->vnodeMagic != LARGEVNODEMAGIC) { - fprintf(stderr, "%s: GetDirVnode: bad vnode magic\n", progname); + if (CheckMagic && (pvn->vnodeMagic != LARGEVNODEMAGIC)) { + fprintf(stderr, "%s: GetDirVnode: bad vnode magic for %lu.%lu at offset %llu\n", + progname, afs_printable_uint32_lu(V_id(vp)), + afs_printable_uint32_lu(parent), (long long unsigned)offset); return -1; } if (!pvn->dataVersion) { - fprintf(stderr, "%s: GetDirVnode: dv is zero\n", progname); + fprintf(stderr, "%s: GetDirVnode: dv is zero for %lu.%lu at offset %llu\n", + progname, afs_printable_uint32_lu(V_id(vp)), + afs_printable_uint32_lu(parent), (long long unsigned)offset); return -1; } return 0;