On Thu, 23 May 2013 13:25:55 +0000, Ramkumar Ramachandra wrote:
> Junio C Hamano wrote:
> >     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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to