Changeset 836 for branches/samba-3.5.x/lib/tdb/common/io.c
- Timestamp:
- Nov 25, 2013, 6:40:10 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.5.x/lib/tdb/common/io.c
r599 r836 93 93 // YD we must upgrade read locks to write locks (exclusive), otherwise 94 94 // the owner (us) is not allowed to write to the file (different from unix) 95 TDB_LOG((tdb, TDB_DEBUG_TRACE,"unlocking at %d len=%d before writing.\n", off, len));96 tdb_brlock( tdb, off, F_UNLCK, F_SETLK, 0, 1);97 95 // if a wider previous lock is in effect, we cannot write lock our segment 98 96 // (e.g. a lock_upgrade locks all the file), so we hope the previous lock 99 97 // is a write lock: do not wait for lock. 100 tdb_brlock( tdb, off, F_WRLCK, F_SETLK, 0, len); 98 int upgradeLockRC = tdb_brlock( tdb, off, F_WRLCK, F_SETLK, 0, len); 99 TDB_LOG((tdb, TDB_DEBUG_TRACE,"upgrading lock at %d len=%d " 100 "before writing %s (rc=%d).\n", off, len, 101 upgradeLockRC ? "was successfull":"failed", upgradeLockRC)); 101 102 #endif 102 103 … … 127 128 len, off)); 128 129 129 #ifdef __OS2__ // remove our lock 130 tdb_brlock( tdb, off, F_UNLCK, F_SETLK, 0, len); 130 #ifdef __OS2__ // remove our lock, if upgrade succeded 131 if (upgradeLockRC == 0) 132 tdb_brlock( tdb, off, F_UNLCK, F_SETLK, 0, len); 131 133 #endif 132 134 return -1; … … 134 136 } 135 137 136 #ifdef __OS2__ // remove our lock 137 tdb_brlock( tdb, off, F_UNLCK, F_SETLK, 0, len); 138 #ifdef __OS2__ // remove our lock, if upgrade succeded 139 if (upgradeLockRC == 0) 140 tdb_brlock( tdb, off, F_UNLCK, F_SETLK, 0, len); 138 141 #endif 139 142
Note:
See TracChangeset
for help on using the changeset viewer.