tdb: avoid many fcntl calls when incrementing seqnum
authorBob Campbell <bobcampbell@catalyst.net.nz>
Wed, 29 Jun 2016 21:51:23 +0000 (09:51 +1200)
committerJeremy Allison <jra@samba.org>
Sun, 3 Jul 2016 16:11:29 +0000 (18:11 +0200)
Signed-off-by: Bob Campbell <bobcampbell@catalyst.net.nz>
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Pair-programmed-with: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Jul  3 18:11:30 CEST 2016 on sn-devel-144

lib/tdb/common/tdb.c

index 9885d8c..dd93680 100644 (file)
@@ -59,6 +59,11 @@ static void tdb_increment_seqnum(struct tdb_context *tdb)
                return;
        }
 
+       if (tdb->transaction != NULL) {
+               tdb_increment_seqnum_nonblock(tdb);
+               return;
+       }
+
        if (tdb_nest_lock(tdb, TDB_SEQNUM_OFS, F_WRLCK,
                          TDB_LOCK_WAIT|TDB_LOCK_PROBE) != 0) {
                return;