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

Jack Schmidt dovecot at mowsey.org
Wed Jan 23 16:20:45 EET 2008


Howdy,

Here is a problem with fix affecting dovecot-1.0.10 (and 1.1rc13).

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

This causes problems in editing subscriptions, as the new subscription 
list is still open for writing before it is renamed in:
   lib-storage/subscription-file/subscription-file.c line 169
in dovecot version 1.0.10 (and 1.1rc13)

This is an unpatched linux 2.6.21-5, CIFS mounted filesystem from a 
windows 2003 sp2 server.

The documentation for rename(2) indicates that it is allowed to return 
an error when the file is already opened, so perhaps the file should be 
closed before the replace.  Should this be done in file_dotlock_replace 
(before line 672) generally?

Here is a patch that does so:
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dovecot-rename.diff
Url: http://dovecot.org/pipermail/dovecot/attachments/20080123/c0e84a31/attachment.pl 


More information about the dovecot mailing list