]> git.baikalelectronics.ru Git - kernel.git/commit
make sure that __dentry_kill() always invalidates d_seq, unhashed or not
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 9 Aug 2018 14:15:54 +0000 (10:15 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 9 Aug 2018 22:07:15 +0000 (18:07 -0400)
commit5efdb05bde59fe9914dd14adacd21bb2c868d374
tree1271fc0ec0ee812900750b246c90afd807efabac
parent3c1856d3ca19a1a1fcbcc6f825cb085bf7bbf550
make sure that __dentry_kill() always invalidates d_seq, unhashed or not

RCU pathwalk relies upon the assumption that anything that changes
->d_inode of a dentry will invalidate its ->d_seq.  That's almost
true - the one exception is that the final dput() of already unhashed
dentry does *not* touch ->d_seq at all.  Unhashing does, though,
so for anything we'd found by RCU dcache lookup we are fine.
Unfortunately, we can *start* with an unhashed dentry or jump into
it.

We could try and be careful in the (few) places where that could
happen.  Or we could just make the final dput() invalidate the damn
thing, unhashed or not.  The latter is much simpler and easier to
backport, so let's do it that way.

Reported-by: "Dae R. Jeong" <threeearcat@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/dcache.c