diff --git a/src/afs/SOLARIS/osi_vnodeops.c b/src/afs/SOLARIS/osi_vnodeops.c index 00e74a874b..bff4a77ffa 100644 --- a/src/afs/SOLARIS/osi_vnodeops.c +++ b/src/afs/SOLARIS/osi_vnodeops.c @@ -81,6 +81,25 @@ AFS_TRYUP(lock) #endif +/* Translate a faultcode_t as returned by some of the vm routines + * into a suitable errno value. + */ +static int +afs_fc2errno(faultcode_t fc) +{ + switch (FC_CODE(fc)) { + case 0: + return 0; + + case FC_OBJERR: + return FC_ERRNO(fc); + + default: + return EIO; + } +} + + extern struct as kas; /* kernel addr space */ extern unsigned char *afs_indexFlags; extern afs_lock_t afs_xdcache; @@ -1151,7 +1170,8 @@ struct AFS_UCRED *acred; data = segmap_getmap(segkmap, AFSTOV(avc), pageBase); #endif #ifndef AFS_SUN5_ENV - code = as_fault(&kas, data+pageOffset, tsize, F_SOFTLOCK, mode); + code = afs_fc2errno(as_fault(&kas, data+pageOffset, tsize, + F_SOFTLOCK, mode)); if (code == 0) { AFS_UIOMOVE(data+pageOffset, tsize, arw, auio, code); as_fault(&kas, data+pageOffset, tsize, F_SOFTUNLOCK, mode); @@ -1213,7 +1233,8 @@ struct AFS_UCRED *acred; AFS_GUNLOCK(); } if (!created) - code = segmap_fault(kas.a_hat, segkmap, raddr, rsize, F_SOFTLOCK, mode); + code = afs_fc2errno(segmap_fault(kas.a_hat, segkmap, raddr, + rsize, F_SOFTLOCK, mode)); } if (code == 0) { AFS_UIOMOVE(data+pageOffset, tsize, arw, auio, code);