X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb%2Flock.c;h=664081932c70e1ad42fd1df762e249f94ff2ed92;hp=e6b900e419ea00a5b2610ec0ee939157ba665431;hb=e9cc05b230fca341c6a27ea0efd6d749d95b5da7;hpb=b2c0ebc6f53b05b222937991f100f8a89701f9b1 diff --git a/ccan/tdb/lock.c b/ccan/tdb/lock.c index e6b900e4..66408193 100644 --- a/ccan/tdb/lock.c +++ b/ccan/tdb/lock.c @@ -158,12 +158,11 @@ int tdb_brlock(struct tdb_context *tdb, } while (ret == -1 && errno == EINTR); if (ret == -1) { + tdb->ecode = TDB_ERR_LOCK; /* Generic lock error. errno set by fcntl. * EAGAIN is an expected return from non-blocking * locks. */ if (!(flags & TDB_LOCK_PROBE) && errno != EAGAIN) { - /* Ensure error code is set for log fun to examine. */ - tdb->ecode = TDB_ERR_LOCK; TDB_LOG((tdb, TDB_DEBUG_TRACE,"tdb_brlock failed (fd=%d) at offset %d rw_type=%d flags=%d len=%d\n", tdb->fd, offset, rw_type, flags, (int)len)); } @@ -508,7 +507,7 @@ static int _tdb_unlockall(struct tdb_context *tdb, int ltype, bool mark_lock) } if (!mark_lock && - tdb->methods->brunlock(tdb, F_WRLCK, + tdb->methods->brunlock(tdb, ltype, FREELIST_TOP, 4*tdb->header.hash_size)) { TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_unlockall failed (%s)\n", strerror(errno))); return -1;