MDL-36959 rework adding of content files to the file pool

This patch includes refreshing of borked files in file pool and basic prevention of race conditions. It also helps with diagnosing of file pool permission problems, detects coding errors and some other type of problems including sha1 collision jackpot.
MDL-36959 test reworked adding of files to sha1 content pool