bypasscache: do errors correctly

do set errors when we bomb out early
do not unlock and return early when we happen to do a correct zero
length read
do set errors the kernel can deal with if we're feeding a page routine

Change-Id: I1dca1f9e3b0f3d24da3e4f55b473775a737370b4
Reviewed-on: http://gerrit.openafs.org/5554
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
Derrick Brashear 2011-10-06 04:04:36 -04:00
parent 6f59c71988
commit 28a159b2bf

View File

@ -379,7 +379,7 @@ afs_NoCacheFetchProc(struct rx_call *acall,
code = rx_Read(acall, (char *)&length, sizeof(afs_int32));
COND_RE_GLOCK(locked);
if (code != sizeof(afs_int32)) {
result = 0;
result = EIO;
afs_warn("Preread error. code: %d instead of %d\n",
code, (int)sizeof(afs_int32));
unlock_and_release_pages(auio);
@ -429,15 +429,17 @@ afs_NoCacheFetchProc(struct rx_call *acall,
COND_RE_GLOCK(locked);
if (bytes < 0) {
afs_warn("afs_NoCacheFetchProc: rx_Read error. Return code was %d\n", bytes);
result = 0;
result = bytes;
unlock_and_release_pages(auio);
goto done;
} else if (bytes == 0) {
result = 0;
/* we failed to read the full length */
result = EIO;
afs_warn("afs_NoCacheFetchProc: rx_Read returned zero. Aborting.\n");
unlock_and_release_pages(auio);
goto done;
}
size -= bytes;
length -= bytes;
iovno = 0;
}
@ -654,6 +656,7 @@ done:
* Copy appropriate fields into vcache
*/
if (!code)
afs_ProcessFS(avc, &tcallspec->OutStatus, areq);
osi_Free(areq, sizeof(struct vrequest));