From: Jeffrey Hutzelman Date: Tue, 13 Sep 2011 22:37:24 +0000 (-0400) Subject: libafs/LINUX: Report FID of corrupt directories X-Git-Tag: openafs-stable-1_8_0pre1~1070 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=c636db1eca54844f0ba29cd75f4a0b8181df2162 libafs/LINUX: Report FID of corrupt directories When afs_linux_readdir detects a corrupt directory, the resulting error message is more useful if it includes the directory's FID instead of just a kernel inode pointer. Change-Id: If801e7b0325daca3da8ab115a926276e570c1d94 Reviewed-on: http://gerrit.openafs.org/9965 Reviewed-by: Derrick Brashear Tested-by: BuildBot --- diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index ce59f6e..7c7259b 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -366,8 +366,18 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) code = afs_dir_GetVerifiedBlob(tdc, dirpos, &entry); if (code) { - afs_warn("Corrupt directory (inode %lx, dirpos %d)", - (unsigned long)&tdc->f.inode, dirpos); + if (!(avc->f.states & CCorrupt)) { + struct cell *tc = afs_GetCellStale(avc->f.fid.Cell, READ_LOCK); + afs_warn("Corrupt directory (%d.%d.%d.%d [%s] @%lx, pos %d)", + avc->f.fid.Cell, avc->f.fid.Fid.Volume, + avc->f.fid.Fid.Vnode, avc->f.fid.Fid.Unique, + tc ? tc->cellName : "", + (unsigned long)&tdc->f.inode, dirpos); + if (tc) + afs_PutCell(tc, READ_LOCK); + UpgradeSToWLock(&avc->lock, 814); + avc->f.states |= CCorrupt; + } code = -ENOENT; goto unlock_out; } diff --git a/src/afs/afs.h b/src/afs/afs.h index fe433b5..31a9b2d 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -657,6 +657,7 @@ struct SimpleLocks { #endif #define CCreating 0x00400000 /* avoid needless store after open truncate */ #define CPageHog 0x00800000 /* AIX - dumping large cores is a page hog. */ +#define CCorrupt 0x01000000 /* corrupt dir already reported */ #define CDCLock 0x02000000 /* Vnode lock held over call to GetDownD */ #define CBulkFetching 0x04000000 /* stats are being fetched by bulk stat */ #define CExtendedFile 0x08000000 /* extended file via ftruncate call. */