[dm-cache] Fix a lock inversion.

When suspending a cache the policy was being walked and the individual
hints written to the metadata.  This led to this lock order:

      policy->lock
        cache_metadata->lock

When loading the cache target the policy was populated while the
metadata lock was held:

      cache_metadata->lock
         policy->lock

Fixed by ensuring the cache_metadata lock is held whilst all the hints
are written, rather than being repeatedly locked.

Found by turning on "Lock checking: prove locking correctness" build
option.  I can't see how it can lead to a deadlock however since the
two paths, suspending a target and loading a target, never occur at
the same time.