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

Re: Distinct transactions (MV vs rename())?



Hi,

On Tue, Sep 11, 2001 at 05:20:44PM -0700, KRELLE,BRIAN (HP-Roseville,ex1) wrote:

> I was rooting around in the MV code.  It seems to perform an unlink()
> then a link() if the filename already exists (Theodore Tso please
> correct me if I'm wrong).  This implies to me there is a moment where
> the filename (i.e. "current") is not in the directory.

$ touch a
$ touch b
$ strace mv a b
[...]
stat64("b", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
lstat64("a", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
lstat64("b", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
rename("a", "b")                        = 0
_exit(0)                                = ?
$

Seems to be atomic to me.

Cheers,
 Stephen





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