afs: Avoid -1 error for vreadUIO/vwriteUIO 38/13938/3
authorAndrew Deason <adeason@sinenomine.net>
Tue, 5 Nov 2019 02:03:43 +0000 (20:03 -0600)
committerStephan Wiesand <stephan.wiesand@desy.de>
Sun, 9 Feb 2020 23:04:06 +0000 (18:04 -0500)
Commit c6b61a45 (afs: Verify osi_UFSOpen worked) added various checks
to return an error if a given osi_UFSOpen failed. However, two of
these checks (in afs_UFSReadUIO and afs_UFSWriteUIO) result in us
returning -1 on error, in functions that otherwise return errno codes
(e.g. ENOSPC). An error code of -1 might get interpreted as
RX_CALL_DEAD, which would be rather confusing, so use EIO as a generic
error instead.

Reviewed-on: https://gerrit.openafs.org/13931
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 360b9d5d71fb1de142ae4efd4660732476855a3f)

Change-Id: I4c6773affe02cc7a3ca01cf25bea21c960d98e87
Reviewed-on: https://gerrit.openafs.org/13938
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>

src/afs/VNOPS/afs_vnop_read.c
src/afs/VNOPS/afs_vnop_write.c

index 1b1c682..8b18ab9 100644 (file)
@@ -486,7 +486,7 @@ afs_UFSReadUIO(afs_dcache_id_t *cacheId, struct uio *tuiop)
 
     tfile = (struct osi_file *) osi_UFSOpen(cacheId);
     if (!tfile)
-       return -1;
+       return EIO;
 
 #if defined(AFS_AIX41_ENV)
     AFS_GUNLOCK();
index 5372af6..1c203ce 100644 (file)
@@ -105,7 +105,7 @@ afs_UFSWriteUIO(struct vcache *avc, afs_dcache_id_t *inode, struct uio *tuiop)
 
     tfile = (struct osi_file *)osi_UFSOpen(inode);
     if (!tfile)
-       return -1;
+       return EIO;
 
 #if defined(AFS_AIX41_ENV)
     AFS_GUNLOCK();