Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Nov 2005 21:00:00 +0000 (UTC)
From:      "Christian S.J. Peron" <csjp@FreeBSD.org>
To:        src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   cvs commit: src/usr.bin/lockf lockf.c
Message-ID:  <200511122100.jACL00H4051131@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
csjp        2005-11-12 21:00:00 UTC

  FreeBSD src repository

  Modified files:        (Branch: RELENG_6)
    usr.bin/lockf        lockf.c 
  Log:
  Sync with head:
  
  -style(9) nits
  
  MFC Log:
    Fix long standing race condition associated with how lockf uses open(2)
    for mutual exclusion:
  
    A brief description of the problem:
  
            1) Proc A picks up non-blocking lock on file X
            2) Proc B attempts to pickup lock, fails then waits
            3) Proc C attempts to pickup lock, fails then waits
            4) Proc A releases lock
            5) Proc B acquires lock, release it to pickup a non-blocking version
            6) Proc C acquires lock, release it to pickup a non-blocking version
            7) Both process B and C race each other to pickup lock again
  
    This occurs mainly because the processes do not keep the lock after they have
    been waiting on it. They drop it, attempt to re-acquire it. (They use the wait
    to notify when the lock has become available then race to pick it up). This
    results in additional CPU utilization during the race, and can also result
    in processes picking locks up out of order.
  
    This change attempts to correct this problem by eliminating the test/acquire
    race and having the operating system handle it.
  
  Revision  Changes    Path
  1.11.8.1  +93 -130   src/usr.bin/lockf/lockf.c



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200511122100.jACL00H4051131>