Re: [PATCH 0/3] Fixing volatile HEAD in push.default = current
From: Andreas Krey <hidden>
Date: 2016-06-15 22:57:25
On Thu, 23 May 2013 13:25:55 +0000, Ramkumar Ramachandra wrote:
Junio C Hamano wrote:quoted
I have "largedir" I want to get rid of, but there is a directory I want to save, "largedir/precious", in it, so I do cp -R largedir/precious precious and then run 'rm -rf largedir' in another terminal in parallel.
'mv largedir/precious precious; rm -rf largedir'? No race here. ...
Consider a slightly different example: I rename a file while having an active file handle open in a process that's reading the file. Will the rename fail or will the fread() in the process fail? Nope, both work fine. Replace "rename" with "remove", and we still have the same answer. Ofcourse there are no guarantees: I can start up another process to overwrite the sectors corresponding to that file's data with zeros; unless the complete file is there in the kernel buffer, a read() will eventually end up slurping in the zeros (or fail?), right?
Oh, there are guarantees, they just don't include the case where you take a shotgun to the disk. (Or do it on an nfs mount and delete the file from another machine.) ... Andreas -- "Totally trivial. Famous last words." From: Linus Torvalds <torvalds@*.org> Date: Fri, 22 Jan 2010 07:29:21 -0800