Lock before 2i tmp build and report error to user

Now the lock on the tree is acquired before the partition is scanned for
2i data. If a single partition is being repaired, a failured to acquire
a lock is immediately reported to the user. As suggested by Joe B.