Ignore:
Timestamp:
Jun 29, 2007, 1:34:14 PM (18 years ago)
Author:
Paul Smedley
Message:

Update source to 3.0.25b

File:
1 edited

Legend:

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

    r1 r44  
    264264        tdb->travlocks.lock_rw = F_RDLCK;
    265265
     266        /* Grab first record: locks chain and returned record. */
    266267        if (tdb_next_lock(tdb, &tdb->travlocks, &rec) <= 0)
    267268                return tdb_null;
     
    269270        key.dsize = rec.key_len;
    270271        key.dptr =tdb_alloc_read(tdb,tdb->travlocks.off+sizeof(rec),key.dsize);
    271         if (tdb_unlock(tdb, BUCKET(tdb->travlocks.hash), F_WRLCK) != 0)
     272
     273        /* Unlock the hash chain of the record we just read. */
     274        if (tdb_unlock(tdb, tdb->travlocks.hash, tdb->travlocks.lock_rw) != 0)
    272275                TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_firstkey: error occurred while tdb_unlocking!\n"));
    273276        return key;
     
    284287        /* Is locked key the old key?  If so, traverse will be reliable. */
    285288        if (tdb->travlocks.off) {
    286                 if (tdb_lock(tdb,tdb->travlocks.hash,F_WRLCK))
     289                if (tdb_lock(tdb,tdb->travlocks.hash,tdb->travlocks.lock_rw))
    287290                        return tdb_null;
    288291                if (tdb_rec_read(tdb, tdb->travlocks.off, &rec) == -1
     
    295298                                return tdb_null;
    296299                        }
    297                         if (tdb_unlock(tdb, tdb->travlocks.hash, F_WRLCK) != 0) {
     300                        if (tdb_unlock(tdb, tdb->travlocks.hash, tdb->travlocks.lock_rw) != 0) {
    298301                                SAFE_FREE(k);
    299302                                return tdb_null;
     
    307310        if (!tdb->travlocks.off) {
    308311                /* No previous element: do normal find, and lock record */
    309                 tdb->travlocks.off = tdb_find_lock_hash(tdb, oldkey, tdb->hash_fn(&oldkey), F_WRLCK, &rec);
     312                tdb->travlocks.off = tdb_find_lock_hash(tdb, oldkey, tdb->hash_fn(&oldkey), tdb->travlocks.lock_rw, &rec);
    310313                if (!tdb->travlocks.off)
    311314                        return tdb_null;
     
    325328                                          key.dsize);
    326329                /* Unlock the chain of this new record */
    327                 if (tdb_unlock(tdb, tdb->travlocks.hash, F_WRLCK) != 0)
     330                if (tdb_unlock(tdb, tdb->travlocks.hash, tdb->travlocks.lock_rw) != 0)
    328331                        TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_nextkey: WARNING tdb_unlock failed!\n"));
    329332        }
    330333        /* Unlock the chain of old record */
    331         if (tdb_unlock(tdb, BUCKET(oldhash), F_WRLCK) != 0)
     334        if (tdb_unlock(tdb, BUCKET(oldhash), tdb->travlocks.lock_rw) != 0)
    332335                TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_nextkey: WARNING tdb_unlock failed!\n"));
    333336        return key;
    334337}
    335 
Note: See TracChangeset for help on using the changeset viewer.