[Asterisk-Users] Outgoing spool file ignored

Peter Svensson psvasterisk at psv.nu
Tue May 17 02:44:49 MST 2005


On Tue, 17 May 2005, tim panton wrote:

> The 'if possible' thing relates to filesystem design.
> Almost all of the native UNIX filesystems support mv as an atomic action
> - but only within the same filesystem.
> (Imagine you create the file on one physical disk then 'move' it
> onto a different disk - the kernel has no option but to
> copy the file).

A Posix-compliant filesystem has to perform moves as an atomic operation. 
The removal of the old file name and the creation of the new file name 
will from the point of view of any process be simultaneous. Also, if the 
destination file name exists that name will refer either to the old file 
or the new, there is no window where neither file or an incomplete file is 
visible to a process.

Moves are not defined across mount points. The kernel will never actually
copy the file when move is calld. That is implemented in use space by e.g.
"mv" in fileustils etc.

> So create your file in a temp directory on the _same_ file system as
> the destination, then do the move.
> 
> If your filesystem is remote (samba or nfs) or non unix native (FAT)
> then it just won't work.

Nfs is a posix filesystem -> moves withing a device are guaranteed to be 
atomic. I think is is defined for smb as well, though there may be 
restrictions and the atomicity may not be guaranteed.

Moves are defined and do work with the fat filesystem under linux. 

Peter





More information about the asterisk-users mailing list