source: trunk/server/common/patches/openafs-afs_lookup-return.patch @ 2639

Last change on this file since 2639 was 2637, checked in by andersk, 9 years ago
Upgrade to OpenAFS 1.6.10; new patch for Scripts #387?
File size: 2.4 KB
  • src/afs/LINUX/osi_vnodeops.c

    From 100e35ed19e2c255986cb330b0f56f706acc6e7b Mon Sep 17 00:00:00 2001
    From: Andrew Deason <adeason@sinenomine.net>
    Date: Thu, 24 Jul 2014 11:07:45 -0500
    Subject: [PATCH] LINUX: Check afs_lookup return code explicitly
    
    Checking if the returned vcache is NULL or not is a bit of an indirect
    way to check if an error occurred. Just check the return code itself,
    to make sure we notice if any kind of error is reported.
    
    Suggested by Chas Williams.
    
    Reviewed-on: http://gerrit.openafs.org/11321
    Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: D Brashear <shadow@your-file-system.com>
    (cherry picked from commit 2edf5c0382385f898a017fd8e0e2429f8b2b3520)
    
    Change-Id: I7e123ab1cf88570a6b18e438e01409ed7804e014
    ---
     src/afs/LINUX/osi_vnodeops.c | 9 +++++----
     1 file changed, 5 insertions(+), 4 deletions(-)
    
    diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
    index 7e5cdd1..9ed6f01 100644
    a b check_bad_parent(struct dentry *dp) 
    943943    cred_t *credp;
    944944    struct dentry *parent;
    945945    struct vcache *vcp, *pvc, *avc = NULL;
     946    int code;
    946947
    947948    vcp = VTOAFS(dp->d_inode);
    948949    parent = dget_parent(dp);
    check_bad_parent(struct dentry *dp) 
    952953        credp = crref();
    953954
    954955        /* force a lookup, so vcp->mvid is fixed up */
    955         afs_lookup(pvc, (char *)dp->d_name.name, &avc, credp);
    956         if (!avc || vcp != avc) {       /* bad, very bad.. */
     956        code = afs_lookup(pvc, (char *)dp->d_name.name, &avc, credp);
     957        if (code || vcp != avc) {       /* bad, very bad.. */
    957958            afs_Trace4(afs_iclSetp, CM_TRACE_TMP_1S3L, ICL_TYPE_STRING,
    958959                       "check_bad_parent: bad pointer returned from afs_lookup origvc newvc dentry",
    959960                       ICL_TYPE_POINTER, vcp, ICL_TYPE_POINTER, avc,
    afs_linux_dentry_revalidate(struct dentry *dp, int flags) 
    12331234
    12341235            credp = crref();
    12351236            code = afs_lookup(pvcp, (char *)dp->d_name.name, &tvc, credp);
    1236             if (!tvc || tvc != vcp) {
     1237            if (code || tvc != vcp) {
    12371238                dput(parent);
    12381239                /* Force unhash; the name doesn't point to this file
    12391240                 * anymore. */
    afs_linux_lookup(struct inode *dip, struct dentry *dp) 
    14781479    AFS_GLOCK();
    14791480    code = afs_lookup(VTOAFS(dip), (char *)comp, &vcp, credp);
    14801481   
    1481     if (vcp) {
     1482    if (!code) {
    14821483        struct vattr *vattr = NULL;
    14831484        struct vcache *parent_vc = VTOAFS(dip);
    14841485
Note: See TracBrowser for help on using the repository browser.