~csurbhi/junk/mdadm.fixes

Viewing all changes in revision 18.

  • Committer: Surbhi Palande
  • Date: 2010-10-05 10:24:58 UTC
  • Revision ID: git-v1:09af12d8354be3b90724357c67076a8116004e65
Fixed locking

When lockf is used for locking, the lock is released when you close the file.
So, when the file is closed, the process waiting for a lock gets it, but
thereafter the file is unlinked. So when another process asks for a lock on
the same file, it too gets the lock on a new file that it creates. Hence we
have two processes having a lock, one process with a lock on the stale file
and the other on a fresh new one. This breaks our locking scheme. So we
changed the locking to flock() and check if the file is stale using the stat()
and by unlinking the file before closing.

Signed-off-by: Surbhi Palande <surbhi.palande@canonical.com>

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: