1. 22 Feb, 2010 7 commits
    • Rusty Russell's avatar
      tdb: cleanup: tdb_have_extra_locks() helper · d92b8a7d
      Rusty Russell authored
      In many places we check whether locks are held: add a helper to do this.
      
      The _tdb_lockall() case has already checked for the allrecord lock, so
      the extra work done by tdb_have_extra_locks() is merely redundant.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      d92b8a7d
    • Rusty Russell's avatar
      tdb: don't suppress the transaction lock because of the allrecord lock. · 57c618f3
      Rusty Russell authored
      tdb_transaction_lock() and tdb_transaction_unlock() do nothing if we
      hold the allrecord lock.  However, the two locks don't overlap, so
      this is wrong.
      
      This simplification makes the transaction lock a straight-forward nested
      lock.
      
      There are two callers for these functions:
      1) The transaction code, which already makes sure the allrecord_lock
         isn't held.
      2) The traverse code, which wants to stop transactions whether it has the
         allrecord lock or not.  There have been deadlocks here before, however
         this should not bring them back (I hope!)
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      57c618f3
    • Rusty Russell's avatar
      tdb: cleanup: tdb_nest_lock/tdb_nest_unlock · acf1a21e
      Rusty Russell authored
      Because fcntl locks don't nest, we track them in the tdb->lockrecs array
      and only place/release them when the count goes to 1/0.  We only do this
      for record locks, so we simply place the list number (or -1 for the free
      list) in the structure.
      
      To generalize this:
      
      1) Put the offset rather than list number in struct tdb_lock_type.
      2) Rename _tdb_lock() to tdb_nest_lock, make it non-static and move the
         allrecord check out to the callers (except the mark case which doesn't
         care).
      3) Rename _tdb_unlock() to tdb_nest_unlock(), make it non-static and
         move the allrecord out to the callers (except mark again).
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      acf1a21e
    • Rusty Russell's avatar
      tdb: cleanup: rename global_lock to allrecord_lock. · 1d03cc6d
      Rusty Russell authored
      The word global is overloaded in tdb.  The global_lock inside struct
      tdb_context is used to indicate we hold a lock across all the chains.
      
      Rename it to allrecord_lock.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      1d03cc6d
    • Rusty Russell's avatar
      tdb: cleanup: rename GLOBAL_LOCK to OPEN_LOCK. · 05f69a47
      Rusty Russell authored
      The word global is overloaded in tdb.  The GLOBAL_LOCK offset is used at
      open time to serialize initialization (and by the transaction code to block
      open).
      
      Rename it to OPEN_LOCK.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      05f69a47
    • Rusty Russell's avatar
      tdb: commit 9b987e3923f7e8714acec6a2929435b1e6016645 from SAMBA · ec4174af
      Rusty Russell authored
      Author: Volker Lendecke <vl@samba.org>
      Date:   Tue Aug 12 22:31:52 2008 +0200
      
          Attempt to fix bug 5684
          
          With the ctdb checkin dde9f3f006 tdb optimized out write lock checks for
          write-enabled transaction. Sadly, this also removed the possibility to ever
          remove dead records left over from tdb_delete calls within a transaction.
          
          Tridge, please check this! Did dde9f3f006 have any reason beyond performance
          optimizations?
          
          Thanks,
          
          Volker
          (This used to be commit 3f884c4ae36f3260e63626bdd4989d9258ae6497)
      ec4174af
    • Rusty Russell's avatar
      tdb: port trivial differences across from SAMBA · d6b6780d
      Rusty Russell authored
      Whitespace and C++-compatibility mainly.
      d6b6780d
  2. 11 Feb, 2010 1 commit
  3. 04 Feb, 2010 4 commits
  4. 02 Feb, 2010 11 commits
  5. 01 Feb, 2010 2 commits
  6. 23 Jan, 2010 1 commit
  7. 20 Jan, 2010 1 commit
  8. 19 Jan, 2010 1 commit
  9. 18 Jan, 2010 1 commit
  10. 17 Jan, 2010 1 commit
  11. 13 Jan, 2010 2 commits
  12. 06 Jan, 2010 5 commits
  13. 21 Nov, 2009 2 commits
  14. 19 Nov, 2009 1 commit