[PATCH] Prepare for LMDB by improving ldb_tdb and Samba callers

jim jim.brown at rsmas.miami.edu
Wed Apr 4 00:04:54 UTC 2018


The first tdb_transaction_active() should be 
!tdb_transaction_active(ltdb->tdb) instead of ... == false. It is boolean.

On 4/3/2018 7:43 PM, Andrew Bartlett via samba-technical wrote:
> --- a/lib/ldb/ldb_tdb/ldb_tdb.c
> +++ b/lib/ldb/ldb_tdb/ldb_tdb.c
> @@ -101,7 +101,7 @@ static int ltdb_lock_read(struct ldb_module *module)
>   	int tdb_ret = 0;
>   	int ret;
>   
> -	if (ltdb->in_transaction == 0 &&
> +	if (tdb_transaction_active(ltdb->tdb) == false &&
>   	    ltdb->read_lock_count == 0) {
>   		tdb_ret = tdb_lockall_read(ltdb->tdb);
>   	}
> @@ -128,7 +128,7 @@ static int ltdb_unlock_read(struct ldb_module *module)
>   {
>   	void *data = ldb_module_get_private(module);
>   	struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
> -	if (ltdb->in_transaction == 0 && ltdb->read_lock_count == 1) {
> +	if (!tdb_transaction_active(ltdb->tdb) && ltdb->read_lock_count == 1) {

Same change for these other two occurrences.

On 4/3/2018 7:43 PM, Andrew Bartlett via samba-technical wrote:
> @@ -379,7 +379,7 @@ static int ltdb_modified(struct ldb_module *module, struct ldb_dn *dn)
>   
>   	/* only allow modifies inside a transaction, otherwise the
>   	 * ldb is unsafe */
> -	if (ltdb->in_transaction == 0) {
> +	if (ltdb->kv_ops->transaction_active(ltdb) == false) {

On 4/3/2018 7:43 PM, Andrew Bartlett via samba-technical wrote:
> @@ -1890,6 +1888,11 @@ static int ltdb_tdb_parse_record(struct ltdb_private *ltdb,
>   	};
>   	int ret;
>   
> +	if (tdb_transaction_active(ltdb->tdb) == false &&
> +	    ltdb->read_lock_count == 0) {




More information about the samba-technical mailing list