tux3: Fix alloc_cursor() locking for read

While frontend waiting lock for btree, backend can add the new depth.

          frontend                          backend

    alloc_cursor(btree, 0)
                                      btree_write()
                                          /* adds new depth */
    btree_probe()

If this race happens, cursor doesn't have enough space for depth. This
patch fixes by taking lock before allocating cursor.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
2 files changed