@@ -1473,43 +1473,36 @@ static struct dentry *lookup_dcache(const struct qstr *name,
14731473}
14741474
14751475/*
1476- * Call i_op->lookup on the dentry. The dentry must be negative and
1477- * unhashed.
1478- *
1479- * dir->d_inode->i_mutex must be held
1476+ * Parent directory has inode locked exclusive. This is one
1477+ * and only case when ->lookup() gets called on non in-lookup
1478+ * dentries - as the matter of fact, this only gets called
1479+ * when directory is guaranteed to have no in-lookup children
1480+ * at all.
14801481 */
1481- static struct dentry * lookup_real (struct inode * dir , struct dentry * dentry ,
1482- unsigned int flags )
1483- {
1484- struct dentry * old ;
1485-
1486- /* Don't create child dentry for a dead directory. */
1487- if (unlikely (IS_DEADDIR (dir ))) {
1488- dput (dentry );
1489- return ERR_PTR (- ENOENT );
1490- }
1491-
1492- old = dir -> i_op -> lookup (dir , dentry , flags );
1493- if (unlikely (old )) {
1494- dput (dentry );
1495- dentry = old ;
1496- }
1497- return dentry ;
1498- }
1499-
15001482static struct dentry * __lookup_hash (const struct qstr * name ,
15011483 struct dentry * base , unsigned int flags )
15021484{
15031485 struct dentry * dentry = lookup_dcache (name , base , flags );
1486+ struct dentry * old ;
1487+ struct inode * dir = base -> d_inode ;
15041488
15051489 if (dentry )
15061490 return dentry ;
15071491
1492+ /* Don't create child dentry for a dead directory. */
1493+ if (unlikely (IS_DEADDIR (dir )))
1494+ return ERR_PTR (- ENOENT );
1495+
15081496 dentry = d_alloc (base , name );
15091497 if (unlikely (!dentry ))
15101498 return ERR_PTR (- ENOMEM );
15111499
1512- return lookup_real (base -> d_inode , dentry , flags );
1500+ old = dir -> i_op -> lookup (dir , dentry , flags );
1501+ if (unlikely (old )) {
1502+ dput (dentry );
1503+ dentry = old ;
1504+ }
1505+ return dentry ;
15131506}
15141507
15151508static int lookup_fast (struct nameidata * nd ,
0 commit comments