On Thu, May 29, 2014 at 11:52 AM, Al Viro <v...@zeniv.linux.org.uk> wrote:
>
> Grrr...  Sadly, that's not good enough.  Leaking rcu_read_lock() on
> success is trivial, but there's more serious problem: suppose dentries
> involved get moved before we get to locking what we thought was parent.
> We end up taking ->d_lock on two dentries that might be nowhere near each
> other in the tree, with obvious nasty implications.  Would be _very_ hard
> to reproduce ;-/

Yeah, I don't think you can reproduce that, but I guess renaming
directories into each other (two renames needed) could trigger an ABBA
deadlock by changing the topological order of dentry/parent.

I suspect there's no way in hell that tiny race will ever happen in
practice, but let's not risk it.

And your solution (to re-check after just taking the parent lock)
seems sufficient and sane, since dentry_lock_for_move() will always
take the parent lock(s) before we move a dentry.

So that looks good to me.

              Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to