tdb: fix lock-tracking test code after gradual lock changes.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 30 Aug 2010 01:11:57 +0000 (10:41 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 30 Aug 2010 01:11:57 +0000 (10:41 +0930)
ccan/tdb/test/lock-tracking.c

index 8c0c86c948b0151d4438cd6bb9f162721cf6d480..8460c048dfcfb74d929153118293572162a78543 100644 (file)
@@ -70,6 +70,12 @@ int fcntl_with_lockcheck(int fd, int cmd, ... /* arg */ )
                                break;
                        if (fl_end >= i->off && fl_end < i_end)
                                break;
+
+                       /* tdb_allrecord_lock does this, handle adjacent: */
+                       if (fl->l_start == i_end && fl->l_type == i->type) {
+                               i->len = fl->l_len ? i->len + fl->l_len : 0;
+                               goto ok;
+                       }
                }
                if (i) {
                        /* Special case: upgrade of allrecord lock. */