OSDN Git Service

sysv_lookup: use d_splice_alias()
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 1 May 2018 00:09:10 +0000 (20:09 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 22 May 2018 18:27:53 +0000 (14:27 -0400)
code is simpler that way

Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/sysv/namei.c

index 250b075..4d5d204 100644 (file)
@@ -51,14 +51,9 @@ static struct dentry *sysv_lookup(struct inode * dir, struct dentry * dentry, un
        if (dentry->d_name.len > SYSV_NAMELEN)
                return ERR_PTR(-ENAMETOOLONG);
        ino = sysv_inode_by_name(dentry);
-
-       if (ino) {
+       if (ino)
                inode = sysv_iget(dir->i_sb, ino);
-               if (IS_ERR(inode))
-                       return ERR_CAST(inode);
-       }
-       d_add(dentry, inode);
-       return NULL;
+       return d_splice_alias(inode, dentry);
 }
 
 static int sysv_mknod(struct inode * dir, struct dentry * dentry, umode_t mode, dev_t rdev)