On 05/01/18 22:59, Paul Eggert wrote: > On 01/05/2018 08:19 AM, Kamil Dudka wrote: > >> I am only fixing the case where the destination file is created after the >> lstat() call. In that case, the only result is ENOENT, which is harmless. >> > > Ah, you're right. Sorry, I misread your patch. It should work. > >> On Friday, January 5, 2018 4:29:55 PM CET Pádraig Brady wrote: >> >>> Paul's also avoids a stat() in the common case >>> where the initial renameat2() succeeds. >> At the cost of _not_ avoiding the renameat2() call in the most common case. > > I expect that the most common case is 'mv A B' where B does not already > exist. This is the case that avoids the stat of B. > > Come to think of it, we don't need to stat A either, when the initial > renameat2 succeeds. Attached is a revised proposed patchset to do that. > The first is the same as before; the second causes 'mv A B' to issue > just a renameat2 syscall (with no calls to stat) in the common case > where A exists and B does not.
This second patch looks good also. thanks, Pádraig.