[Dovecot] Rename file opened for read-write -- cannot edit subscriptions

Timo Sirainen tss at iki.fi
Thu Jan 31 17:52:26 EET 2008


On Wed, 2008-01-23 at 09:20 -0500, Jack Schmidt wrote:
> On a linux system's CIFS mounted filesystem, it is not possible to 
> rename a file opened read-write:
> 
> $ sleep 5 >> .subscriptions.lock & mv .subscriptions.lock .subscriptions
> mv: cannot move `.subscriptions.lock' to `.subscriptions': Text file busy

Does this happen only if the file is opened by the same process, or also
if it's opened by another process? Sounds like it happens no matter who
has the file open.

> The documentation for rename(2) indicates that it is allowed to return 
> an error when the file is already opened,

I don't see it saying that in Debian unstable or in UNIX98 specs.

> so perhaps the file should be 
> closed before the replace.  Should this be done in file_dotlock_replace 
> (before line 672) generally?

This is a similar patch than I've previously suggested to people having
similar NFS problems:
http://dovecot.org/list/dovecot/2006-December/018145.html

But I don't really want to make it work like that as default. It most
likely doesn't fix all the possible places in code where this can
happen. Or if this same problem happens when another process has the
file opened, this doesn't help with it either. So if someone is using a
system where this is a problem, I'd rather have them patch this code
themselves so they know that Dovecot may not always work correctly.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20080131/0a2cf3c3/attachment.bin 


More information about the dovecot mailing list