There are a number of tickets (
HDFS-10742, HDFS-10817, HDFS-10713, this subtask's story HDFS-10475) which are adding/improving logging/metrics around the FSNamesystemLock. All of this is done in FSNamesystem right now, which is polluting the namesystem with ThreadLocal variables, timing counters, etc. which are only relevant to the lock itself and the number of these increases as the logging/metrics become more sophisticated. It would be best to move these all into FSNamesystemLock to keep the metrics/logging tied directly to the item of interest.