Skip to content

Commit 79ac5a4

Browse files
author
Al Viro
committed
jfs_lookup(): don't bother with . or ..
they'll never be passed to ->lookup() Signed-off-by: Al Viro <[email protected]>
1 parent 10d9f30 commit 79ac5a4

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

fs/jfs/namei.c

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,34 +1456,25 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struc
14561456
ino_t inum;
14571457
struct inode *ip;
14581458
struct component_name key;
1459-
const char *name = dentry->d_name.name;
1460-
int len = dentry->d_name.len;
14611459
int rc;
14621460

1463-
jfs_info("jfs_lookup: name = %s", name);
1464-
1465-
if ((name[0] == '.') && (len == 1))
1466-
inum = dip->i_ino;
1467-
else if (strcmp(name, "..") == 0)
1468-
inum = PARENT(dip);
1469-
else {
1470-
if ((rc = get_UCSname(&key, dentry)))
1471-
return ERR_PTR(rc);
1472-
rc = dtSearch(dip, &key, &inum, &btstack, JFS_LOOKUP);
1473-
free_UCSname(&key);
1474-
if (rc == -ENOENT) {
1475-
d_add(dentry, NULL);
1476-
return NULL;
1477-
} else if (rc) {
1478-
jfs_err("jfs_lookup: dtSearch returned %d", rc);
1479-
return ERR_PTR(rc);
1480-
}
1461+
jfs_info("jfs_lookup: name = %s", dentry->d_name.name);
1462+
1463+
if ((rc = get_UCSname(&key, dentry)))
1464+
return ERR_PTR(rc);
1465+
rc = dtSearch(dip, &key, &inum, &btstack, JFS_LOOKUP);
1466+
free_UCSname(&key);
1467+
if (rc == -ENOENT) {
1468+
ip = NULL;
1469+
} else if (rc) {
1470+
jfs_err("jfs_lookup: dtSearch returned %d", rc);
1471+
ip = ERR_PTR(rc);
1472+
} else {
1473+
ip = jfs_iget(dip->i_sb, inum);
1474+
if (IS_ERR(ip))
1475+
jfs_err("jfs_lookup: iget failed on inum %d", (uint)inum);
14811476
}
14821477

1483-
ip = jfs_iget(dip->i_sb, inum);
1484-
if (IS_ERR(ip))
1485-
jfs_err("jfs_lookup: iget failed on inum %d", (uint) inum);
1486-
14871478
return d_splice_alias(ip, dentry);
14881479
}
14891480

0 commit comments

Comments
 (0)