data-sort: lookup under b->lock

This fixes race between prepare and datasort that can swap underlying
offsets of "old" record