From 2aa4cb047596b654a175f5a22197c2923002a271 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Fri, 13 Feb 2015 18:08:25 -0600 Subject: [PATCH] afs: Stop abusing ENOENT When looking up a file, the ENOENT error code is supposed to be used if we know that the target filename does not exist. That is, the situation is a user or application error; they specified a filename that was not previously created. Currently, though, we use ENOENT for a variety of different situations, such as: - After successfully looking up a directory entry, we fail to afs_GetDCache or afs_GetVCache on the FID for that entry. - We encounter an invalid mount point, in certain code paths. In each of these situations, an ENOENT error code is incorrect, since the target filename does indeed exist and these situations may be caused by network or administrative errors. An ENOENT error implies that the user may be able to then create the target filename, which is not true most of the time in the above situations. In addition, on LINUX we return a negative dcache entry when we encounter an ENOENT error on lookup. This means that if any of the above scenarios occur, Linux would cache the fact that that directory entry did not exist, and return ENOENT for future lookups. This was worked around in one of the changes in commit 652f3bd9cb7a5d7833a760ba50ef7c2c67214bba to always invalidate such negative dentries, but at the cost of performance (since this caused negative lookups to never be cached). To avoid all of these issues, just don't use ENOENT in these situations. For simple non-disconnected afs_GetDCache or afs_GetVCache errors, return EIO, since we have encountered an error that is internal to AFS (either the underlying data is inconsistent, or we have a network error, or something else). In disconnected operation, return ENETDOWN like in other disconnected code paths, since often the root cause is due to us not having network access. When a bad mountpoint is encountered, return ENODEV, since that is what we use elsewhere in the code when encountering a bad mountpoint. It is also noteworthy that this changes removes the translation of VNOVNODE into ENOENT, since a nonexistent vnode is not the same as a nonexistent filename, as described above. Some code paths have special behavior for this situation (ignoring the error in some cases where it does not matter). These code paths should be okay with this change, since all of them examine error codes that have not been translated through afs_CheckCode. Some useless references to ENOENT were also removed in src/afs/LINUX*/osi_misc.c. These did not result in incorrect behavior, but removing them makes searching for bad ENOENT references easier. Change-Id: Ib01e4309e44b532f843d53c8de2eae613e397bf6 Reviewed-on: http://gerrit.openafs.org/11788 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- src/afs/AIX/osi_vfsops.c | 2 +- src/afs/DARWIN/osi_vfsops.c | 2 +- src/afs/FBSD/osi_vfsops.c | 2 +- src/afs/HPUX/osi_vfsops.c | 2 +- src/afs/IRIX/osi_vfsops.c | 6 +++--- src/afs/IRIX/osi_vnodeops.c | 2 +- src/afs/LINUX/osi_misc.c | 3 --- src/afs/LINUX/osi_vfsops.c | 2 +- src/afs/LINUX/osi_vnodeops.c | 4 ++-- src/afs/NBSD/osi_vfsops.c | 2 +- src/afs/OBSD/osi_vfsops.c | 2 +- src/afs/SOLARIS/osi_vfsops.c | 2 +- src/afs/SOLARIS/osi_vnodeops.c | 2 +- src/afs/UKERNEL/osi_vfsops.c | 2 +- src/afs/VNOPS/afs_vnop_create.c | 15 +++++++++++---- src/afs/VNOPS/afs_vnop_dirops.c | 12 ++++++++---- src/afs/VNOPS/afs_vnop_lookup.c | 18 +++++++++--------- src/afs/VNOPS/afs_vnop_readdir.c | 2 +- src/afs/VNOPS/afs_vnop_remove.c | 2 +- src/afs/VNOPS/afs_vnop_rename.c | 8 ++++---- src/afs/VNOPS/afs_vnop_symlink.c | 4 ++-- src/afs/VNOPS/afs_vnop_write.c | 4 ++-- src/afs/afs_disconnected.c | 12 ++++++------ src/afs/afs_error.c | 2 +- src/afs/afs_pioctl.c | 12 ++++++------ src/afs/afs_vcache.c | 2 +- 26 files changed, 68 insertions(+), 60 deletions(-) diff --git a/src/afs/AIX/osi_vfsops.c b/src/afs/AIX/osi_vfsops.c index 32fbbf5..5265944 100644 --- a/src/afs/AIX/osi_vfsops.c +++ b/src/afs/AIX/osi_vfsops.c @@ -130,7 +130,7 @@ afs_root_nolock(struct vfs *afsp, struct vnode **avpp) if (tvp) { afs_globalVp = tvp; } else - code = ENOENT; + code = EIO; } crfree(credp); } diff --git a/src/afs/DARWIN/osi_vfsops.c b/src/afs/DARWIN/osi_vfsops.c index 22cfeba..064410d 100644 --- a/src/afs/DARWIN/osi_vfsops.c +++ b/src/afs/DARWIN/osi_vfsops.c @@ -281,7 +281,7 @@ again: needref=1; } } else - error = ENOENT; + error = EIO; } } if (tvp) { diff --git a/src/afs/FBSD/osi_vfsops.c b/src/afs/FBSD/osi_vfsops.c index 5b3f33b..8ca88c3 100644 --- a/src/afs/FBSD/osi_vfsops.c +++ b/src/afs/FBSD/osi_vfsops.c @@ -292,7 +292,7 @@ tryagain: } } } else - error = ENOENT; + error = EIO; } } if (tvp) { diff --git a/src/afs/HPUX/osi_vfsops.c b/src/afs/HPUX/osi_vfsops.c index ca5de57..ee3741c 100644 --- a/src/afs/HPUX/osi_vfsops.c +++ b/src/afs/HPUX/osi_vfsops.c @@ -133,7 +133,7 @@ afs_root(struct vfs *afsp, struct vnode **avpp, char *unused1) if (tvp) { afs_globalVp = tvp; } else - code = ENOENT; + code = EIO; } } if (tvp) { diff --git a/src/afs/IRIX/osi_vfsops.c b/src/afs/IRIX/osi_vfsops.c index bc129d6..a7e8387 100644 --- a/src/afs/IRIX/osi_vfsops.c +++ b/src/afs/IRIX/osi_vfsops.c @@ -279,7 +279,7 @@ afs_root(OSI_VFS_ARG(afsp), avpp) if (tvp) { afs_globalVp = tvp; } else - code = ENOENT; + code = EIO; } } if (tvp) { @@ -529,7 +529,7 @@ afs_vget(OSI_VFS_DECL(afsp), vnode_t ** avcp, struct fid * fidp) /* It's a checkpoint restart fid. */ tcell = afs_GetCellByIndex(afid2->af_cell, READ_LOCK); if (!tcell) { - code = ENOENT; + code = EIO; goto out; } vfid.Cell = tcell->cellNum; @@ -543,7 +543,7 @@ afs_vget(OSI_VFS_DECL(afsp), vnode_t ** avcp, struct fid * fidp) *avcp = (vnode_t *) afs_GetVCache(&vfid, &treq, NULL, (struct vcache *)0); if (!*avcp) { - code = ENOENT; + code = EIO; } goto out; } diff --git a/src/afs/IRIX/osi_vnodeops.c b/src/afs/IRIX/osi_vnodeops.c index 4d8aa62..5efd81c 100644 --- a/src/afs/IRIX/osi_vnodeops.c +++ b/src/afs/IRIX/osi_vnodeops.c @@ -1152,7 +1152,7 @@ OSI_VC_DECL(avc); avc->mapcnt -= mapcnt; code = afs_StoreOnLastReference(avc, &treq); /* The following behavior mimics the behavior in afs_close. */ - if (code == VNOVNODE || code == ENOENT) + if (code == VNOVNODE) code = 0; if (code) { if (mapcnt) { diff --git a/src/afs/LINUX/osi_misc.c b/src/afs/LINUX/osi_misc.c index 32ee5a6..627b477 100644 --- a/src/afs/LINUX/osi_misc.c +++ b/src/afs/LINUX/osi_misc.c @@ -65,7 +65,6 @@ osi_lookupname_internal(char *aname, int followlink, struct vfsmount **mnt, afs_linux_path_t path_data; #endif int flags = LOOKUP_POSITIVE; - code = ENOENT; if (followlink) flags |= LOOKUP_FOLLOW; @@ -113,7 +112,6 @@ osi_lookupname(char *aname, uio_seg_t seg, int followlink, int code; char *name; - code = ENOENT; if (seg == AFS_UIOUSER) { name = afs_getname(aname); if (IS_ERR(name)) @@ -136,7 +134,6 @@ int osi_abspath(char *aname, char *buf, int buflen, char *name, *path; int code; - code = ENOENT; name = afs_getname(aname); if (IS_ERR(name)) return -PTR_ERR(name); diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c index e6e0032..a0bcc85 100644 --- a/src/afs/LINUX/osi_vfsops.c +++ b/src/afs/LINUX/osi_vfsops.c @@ -209,7 +209,7 @@ afs_root(struct super_block *afsp) afs_DestroyAttr(vattr); } } else - code = ENOENT; + code = EIO; } crfree(credp); afs_DestroyReq(treq); diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 7bd9094..ae83935 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -339,7 +339,7 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) tdc = afs_GetDCache(avc, (afs_size_t) 0, treq, &origOffset, &tlen, 1); len = tlen; if (!tdc) { - code = -ENOENT; + code = -EIO; goto out; } ObtainWriteLock(&avc->lock, 811); @@ -403,7 +403,7 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) UpgradeSToWLock(&avc->lock, 814); avc->f.states |= CCorrupt; } - code = -ENOENT; + code = -EIO; goto unlock_out; } diff --git a/src/afs/NBSD/osi_vfsops.c b/src/afs/NBSD/osi_vfsops.c index 3e41847..a52629b 100644 --- a/src/afs/NBSD/osi_vfsops.c +++ b/src/afs/NBSD/osi_vfsops.c @@ -366,7 +366,7 @@ tryagain: } afs_globalVp = tvp; } else - code = ENOENT; + code = EIO; } } if (tvp) { diff --git a/src/afs/OBSD/osi_vfsops.c b/src/afs/OBSD/osi_vfsops.c index aa2ccb4..4377494 100644 --- a/src/afs/OBSD/osi_vfsops.c +++ b/src/afs/OBSD/osi_vfsops.c @@ -360,7 +360,7 @@ afs_root(struct mount *mp, struct vnode **vpp) afs_globalVFS = mp; *vpp = AFSTOV(tvp); } else - code = ENOENT; + code = EIO; } AFS_GUNLOCK(); diff --git a/src/afs/SOLARIS/osi_vfsops.c b/src/afs/SOLARIS/osi_vfsops.c index 88ab992..14695d2 100644 --- a/src/afs/SOLARIS/osi_vfsops.c +++ b/src/afs/SOLARIS/osi_vfsops.c @@ -189,7 +189,7 @@ again: } afs_globalVp = tvp; } else - code = ENOENT; + code = EIO; } } if (tvp) { diff --git a/src/afs/SOLARIS/osi_vnodeops.c b/src/afs/SOLARIS/osi_vnodeops.c index 8e24abd..d19bcf6 100644 --- a/src/afs/SOLARIS/osi_vnodeops.c +++ b/src/afs/SOLARIS/osi_vnodeops.c @@ -823,7 +823,7 @@ afs_nfsrdwr(struct vcache *avc, struct uio *auio, enum uio_rw arw, afs_size_t toff, tlen; dcp = afs_GetDCache(avc, fileBase, &treq, &toff, &tlen, 2); if (!dcp) { - code = ENOENT; + code = EIO; break; } } diff --git a/src/afs/UKERNEL/osi_vfsops.c b/src/afs/UKERNEL/osi_vfsops.c index 42d25ab..b50af8f 100644 --- a/src/afs/UKERNEL/osi_vfsops.c +++ b/src/afs/UKERNEL/osi_vfsops.c @@ -81,7 +81,7 @@ afs_root(OSI_VFS_DECL(afsp), struct vnode **avpp) if (tvp) { afs_globalVp = tvp; } else - code = ENOENT; + code = EIO; } } if (tvp) { diff --git a/src/afs/VNOPS/afs_vnop_create.c b/src/afs/VNOPS/afs_vnop_create.c index b0762a2..5f8819f 100644 --- a/src/afs/VNOPS/afs_vnop_create.c +++ b/src/afs/VNOPS/afs_vnop_create.c @@ -257,8 +257,12 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, } } *avcp = tvc; - } else - code = ENOENT; /* shouldn't get here */ + + } else { + /* Directory entry already exists, but we cannot fetch the + * fid it points to. */ + code = EIO; + } /* make sure vrefCount bumped only if code == 0 */ goto done; } @@ -465,8 +469,11 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, ReleaseWriteLock(&tvc->lock); *avcp = tvc; code = 0; - } else - code = ENOENT; + + } else { + /* Cannot create a new vcache. */ + code = EIO; + } } else { /* otherwise cache entry already exists, someone else must * have created it. Comments used to say: "don't need write diff --git a/src/afs/VNOPS/afs_vnop_dirops.c b/src/afs/VNOPS/afs_vnop_dirops.c index b664921..9365563 100644 --- a/src/afs/VNOPS/afs_vnop_dirops.c +++ b/src/afs/VNOPS/afs_vnop_dirops.c @@ -197,7 +197,7 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, if (tvc) { *avcp = tvc; } else { - code = ENOENT; + code = EIO; goto done; } @@ -210,7 +210,7 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, new_dc = afs_GetDCache(tvc, (afs_size_t) 0, treq, &offset, &len, 1); if (!new_dc) { /* printf("afs_mkdir: can't get new dcache for dir.\n"); */ - code = ENOENT; + code = EIO; goto done; } @@ -235,8 +235,12 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, if (tvc) { code = 0; *avcp = tvc; - } else - code = ENOENT; + + } else { + /* For some reason, we cannot fetch the vcache for our + * newly-created dir. */ + code = EIO; + } } /* if (AFS_DISCON_RW) */ done: diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index 9d59564..d194025 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -411,7 +411,7 @@ afs_EvalFakeStat_int(struct vcache **avcp, struct afs_fakestat_state *state, root_vp = afs_GetVCache(tvc->mvid.target_root, areq, NULL, NULL); } if (!root_vp) { - code = canblock ? ENOENT : 0; + code = canblock ? EIO : 0; goto done; } #ifdef AFS_DARWIN80_ENV @@ -437,7 +437,7 @@ afs_EvalFakeStat_int(struct vcache **avcp, struct afs_fakestat_state *state, *avcp = root_vp; code = 0; } else { - code = canblock ? ENOENT : 0; + code = canblock ? EIO : 0; } done: @@ -755,7 +755,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) dcp = afs_GetDCache(adp, (afs_size_t) 0, areqp, &temp, &temp, 1); if (!dcp) { - code = ENOENT; + code = EIO; goto done2; } @@ -1426,7 +1426,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr /*printf("Code is %d\n", code);*/ if (tryEvalOnly && adp->mvstat == AFS_MVSTAT_MTPT) - code = ENOENT; + code = ENODEV; if (code) goto done; @@ -1456,7 +1456,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr afs_Trace3(afs_iclSetp, CM_TRACE_GETVCDOTDOT, ICL_TYPE_FID, adp->mvid.parent, ICL_TYPE_POINTER, tvc, ICL_TYPE_INT32, code); *avcp = tvc; - code = (tvc ? 0 : ENOENT); + code = (tvc ? 0 : EIO); hit = 1; if (tvc && !VREFCOUNT_GT(tvc, 0)) { osi_Panic("TT1"); @@ -1549,7 +1549,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr tfid.Fid.Unique = volid; } *avcp = tvc = afs_GetVCache(&tfid, treq, NULL, NULL); - code = (tvc ? 0 : ENOENT); + code = (tvc ? 0 : EIO); hit = 1; goto done; } @@ -1844,7 +1844,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr afs_PutVCache(uvc); /* we're done with it */ if (!tvc) { - code = ENOENT; + code = EIO; if (tvolp) { afs_PutVolume(tvolp, WRITE_LOCK); } @@ -1867,7 +1867,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr } } else { afs_PutVCache(tvc); - code = ENOENT; + code = ENODEV; if (tvolp) afs_PutVolume(tvolp, WRITE_LOCK); goto done; @@ -1902,7 +1902,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr afs_PutVolume(tv, READ_LOCK); } } - code = ENOENT; + code = EIO; } else { code = ENETDOWN; } diff --git a/src/afs/VNOPS/afs_vnop_readdir.c b/src/afs/VNOPS/afs_vnop_readdir.c index 7892982..d5aa00d 100644 --- a/src/afs/VNOPS/afs_vnop_readdir.c +++ b/src/afs/VNOPS/afs_vnop_readdir.c @@ -667,7 +667,7 @@ afs_readdir(OSI_VC_DECL(avc), struct uio *auio, afs_ucred_t *acred) /* get a reference to the entire directory */ tdc = afs_GetDCache(avc, (afs_size_t) 0, treq, &origOffset, &tlen, 1); if (!tdc) { - code = ENOENT; + code = EIO; goto done; } ObtainReadLock(&avc->lock); diff --git a/src/afs/VNOPS/afs_vnop_remove.c b/src/afs/VNOPS/afs_vnop_remove.c index b5f53b4..c19c2a5 100644 --- a/src/afs/VNOPS/afs_vnop_remove.c +++ b/src/afs/VNOPS/afs_vnop_remove.c @@ -199,7 +199,7 @@ afs_remove(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred) goto done; } if (afs_IsDynrootMount(adp)) { - code = ENOENT; + code = EROFS; goto done; } diff --git a/src/afs/VNOPS/afs_vnop_rename.c b/src/afs/VNOPS/afs_vnop_rename.c index 519f405..7791784 100644 --- a/src/afs/VNOPS/afs_vnop_rename.c +++ b/src/afs/VNOPS/afs_vnop_rename.c @@ -93,7 +93,7 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, ObtainWriteLock(&andp->lock, 147); tdc1 = afs_GetDCache(aodp, (afs_size_t) 0, areq, &offset, &len, 0); if (!tdc1) { - code = ENOENT; + code = EIO; } else { ObtainWriteLock(&tdc1->lock, 643); } @@ -112,7 +112,7 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, if (tdc1) ObtainWriteLock(&tdc1->lock, 645); else - code = ENOENT; + code = EIO; } else { ObtainWriteLock(&aodp->lock, 150); /* lock smaller one first */ ObtainWriteLock(&andp->lock, 557); @@ -120,7 +120,7 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, if (tdc1) ObtainWriteLock(&tdc1->lock, 646); else - code = ENOENT; + code = EIO; tdc2 = afs_FindDCache(andp, (afs_size_t) 0); if (tdc2) ObtainWriteLock(&tdc2->lock, 647); @@ -234,7 +234,7 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, ReleaseWriteLock(&tvc->lock); afs_PutVCache(tvc); } else { - code = ENOENT; + code = ENETDOWN; } /* if (tvc) */ } /* if !(AFS_IS_DISCON_RW)*/ returnCode = code; /* remember for later */ diff --git a/src/afs/VNOPS/afs_vnop_symlink.c b/src/afs/VNOPS/afs_vnop_symlink.c index 1e930db..14026ef 100644 --- a/src/afs/VNOPS/afs_vnop_symlink.c +++ b/src/afs/VNOPS/afs_vnop_symlink.c @@ -47,7 +47,7 @@ afs_DisconCreateSymlink(struct vcache *avc, char *aname, tdc = afs_GetDCache(avc, 0, areq, &offset, &len, 0); if (!tdc) { /* printf("afs_DisconCreateSymlink: can't get new dcache for symlink.\n"); */ - return ENOENT; + return ENETDOWN; } len = strlen(aname); @@ -398,7 +398,7 @@ afs_UFSHandleLink(struct vcache *avc, struct vrequest *areq) ReleaseReadLock(&tdc->lock); afs_PutDCache(tdc); osi_FreeLargeSpace(rbuf); - return ENOENT; + return EIO; } code = afs_osi_Read(tfile, -1, rbuf, tlen); osi_UFSClose(tfile); diff --git a/src/afs/VNOPS/afs_vnop_write.c b/src/afs/VNOPS/afs_vnop_write.c index c3ee005..be6c63a 100644 --- a/src/afs/VNOPS/afs_vnop_write.c +++ b/src/afs/VNOPS/afs_vnop_write.c @@ -567,8 +567,8 @@ afs_close(OSI_VC_DECL(avc), afs_int32 aflags, afs_ucred_t *acred) /* VNOVNODE is "acceptable" error code from close, since * may happen when deleting a file on another machine while - * it is open here. We do the same for ENOENT since in afs_CheckCode we map VNOVNODE -> ENOENT */ - if (code == VNOVNODE || code == ENOENT) + * it is open here. */ + if (code == VNOVNODE) code = 0; /* Ensure last closer gets the error. If another thread caused diff --git a/src/afs/afs_disconnected.c b/src/afs/afs_disconnected.c index e948cf9..62712b9 100644 --- a/src/afs/afs_disconnected.c +++ b/src/afs/afs_disconnected.c @@ -264,7 +264,7 @@ afs_GetVnodeName(struct vcache *avc, struct VenusFid *afid, char *aname, parent_vc = afs_FindVCache(&parent_fid, 0, 1); ReleaseSharedLock(&afs_xvcache); if (!parent_vc) { - return ENOENT; + return ENETDOWN; } shadow_fid.Cell = parent_vc->f.fid.Cell; @@ -293,7 +293,7 @@ afs_GetVnodeName(struct vcache *avc, struct VenusFid *afid, char *aname, code = ENOENT; } else { /* printf("Directory dcache not found!\n"); */ - code = ENOENT; + code = ENETDOWN; } return code; @@ -507,7 +507,7 @@ afs_GetParentVCache(struct vcache *avc, int deleted, struct VenusFid *afid, if (afs_GetParentDirFid(avc, afid)) { /* printf("afs_GetParentVCache: Couldn't find parent dir's FID.\n"); */ - return ENOENT; + return ENETDOWN; } code = afs_GetVnodeName(avc, afid, aname, deleted); @@ -521,7 +521,7 @@ afs_GetParentVCache(struct vcache *avc, int deleted, struct VenusFid *afid, ReleaseSharedLock(&afs_xvcache); if (!*adp) { /* printf("afs_GetParentVCache: Couldn't find parent dir's vcache\n"); */ - code = ENOENT; + code = ENETDOWN; goto end; } @@ -593,7 +593,7 @@ afs_ProcessOpRename(struct vcache *avc, struct vrequest *areq) /* Get parent dir's FID.*/ if (afs_GetParentDirFid(avc, &new_pdir_fid)) { /* printf("afs_ProcessOpRename: Couldn't find new parent dir FID.\n"); */ - code = ENOENT; + code = ENETDOWN; goto done; } } @@ -687,7 +687,7 @@ afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, tdc = afs_GetDCache(avc, 0, areq, &offset, &tlen, 0); if (!tdc) { - code = ENOENT; + code = ENETDOWN; goto end; } diff --git a/src/afs/afs_error.c b/src/afs/afs_error.c index 217145f..dd346a0 100644 --- a/src/afs/afs_error.c +++ b/src/afs/afs_error.c @@ -276,7 +276,7 @@ afs_CheckCode(afs_int32 acode, struct vrequest *areq, int where) if (areq->volumeError == VOLBUSY) return EWOULDBLOCK; if (acode == VNOVNODE) - return ENOENT; + return EIO; if (acode == VDISKFULL) return ENOSPC; if (acode == VOVERQUOTA) diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index 1a7ac50..4efcd51 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -2212,7 +2212,7 @@ DECL_PIOCTL(PNewStatMount) } tdc = afs_GetDCache(avc, (afs_size_t) 0, areq, &offset, &len, 1); if (!tdc) - return ENOENT; + return EIO; Check_AtSys(avc, name, &sysState, areq); ObtainReadLock(&tdc->lock); do { @@ -2232,7 +2232,7 @@ DECL_PIOCTL(PNewStatMount) tvc = afs_GetVCache(&tfid, areq, NULL, NULL); } if (!tvc) { - code = ENOENT; + code = EIO; goto out; } if (tvc->mvstat != AFS_MVSTAT_MTPT) { @@ -3275,7 +3275,7 @@ DECL_PIOCTL(PRemoveMount) tdc = afs_GetDCache(avc, (afs_size_t) 0, areq, &offset, &len, 1); /* test for error below */ if (!tdc) - return ENOENT; + return EIO; Check_AtSys(avc, name, &sysState, areq); ObtainReadLock(&tdc->lock); do { @@ -3295,7 +3295,7 @@ DECL_PIOCTL(PRemoveMount) tvc = afs_GetVCache(&tfid, areq, NULL, NULL); } if (!tvc) { - code = ENOENT; + code = EIO; afs_PutDCache(tdc); goto out; } @@ -4826,7 +4826,7 @@ DECL_PIOCTL(PFlushMount) } tdc = afs_GetDCache(avc, (afs_size_t) 0, areq, &offset, &len, 1); if (!tdc) - return ENOENT; + return EIO; Check_AtSys(avc, mount, &sysState, areq); ObtainReadLock(&tdc->lock); do { @@ -4846,7 +4846,7 @@ DECL_PIOCTL(PFlushMount) tvc = afs_GetVCache(&tfid, areq, NULL, NULL); } if (!tvc) { - code = ENOENT; + code = EIO; goto out; } if (tvc->mvstat != AFS_MVSTAT_MTPT) { diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 1d75f7c..63a0431 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -1228,7 +1228,7 @@ afs_VerifyVCache2(struct vcache *avc, struct vrequest *areq) /* fetch the status info */ tvc = afs_GetVCache(&avc->f.fid, areq, NULL, avc); if (!tvc) - return ENOENT; + return EIO; /* Put it back; caller has already incremented vrefCount */ afs_PutVCache(tvc); return 0; -- 1.9.4