[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dh_movefiles, tar vs. mv

On Fri, Feb 25, 2005 at 01:14:00PM -0500, Daniel Burrows wrote:

>   Anyway, I thought you were joking in your first message, but it looks like 
> you're serious, so I'll answer this time.  If you're copying between files on 
> the same device, mv will use the rename(2) system call, which is an atomic 
> operation:

Well, if we are nitpicking, then rename(2) is atomic only in the sense
that after it returns, you can either access the old name (if rename
failed) or the new name (if it succeeded) (modulo of course journaling,
disk write cache, yadda yadda if you want to extend the atomicity over a

_But_ it is not neccessarily atomic wrt. other operations, especially
getdents(2). So it is equally possible that a readdir(3) during the
rename(2) returns the old name, the new name, both or neither, depending
on file system implementation and how the parent directory(/ies) is(/are)
actually allocated on the disk. Not very important for dh_install, though


     MTA SZTAKI Computer and Automation Research Institute
                Hungarian Academy of Sciences

Reply to: