OSDN Git Service

afs_try_auto_mntpt(): return NULL instead of ERR_PTR(-ENOENT)
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 24 Jun 2018 14:45:44 +0000 (10:45 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 5 Aug 2018 19:50:59 +0000 (15:50 -0400)
simpler logics in callers that way

Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/afs/dir.c
fs/afs/dynroot.c

index 52f4425..855bf2b 100644 (file)
@@ -866,8 +866,6 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
        key_put(key);
        if (inode == ERR_PTR(-ENOENT)) {
                inode = afs_try_auto_mntpt(dentry, dir);
-               if (inode == ERR_PTR(-ENOENT))
-                       inode = NULL;
        } else {
                dentry->d_fsdata =
                        (void *)(unsigned long)dvnode->status.data_version;
index 40fea59..1cde710 100644 (file)
@@ -83,7 +83,7 @@ struct inode *afs_try_auto_mntpt(struct dentry *dentry, struct inode *dir)
 
 out:
        _leave("= %d", ret);
-       return ERR_PTR(ret);
+       return ret == -ENOENT ? NULL : ERR_PTR(ret);
 }
 
 /*
@@ -141,11 +141,6 @@ out_p:
 static struct dentry *afs_dynroot_lookup(struct inode *dir, struct dentry *dentry,
                                         unsigned int flags)
 {
-       struct afs_vnode *vnode;
-       struct inode *inode;
-
-       vnode = AFS_FS_I(dir);
-
        _enter("%pd", dentry);
 
        ASSERTCMP(d_inode(dentry), ==, NULL);
@@ -159,11 +154,7 @@ static struct dentry *afs_dynroot_lookup(struct inode *dir, struct dentry *dentr
            memcmp(dentry->d_name.name, "@cell", 5) == 0)
                return afs_lookup_atcell(dentry);
 
-       inode = afs_try_auto_mntpt(dentry, dir);
-       if (inode == ERR_PTR(-ENOENT))
-               inode = NULL;
-
-       return d_splice_alias(inode, dentry);
+       return d_splice_alias(afs_try_auto_mntpt(dentry, dir), dentry);
 }
 
 const struct inode_operations afs_dynroot_inode_operations = {