Re: [PATCH 3/3] VFS: close race between getcwd() and d_move()
From: Linus Torvalds
Date: Fri Nov 10 2017 - 14:52:23 EST
On Thu, Nov 9, 2017 at 8:45 PM, NeilBrown <neilb@xxxxxxxx> wrote:
>
> However your description of what it was that you didn't like gave me an
> idea - I can take the same approach as my original, but not pass flags
> around.
> I quite like how this turned out.
> Dropping the BUG_ON() in d_rehash() isn't ideal, maybe we could add
> ___d_rehash() without the BUG_ON() and call that from __d_rehash?
This looks more palatable to me, yes.
It still worries me a bit that we end up having that dangling pprev
pointer despite having dropped the hash list lock, but as long as
nobody uses it for anything but that "is it hashed" test without
taking the dentry lock, it all *should* be safe.
Please fix the whitespace, though. This is not how we do function definitions:
void __d_drop(struct dentry *dentry) {
but otherwise I think this patch is acceptable.
Still want commentary from Al (and preferably going through his vfs
tree for 4.15 or whatever).
Linus