Similar to the work done in
HDFS-4591 to avoid having to take a write lock before checking if an operation category is allowed, we can do the same for the write lock that is taken sometimes (when updating access time) within getBlockLocations.
This is particularly useful when using the standby read feature (
HDFS-12943), as it will be the case on an observer node that the operationCategory(READ) check succeeds but the operationCategory(WRITE) check fails. It would be ideal to fail this check before acquiring the write lock.