IETF-SSH archive

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

Re: sftp rename not good.



Alfred Perlstein wrote:

> That's the cause of the problem.
> 
> The actual problem is that it doesn't seem possible to do atomic
> updates of files using sftp because of the way SSH_FXP_RENAME must
> be implemented.
> 
> Also, I _think_ that using link(2) (without fsync) instead of
> rename(2) allows for the system to lose the file completely
> during an outtage.

No, there is always at least one link to the file during the usual
sequence of events:

if (!exists(new))
	link(old, new)
	unlink(old)

Unless you are using some idiot filesystem that writes out directory
changes asynchronously (not mentioning any names...)

-d




Home | Main Index | Thread Index | Old Index