Changeset 847 for branches/samba-3.5.x/lib/tdb/common/io.c
- Timestamp:
- Feb 14, 2014, 7:01:54 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.5.x/lib/tdb/common/io.c
r836 r847 91 91 92 92 #ifdef __OS2__ 93 // YD we must upgrade read locks to write locks (exclusive), otherwise93 // YD we must upgrade read locks to write locks (exclusive), as otherwise 94 94 // the owner (us) is not allowed to write to the file (different from unix) 95 95 // if a wider previous lock is in effect, we cannot write lock our segment 96 96 // (e.g. a lock_upgrade locks all the file), so we hope the previous lock 97 97 // is a write lock: do not wait for lock. 98 int upgradeLockRC = tdb_brlock( tdb, off, F_WRLCK, F_SETLK, 0, len); 98 // so this is what we try here: 99 // 1. add a write lock and see if it works 100 // 2. if the write lock wasn't set, we try to unlock the segment 101 // first and add the write lock afterwards 102 int upgradeLockRC = 0; 103 upgradeLockRC = tdb_brlock( tdb, off, F_WRLCK, F_SETLK, 0, len); 104 if (upgradeLockRC != 0) { 105 tdb_brlock(tdb, off, F_UNLCK, F_SETLK, 0, len); 106 upgradeLockRC = tdb_brlock(tdb, off, F_WRLCK, F_SETLK, 0, len); 107 } 99 108 TDB_LOG((tdb, TDB_DEBUG_TRACE,"upgrading lock at %d len=%d " 100 109 "before writing %s (rc=%d).\n", off, len, 101 upgradeLockRC ? " was successfull":"failed", upgradeLockRC));110 upgradeLockRC ? "failed":"was successfull", upgradeLockRC)); 102 111 #endif 103 112 … … 137 146 138 147 #ifdef __OS2__ // remove our lock, if upgrade succeded 139 140 148 if (upgradeLockRC == 0) 149 tdb_brlock( tdb, off, F_UNLCK, F_SETLK, 0, len); 141 150 #endif 142 151
Note:
See TracChangeset
for help on using the changeset viewer.