X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Flock-tracking.c;h=e253db9f710e6860ef2c4d7758daa5e010693a71;hp=ba09399219258d1cd2c56b28ca5c3b44a3447e18;hb=0b93bd102aad6b61f1e569fb12aabc6352a1d7cd;hpb=baa17ee2d5e01a32030f19e566007417d72b4b6e diff --git a/ccan/tdb2/test/lock-tracking.c b/ccan/tdb2/test/lock-tracking.c index ba093992..e253db9f 100644 --- a/ccan/tdb2/test/lock-tracking.c +++ b/ccan/tdb2/test/lock-tracking.c @@ -1,5 +1,5 @@ /* We save the locks so we can reaquire them. */ -#include +#include #include #include #include @@ -110,6 +110,17 @@ int fcntl_with_lockcheck(int fd, int cmd, ... /* arg */ ) i->type = F_WRLCK; goto done; } + /* allrecord upgrade for tdb1. */ + if (i->type == F_RDLCK && fl->l_type == F_WRLCK + && i->off == TDB1_FREELIST_TOP + && fl->l_start == TDB1_FREELIST_TOP + && i->len == 0 + && fl->l_len == 0) { + if (ret == 0) + i->type = F_WRLCK; + goto done; + } + if (!suppress_lockcheck) { diag("%s lock %u@%u overlaps %u@%u", fl->l_type == F_WRLCK ? "write" : "read",