flock vs fnctl

Scott Adkins adkinss at ohio.edu
Tue Jul 22 16:22:10 EDT 2003


In version 2.0.16, flock() was being used for file locking.  However, in
2.2.1, I am wondering if this is still the case.  I looked in the configure
output of 2.0.16 and it detects the flock() function call, but in the output
of 2.2.1, it doesn't even look like it checks for flock().  Has the default
changed or the behavior for locking changed between those versions?  The
docs seem to indicate that flock() is still the default, if it is detected.

We noticed the change in behavior when we went from flat file format in
2.0.16 to skiplist format in 2.2.1 for the mailboxes.db file.  We were
playing around with renaming a user account with a lot of files and see
that it takes more than twice as long to rename the user account (from
one partition to another partition, same account name) using the skiplist
database.  Trussing the process, we see that it does about the same time
period for the actual traversing of the user directory trees, copying
files from one partition to another, deleting the old files off, etc etc.
However, after the imap server finishes with all the file/directory
related stuff for that user rename, it then procedes to work on the
mailboxes.db file.  It goes into this nearly endless loop where most of
the time is spent doing the following:

  stat("/var/imap/mailboxes.db", 0x000000011FFF9C88) = 0
  fcntl(7, F_SETLKW, 0x000000011FFF9D98)          = 0
  fcntl(7, F_SETLKW, 0x000000011FFF9C40)          = 0

(7 is the file descriptor associated with mailboxes.db currently opened
for read/write operations)

The user had 6 directories (5 folders directly under the INBOX folder)
and 704 files total (686 messages and 18 cyrus header/index/cache files).
Looking through the truss output, there were 1486 open operations that
involved the user account itself, generally, one for the file in the old
partition, and one for the file in the new partition.  There were 39
mkdir operations (6 of which actually succeeded... the other 33 were on
directories that already existed).  That all seems reasonable.

The problem is when it gets to mailboxes.db with the above 3 lines,
in which case it does those 3 calls consecutively 16,521 times!!!  I
have no idea what it is doing, and that is what I will be figuring
out tomorrow.  I don't know if this is related to the flock() (or the
lack of flock() being called) or not.

If anyone has any ideas, I would appreciate it.

Scott
-- 
 +-----------------------------------------------------------------------+
      Scott W. Adkins                http://www.cns.ohiou.edu/~sadkins/
   UNIX Systems Engineer                  mailto:adkinss at ohio.edu
        ICQ 7626282                 Work (740)593-9478 Fax (740)593-1944
 +-----------------------------------------------------------------------+
     PGP Public Key available at http://www.cns.ohiou.edu/~sadkins/pgp/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 231 bytes
Desc: not available
Url : https://lists.andrew.cmu.edu/mailman/private/info-cyrus/attachments/20030722/1685ee33/attachment.bin


More information about the Info-cyrus mailing list