]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
LINUX: Check afs_lookup return code explicitly
authorAndrew Deason <adeason@sinenomine.net>
Thu, 24 Jul 2014 16:07:45 +0000 (11:07 -0500)
committerD Brashear <shadow@your-file-system.com>
Wed, 6 Aug 2014 14:28:22 +0000 (10:28 -0400)
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.

Change-Id: I61cc7304e9885ddaaebe96db3b12457cb6224420
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>
src/afs/LINUX/osi_vnodeops.c

index 0c907d825db27ecf229824ca97f1d33cc7b2b3b2..18d013a9c6c70e70083d2a03556211b5d25da93d 100644 (file)
@@ -964,10 +964,11 @@ static inline void
 fix_bad_parent(struct dentry *dp, cred_t *credp, struct vcache *vcp, struct vcache *pvc) 
 {
     struct vcache *avc = NULL;
+    int code;
 
     /* force a lookup, so vcp->mvid is fixed up */
-    afs_lookup(pvc, (char *)dp->d_name.name, &avc, credp);
-    if (!avc || vcp != avc) {  /* bad, very bad.. */
+    code = afs_lookup(pvc, (char *)dp->d_name.name, &avc, credp);
+    if (code || vcp != avc) {  /* bad, very bad.. */
        afs_Trace4(afs_iclSetp, CM_TRACE_TMP_1S3L, ICL_TYPE_STRING,
                   "check_bad_parent: bad pointer returned from afs_lookup origvc newvc dentry",
                   ICL_TYPE_POINTER, vcp, ICL_TYPE_POINTER, avc,
@@ -1302,7 +1303,7 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
            int code;
 
            code = afs_lookup(pvcp, (char *)dp->d_name.name, &tvc, credp);
-           if (!tvc || tvc != vcp) {
+           if (code || tvc != vcp) {
                dput(parent);
                /* Force unhash; the name doesn't point to this file
                 * anymore. */
@@ -1550,7 +1551,7 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp)
     AFS_GLOCK();
     code = afs_lookup(VTOAFS(dip), (char *)comp, &vcp, credp);
     
-    if (vcp) {
+    if (!code) {
        struct vattr *vattr = NULL;
        struct vcache *parent_vc = VTOAFS(dip);