From: Andrew Deason Date: Tue, 5 Nov 2019 02:03:43 +0000 (-0600) Subject: afs: Avoid -1 error for vreadUIO/vwriteUIO X-Git-Tag: upstream/1.8.6_pre1^2~14 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=b8cb5e995119656774844531b7400b8430aa6595;p=packages%2Fo%2Fopenafs.git afs: Avoid -1 error for vreadUIO/vwriteUIO 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 Reviewed-by: Mark Vitale Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk (cherry picked from commit 360b9d5d71fb1de142ae4efd4660732476855a3f) Change-Id: I4c6773affe02cc7a3ca01cf25bea21c960d98e87 Reviewed-on: https://gerrit.openafs.org/13938 Reviewed-by: Michael Meffie Reviewed-by: Cheyenne Wills Reviewed-by: Mark Vitale Reviewed-by: Marcio Brito Barbosa Tested-by: BuildBot Reviewed-by: Stephan Wiesand --- diff --git a/src/afs/VNOPS/afs_vnop_read.c b/src/afs/VNOPS/afs_vnop_read.c index 1b1c682f5..8b18ab9be 100644 --- a/src/afs/VNOPS/afs_vnop_read.c +++ b/src/afs/VNOPS/afs_vnop_read.c @@ -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(); diff --git a/src/afs/VNOPS/afs_vnop_write.c b/src/afs/VNOPS/afs_vnop_write.c index 5372af664..1c203cecb 100644 --- a/src/afs/VNOPS/afs_vnop_write.c +++ b/src/afs/VNOPS/afs_vnop_write.c @@ -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();