mirror of
https://github.com/samba-team/samba.git
synced 2025-02-23 09:57:40 +03:00
tdb: allow tdb_open_ex() with O_RDONLY of TDB_FEATURE_FLAG_MUTEX tdbs.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10781 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
This commit is contained in:
parent
553b83c4d5
commit
c8d05e934e
@ -232,6 +232,14 @@ static bool tdb_mutex_open_ok(struct tdb_context *tdb,
|
||||
{
|
||||
int locked;
|
||||
|
||||
if (tdb->flags & TDB_NOLOCK) {
|
||||
/*
|
||||
* We don't look at locks, so it does not matter to have a
|
||||
* compatible mutex implementation. Allow the open.
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
locked = tdb_nest_lock(tdb, ACTIVE_LOCK, F_WRLCK,
|
||||
TDB_LOCK_NOWAIT|TDB_LOCK_PROBE);
|
||||
|
||||
@ -261,14 +269,6 @@ static bool tdb_mutex_open_ok(struct tdb_context *tdb,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tdb->flags & TDB_NOLOCK) {
|
||||
/*
|
||||
* We don't look at locks, so it does not matter to have a
|
||||
* compatible mutex implementation. Allow the open.
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
check_local_settings:
|
||||
|
||||
if (!(tdb->flags & TDB_MUTEX_LOCKING)) {
|
||||
@ -399,7 +399,7 @@ _PUBLIC_ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int td
|
||||
tdb->read_only = 1;
|
||||
/* read only databases don't do locking or clear if first */
|
||||
tdb->flags |= TDB_NOLOCK;
|
||||
tdb->flags &= ~TDB_CLEAR_IF_FIRST;
|
||||
tdb->flags &= ~(TDB_CLEAR_IF_FIRST|TDB_MUTEX_LOCKING);
|
||||
}
|
||||
|
||||
if ((tdb->flags & TDB_ALLOW_NESTING) &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user