Commit 2f42f1e
Al Viro
Call retain_dentry() with refcount 0
Instead of bumping it from 0 to 1, calling retain_dentry(), then
decrementing it back to 0 (with ->d_lock held all the way through),
just leave refcount at 0 through all of that.
It will have a visible effect for ->d_delete() - now it can be
called with refcount 0 instead of 1 and it can no longer play
silly buggers with dropping/regaining ->d_lock. Not that any
in-tree instances tried to (it's pretty hard to get right).
Any out-of-tree ones will have to adjust (assuming they need any
changes).
Note that we do not need to extend rcu-critical area here - we have
verified that refcount is non-negative after having grabbed ->d_lock,
so nobody will be able to free dentry until they get into __dentry_kill(),
which won't happen until they manage to grab ->d_lock.
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>1 parent b06c684 commit 2f42f1e
2 files changed
Lines changed: 10 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1070 | 1070 | | |
1071 | 1071 | | |
1072 | 1072 | | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
888 | 888 | | |
889 | 889 | | |
890 | 890 | | |
891 | | - | |
892 | 891 | | |
893 | 892 | | |
894 | 893 | | |
895 | | - | |
896 | 894 | | |
897 | 895 | | |
898 | 896 | | |
899 | 897 | | |
| 898 | + | |
900 | 899 | | |
901 | 900 | | |
902 | 901 | | |
| |||
921 | 920 | | |
922 | 921 | | |
923 | 922 | | |
924 | | - | |
925 | | - | |
926 | | - | |
| 923 | + | |
927 | 924 | | |
928 | | - | |
929 | | - | |
930 | | - | |
931 | 925 | | |
932 | 926 | | |
933 | 927 | | |
| |||
0 commit comments