Ignore:
Timestamp:
Aug 20, 2007, 10:37:46 PM (18 years ago)
Author:
Yuri Dario
Message:

More changes for locking problems:

  • reopen semaphore handles for new processes;
  • remove locks done after using exclusive locks with semaphores;
  • more logging;
  • upgrade read locks to write (exclusive) locks before writing to file (this makes real

unlocks to fail, fixme);

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/samba/source/tdb/common/transaction.c

    r30 r61  
    436436        /* get a read lock from the freelist to the end of file. This
    437437           is upgraded to a write lock during the commit */
     438#ifndef __OS2__ // YD the transation lock is an exclusive lock for us, it is enough.
    438439        if (tdb_brlock(tdb, FREELIST_TOP, F_RDLCK, F_SETLKW, 0, 0) == -1) {
    439440                TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_start: failed to get hash locks\n"));
     
    441442                goto fail;
    442443        }
     444#endif
    443445
    444446        /* setup a copy of the hash table heads so the hash scan in
     
    479481       
    480482fail:
     483#ifndef __OS2__ // YD the transation lock is an exclusive lock for us, it is enough.
    481484        tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW, 0, 0);
     485#endif
    482486        tdb_brlock(tdb, TRANSACTION_LOCK, F_UNLCK, F_SETLKW, 0, 1);
    483487        SAFE_FREE(tdb->transaction->hash_heads);
     
    534538        tdb->methods = tdb->transaction->io_methods;
    535539
     540#ifndef __OS2__ // YD the transation lock is an exclusive lock for us, it is enough.
    536541        tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW, 0, 0);
     542#endif
    537543        tdb_brlock(tdb, TRANSACTION_LOCK, F_UNLCK, F_SETLKW, 0, 1);
    538544        SAFE_FREE(tdb->transaction->hash_heads);
     
    822828
    823829        /* upgrade the main transaction lock region to a write lock */
     830#ifndef __OS2__ // YD the global lock is an exclusive lock for us, it is enough.
    824831        if (tdb_brlock_upgrade(tdb, FREELIST_TOP, 0) == -1) {
    825832                TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_start: failed to upgrade hash locks\n"));
     
    828835                return -1;
    829836        }
     837#endif
    830838
    831839        /* get the global lock - this prevents new users attaching to the database
Note: See TracChangeset for help on using the changeset viewer.