GNU bug report logs -
#29961
[PATCH] mv: document the missing atomicity of 'mv -n'
Previous Next
Reported by: Kamil Dudka <kdudka <at> redhat.com>
Date: Wed, 3 Jan 2018 15:03:02 UTC
Severity: normal
Tags: patch
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
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.
> I will go with my conservative (or even the
> documentation-only) patch for RHEL-7, which was the trigger of this effort,
> because Paul's patch comes with changes of behavior observable beyond the
Sounds good.
[0001-mv-improve-n-atomicity.txt (text/plain, attachment)]
[0002-mv-fewer-syscalls-for-mv-a-b.txt (text/plain, attachment)]
[0003-mv-clarify-mv-n-A-A-change.txt (text/plain, attachment)]
This bug report was last modified 7 years and 139 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.