X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb%2Fopen.c;h=d1a34bf1a2a47172fb4d534c134d0fb52aeeec29;hp=64782df7fc016963a3d22dee884ce3b937a972f6;hb=1d03cc6df3b4f5c8174096ae3411527f266f9a97;hpb=d6b6780d0bc3dbdaaf679bbc308f74042f933cfd diff --git a/ccan/tdb/open.c b/ccan/tdb/open.c index 64782df7..d1a34bf1 100644 --- a/ccan/tdb/open.c +++ b/ccan/tdb/open.c @@ -240,8 +240,8 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, fcntl(tdb->fd, F_SETFD, v | FD_CLOEXEC); /* ensure there is only one process initialising at once */ - if (tdb->methods->brlock(tdb, F_WRLCK, GLOBAL_LOCK, 1, TDB_LOCK_WAIT) == -1) { - TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: failed to get global lock on %s: %s\n", + if (tdb->methods->brlock(tdb, F_WRLCK, OPEN_LOCK, 1, TDB_LOCK_WAIT) == -1) { + TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: failed to get open lock on %s: %s\n", name, strerror(errno))); goto fail; /* errno set by tdb_brlock */ } @@ -355,8 +355,8 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, internal: /* Internal (memory-only) databases skip all the code above to * do with disk files, and resume here by releasing their - * global lock and hooking into the active list. */ - if (tdb->methods->brunlock(tdb, F_WRLCK, GLOBAL_LOCK, 1) == -1) + * open lock and hooking into the active list. */ + if (tdb->methods->brunlock(tdb, F_WRLCK, OPEN_LOCK, 1) == -1) goto fail; tdb->next = tdbs; tdbs = tdb; @@ -461,7 +461,7 @@ static int tdb_reopen_internal(struct tdb_context *tdb, bool active_lock) return 0; /* Nothing to do. */ } - if (tdb->num_locks != 0 || tdb->global_lock.count) { + if (tdb->num_locks != 0 || tdb->allrecord_lock.count) { TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_reopen: reopen not allowed with locks held\n")); goto fail; }