Commit 844a391799c25d9ba85cbce33e4697db06083ec6
1 parent
795abaf1e4
Exists in
master
and in
20 other branches
nothing in do_follow_link() is going to see RCU
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 1 changed file with 7 additions and 8 deletions Side-by-side Diff
fs/namei.c
... | ... | @@ -668,9 +668,6 @@ |
668 | 668 | return 0; |
669 | 669 | |
670 | 670 | if (!status) { |
671 | - /* Don't d_invalidate in rcu-walk mode */ | |
672 | - if (nameidata_drop_rcu(nd)) | |
673 | - return -ECHILD; | |
674 | 671 | d_invalidate(dentry); |
675 | 672 | status = -ESTALE; |
676 | 673 | } |
... | ... | @@ -777,6 +774,8 @@ |
777 | 774 | int error; |
778 | 775 | struct dentry *dentry = link->dentry; |
779 | 776 | |
777 | + BUG_ON(nd->flags & LOOKUP_RCU); | |
778 | + | |
780 | 779 | touch_atime(link->mnt, dentry); |
781 | 780 | nd_set_link(nd, NULL); |
782 | 781 | |
... | ... | @@ -811,6 +810,11 @@ |
811 | 810 | { |
812 | 811 | void *cookie; |
813 | 812 | int err = -ELOOP; |
813 | + | |
814 | + /* We drop rcu-walk here */ | |
815 | + if (nameidata_dentry_drop_rcu_maybe(nd, path->dentry)) | |
816 | + return -ECHILD; | |
817 | + | |
814 | 818 | if (current->link_count >= MAX_NESTED_LINKS) |
815 | 819 | goto loop; |
816 | 820 | if (current->total_link_count >= 40) |
... | ... | @@ -1419,9 +1423,6 @@ |
1419 | 1423 | goto out_dput; |
1420 | 1424 | |
1421 | 1425 | if (inode->i_op->follow_link) { |
1422 | - /* We commonly drop rcu-walk here */ | |
1423 | - if (nameidata_dentry_drop_rcu_maybe(nd, next.dentry)) | |
1424 | - return -ECHILD; | |
1425 | 1426 | BUG_ON(inode != next.dentry->d_inode); |
1426 | 1427 | err = do_follow_link(&next, nd); |
1427 | 1428 | if (err) |
... | ... | @@ -1467,8 +1468,6 @@ |
1467 | 1468 | break; |
1468 | 1469 | if (inode && unlikely(inode->i_op->follow_link) && |
1469 | 1470 | (lookup_flags & LOOKUP_FOLLOW)) { |
1470 | - if (nameidata_dentry_drop_rcu_maybe(nd, next.dentry)) | |
1471 | - return -ECHILD; | |
1472 | 1471 | BUG_ON(inode != next.dentry->d_inode); |
1473 | 1472 | err = do_follow_link(&next, nd); |
1474 | 1473 | if (err) |