DragonFly submit List (threaded) for 2009-07
DragonFly BSD
DragonFly submit List (threaded) for 2009-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: dma(8): Fix race condition in multi-recipient delivery


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 19 Jul 2009 11:11:41 -0700 (PDT)

    flock locks are effective lockf locks but cover the ENTIRE range.
    It is not a good idea to try to combine them.  Use one or the other.

    lockf locks (via fcntl) follow POSIX semanics, I believe, which means
    that when you close() a descriptor, ANY LOCK HELD BY THAT PROCESS ON
    THAT FILE will also be released, even if it was obtained by another 
    descriptor.  This is badly broken but its what POSIX says and what we
    have to do.

    If you are fork()ing you want to be sure that you only have one file
    descriptor open for the file that you intend to maintain a lock on.
    If you open/close the file within that same process the original lock
    on the still-open descriptor will be lost.  For fcntl-based lockf locks.

    I believe flock() behaves more rationally.

					-Matt




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