Re: [PATCH RFC 1/3] fs: introduce helper d_path_fast()
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2021-05-09 02:53:57
Also in:
linux-fsdevel, linux-s390, lkml
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2021-05-09 02:53:57
Also in:
linux-fsdevel, linux-s390, lkml
On Sat, May 8, 2021 at 7:28 PM Al Viro [off-list ref] wrote:
Re READ_ONCE() - we are wrapped into
read_seqbegin_or_lock(&rename_lock, &seq) there, so it's more about
being explicit than about correctness considerations.
Well, part of this all is that the next step is that "vsnprintf()"
with '%pD' would basically use prepend_entries() with just the RCU
lock.
That said, even with the rename lock, that will only cause a retry on
rename - it won't necessarily fix any confusion that comes from the
compiler possibly silently re-loading 'parent' multiple times, and
getting different pointers due to a concurrent rename.
Now, those different results should all be individually ok, due to RCU
freeing, but it's _really_ confusing if 'parent' might be two
different things within the same iteration of the loop.
I don't see anything truly horrible that would happen - mainly "we'll
prefetch one parent, and then due to reloading the pointer we might
actually _use_ another parent entirely for the next iteration", but it
really is best to avoid that kind of confusion.
Linus