dir: distinguish logical and physical errors on reads
commit735fa5fb090ee0efc2161597a3974f6fa45126f6
authorMark Vitale <mvitale@sinenomine.net>
Thu, 30 Jan 2020 19:04:05 +0000 (30 14:04 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 6 Nov 2020 15:06:13 +0000 (6 10:06 -0500)
treeb2b8712334d268e6c583268ac45644670d78fbb9
parent1caeeea43c038011306dd1c391680c24fc318e3d
dir: distinguish logical and physical errors on reads

The directory package (src/dir) salvage routines DirOK and DirSalvage
check a global variable 'DErrno' to distinguish logical errors (e.g.
short read) from physical errors (e.g. EIO).  However, since the
original IBM import, this logic has not worked correctly because there
is no longer any code that sets the value of DErrno - its value is
always zero.

Instead, modify all implementations of ReallyRead to optionally return
the errno for low-level IO errors.

Also, create a new userspace-only variant - DReadWithErrno() - of the
src/dir/buffer.c version of DRead (the version called by DirOK and
DirSalvage, and the only caller of ReallyRead) to return the ReallyRead
errno upon request.

Also create an analogous variant of afs_dir_GetBlobs,
afs_dir_GetBlobsWithErrno().

Finally, convert DirOK and DirSalvage to use the new variants and
replace DErrno with equivalent logic.  Remove all other references to
DErrno.

Change-Id: I3de182ce49c1682572142da594af5dc2c00ede74
Reviewed-on: https://gerrit.openafs.org/13798
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/WINNT/afsd/cm_dir.c
src/afs/afs_buffer.c
src/dir/buffer.c
src/dir/dir.c
src/dir/dir.h
src/dir/salvage.c
src/dir/test/dtest.c
src/viced/physio.c
src/vol/physio.c
src/volser/physio.c