@@ -1220,8 +1220,8 @@ static int follow_managed(struct path *path, struct nameidata *nd)
1220
1220
1221
1221
if (need_mntput && path -> mnt == mnt )
1222
1222
mntput (path -> mnt );
1223
- if (ret == - EISDIR )
1224
- ret = 0 ;
1223
+ if (ret == - EISDIR || ! ret )
1224
+ ret = 1 ;
1225
1225
if (need_mntput )
1226
1226
nd -> flags |= LOOKUP_JUMPED ;
1227
1227
if (unlikely (ret < 0 ))
@@ -1533,7 +1533,7 @@ static int lookup_fast(struct nameidata *nd,
1533
1533
if (unlikely (!dentry )) {
1534
1534
if (unlazy_walk (nd , NULL , 0 ))
1535
1535
return - ECHILD ;
1536
- return 1 ;
1536
+ return 0 ;
1537
1537
}
1538
1538
1539
1539
/*
@@ -1573,22 +1573,20 @@ static int lookup_fast(struct nameidata *nd,
1573
1573
path -> mnt = mnt ;
1574
1574
path -> dentry = dentry ;
1575
1575
if (likely (__follow_mount_rcu (nd , path , inode , seqp )))
1576
- return 0 ;
1576
+ return 1 ;
1577
1577
if (unlazy_walk (nd , dentry , seq ))
1578
1578
return - ECHILD ;
1579
1579
}
1580
1580
} else {
1581
1581
dentry = __d_lookup (parent , & nd -> last );
1582
1582
if (unlikely (!dentry ))
1583
- return 1 ;
1583
+ return 0 ;
1584
1584
if (unlikely (dentry -> d_flags & DCACHE_OP_REVALIDATE ))
1585
1585
status = d_revalidate (dentry , nd -> flags );
1586
1586
}
1587
1587
if (unlikely (status <= 0 )) {
1588
- if (!status ) {
1588
+ if (!status )
1589
1589
d_invalidate (dentry );
1590
- status = 1 ;
1591
- }
1592
1590
dput (dentry );
1593
1591
return status ;
1594
1592
}
@@ -1600,7 +1598,7 @@ static int lookup_fast(struct nameidata *nd,
1600
1598
path -> mnt = mnt ;
1601
1599
path -> dentry = dentry ;
1602
1600
err = follow_managed (path , nd );
1603
- if (likely (! err ))
1601
+ if (likely (err > 0 ))
1604
1602
* inode = d_backing_inode (path -> dentry );
1605
1603
return err ;
1606
1604
}
@@ -1724,7 +1722,7 @@ static int walk_component(struct nameidata *nd, int flags)
1724
1722
return err ;
1725
1723
}
1726
1724
err = lookup_fast (nd , & path , & inode , & seq );
1727
- if (unlikely (err )) {
1725
+ if (unlikely (err <= 0 )) {
1728
1726
if (err < 0 )
1729
1727
return err ;
1730
1728
@@ -3101,7 +3099,7 @@ static int do_last(struct nameidata *nd,
3101
3099
nd -> flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY ;
3102
3100
/* we _can_ be in RCU mode here */
3103
3101
error = lookup_fast (nd , & path , & inode , & seq );
3104
- if (likely (! error ))
3102
+ if (likely (error > 0 ))
3105
3103
goto finish_lookup ;
3106
3104
3107
3105
if (error < 0 )
0 commit comments