In afs_linux_readdir, if we detect an error code from BlobScan,
currently we 'break' out of the current while() loop. But right after
this loop, we reset 'code' to 0, ignoring the error we just got from
BlobScan, and acting like we just reached the end of the directory.
This means that if BlobScan could not process the given directory at
all, we'll just fail to iterate through some of the entries in the
given directory, and not report an error.
To fix this, process errors from BlobScan like we do for
afs_dir_GetVerifiedBlob, and return an error code and log a message
about the corrupted dir.
Reviewed-on: https://gerrit.openafs.org/13430
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit
63f015d05293cd853dbd44e5115e6b378644dfb6)
Change-Id: Ia25bcfdb70cdb1dd1a7ce0efb84ef76beb78b247
Reviewed-on: https://gerrit.openafs.org/13591
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
offset = (int) fp->f_pos;
#endif
while (1) {
+ dirpos = 0;
code = BlobScan(tdc, offset, &dirpos);
- if (code || !dirpos)
- break;
+ if (code == 0 && dirpos == 0) {
+ /* We've reached EOF of the dir blob, so we can stop looking for
+ * entries. */
+ break;
+ }
- code = afs_dir_GetVerifiedBlob(tdc, dirpos, &entry);
+ if (code == 0) {
+ code = afs_dir_GetVerifiedBlob(tdc, dirpos, &entry);
+ }
if (code) {
if (!(avc->f.states & CCorrupt)) {
struct cell *tc = afs_GetCellStale(avc->f.fid.Cell, READ_LOCK);