Commit a39bf3ac authored by Rusty Russell's avatar Rusty Russell

tdb2: allow read-only databases to use locking.

You can always specify the TDB_NOLOCK flag along with O_RDONLY for the old
behaviour.
parent 78bb1258
......@@ -452,12 +452,6 @@ enum TDB_ERROR tdb_allrecord_lock(struct tdb_context *tdb, int ltype,
enum TDB_ERROR ecode;
tdb_bool_err berr;
/* FIXME: There are no locks on read-only dbs */
if (tdb->read_only) {
return tdb_logerr(tdb, TDB_ERR_LOCK, TDB_LOG_USE_ERROR,
"tdb_allrecord_lock: read-only");
}
if (tdb->allrecord_lock.count
&& (ltype == F_RDLCK || tdb->allrecord_lock.ltype == F_WRLCK)) {
tdb->allrecord_lock.count++;
......
......@@ -245,8 +245,6 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags,
if ((open_flags & O_ACCMODE) == O_RDONLY) {
tdb->read_only = true;
/* read only databases don't do locking */
tdb->flags |= TDB_NOLOCK;
tdb->mmap_flags = PROT_READ;
} else {
tdb->read_only = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment