@@ -1665,17 +1665,25 @@ static struct dentry *lookup_dcache(const struct qstr *name,
1665
1665
return dentry ;
1666
1666
}
1667
1667
1668
- static struct dentry * lookup_one_qstr_excl_raw (const struct qstr * name ,
1669
- struct dentry * base ,
1670
- unsigned int flags )
1668
+ /*
1669
+ * Parent directory has inode locked exclusive. This is one
1670
+ * and only case when ->lookup() gets called on non in-lookup
1671
+ * dentries - as the matter of fact, this only gets called
1672
+ * when directory is guaranteed to have no in-lookup children
1673
+ * at all.
1674
+ * Will return -ENOENT if name isn't found and LOOKUP_CREATE wasn't passed.
1675
+ * Will return -EEXIST if name is found and LOOKUP_EXCL was passed.
1676
+ */
1677
+ struct dentry * lookup_one_qstr_excl (const struct qstr * name ,
1678
+ struct dentry * base , unsigned int flags )
1671
1679
{
1672
1680
struct dentry * dentry ;
1673
1681
struct dentry * old ;
1674
1682
struct inode * dir ;
1675
1683
1676
1684
dentry = lookup_dcache (name , base , flags );
1677
1685
if (dentry )
1678
- return dentry ;
1686
+ goto found ;
1679
1687
1680
1688
/* Don't create child dentry for a dead directory. */
1681
1689
dir = base -> d_inode ;
@@ -1691,24 +1699,7 @@ static struct dentry *lookup_one_qstr_excl_raw(const struct qstr *name,
1691
1699
dput (dentry );
1692
1700
dentry = old ;
1693
1701
}
1694
- return dentry ;
1695
- }
1696
-
1697
- /*
1698
- * Parent directory has inode locked exclusive. This is one
1699
- * and only case when ->lookup() gets called on non in-lookup
1700
- * dentries - as the matter of fact, this only gets called
1701
- * when directory is guaranteed to have no in-lookup children
1702
- * at all.
1703
- * Will return -ENOENT if name isn't found and LOOKUP_CREATE wasn't passed.
1704
- * Will return -EEXIST if name is found and LOOKUP_EXCL was passed.
1705
- */
1706
- struct dentry * lookup_one_qstr_excl (const struct qstr * name ,
1707
- struct dentry * base , unsigned int flags )
1708
- {
1709
- struct dentry * dentry ;
1710
-
1711
- dentry = lookup_one_qstr_excl_raw (name , base , flags );
1702
+ found :
1712
1703
if (IS_ERR (dentry ))
1713
1704
return dentry ;
1714
1705
if (d_is_negative (dentry ) && !(flags & LOOKUP_CREATE )) {
@@ -2790,7 +2781,7 @@ struct dentry *kern_path_locked_negative(const char *name, struct path *path)
2790
2781
if (unlikely (type != LAST_NORM ))
2791
2782
return ERR_PTR (- EINVAL );
2792
2783
inode_lock_nested (parent_path .dentry -> d_inode , I_MUTEX_PARENT );
2793
- d = lookup_one_qstr_excl_raw (& last , parent_path .dentry , 0 );
2784
+ d = lookup_one_qstr_excl (& last , parent_path .dentry , LOOKUP_CREATE );
2794
2785
if (IS_ERR (d )) {
2795
2786
inode_unlock (parent_path .dentry -> d_inode );
2796
2787
return d ;
0 commit comments