tdb_compat: change offset of CLEAR_IF_FIRST lock.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 13 Sep 2011 22:43:28 +0000 (08:13 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 14 Sep 2011 00:21:29 +0000 (02:21 +0200)
This makes it match tdb1, which mean it will Just Work as TDB2 gets
tdb1 format support.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Wed Sep 14 02:21:29 CEST 2011 on sn-devel-104

lib/tdb_compat/tdb_compat.c

index 6e4813b56e3f7874c505a3621295ea6477409e0f..fd3a68717ad37120a76166a998f724ce6b77e8d2 100644 (file)
@@ -63,12 +63,12 @@ int64_t tdb_traverse_read_(struct tdb_context *tdb,
  */
 static enum TDB_ERROR clear_if_first(int fd, void *unused)
 {
-       /* We hold a lock offset 63 always, so we can tell if anyone else is. */
+       /* We hold a lock offset 4 always, so we can tell if anyone else is. */
        struct flock fl;
 
        fl.l_type = F_WRLCK;
        fl.l_whence = SEEK_SET;
-       fl.l_start = 63;
+       fl.l_start = 4; /* ACTIVE_LOCK */
        fl.l_len = 1;
 
        if (fcntl(fd, F_SETLK, &fl) == 0) {