[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YguspMvu6M6NJ1hL@zeniv-ca.linux.org.uk>
Date: Tue, 15 Feb 2022 13:37:40 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Miklos Szeredi <miklos@...redi.hu>
Cc: Xavier Roche <xavier.roche@...olia.com>,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
Subject: Re: race between vfs_rename and do_linkat (mv and link)
On Tue, Feb 15, 2022 at 10:56:29AM +0100, Miklos Szeredi wrote:
> Doing "lock_rename() + lookup last components" would fix this race.
No go - thanks to the possibility of AT_SYMLINK_FOLLOW there.
Think of it - we'd need to
* lock parents (both at the same time)
* look up the last component of source
* if it turns a symlink - unlock parents and repeat the entire
thing for its body, except when asked not to.
* when we are done with the source, look the last component of
target up
... and then there is sodding -ESTALE handling, with all the elegance
that brings in.
> If this was only done on retry, then that would prevent possible
> performance regressions, at the cost of extra complexity.
Extra compared to the above, that is. How delightful...
Powered by blists - more mailing lists