get_metadata needs path lock to avoid issues, e.g. with a concurrent purge.