One other thing we could do is add a dsa_is_attached() function and then ERROR if you try to reattach an already-attached DSA/dshash. I've done this in the attached patch.
Sounds good. Not a problem of this patch but it would be great if we had dsa equivalent of dsm_find_mapping that could actually return a backend local reference of the dsa_area.