In my case, this infinite loop was started when one datanode went down and the namenode started replicating. Does this mean, namenode will keep on trying until someone access the file and notice that it's corrupted?
Yes, if there is no valid replica. In your case it is not clear if all the replicas are corrupted.
With this patch, Namenode will try all the remaining replicas for replicating a block.
If none of these succeed (because all the replicas are corrupted), there is not much
Namenode can do about it. It will just keep on trying (evey 10 min) eventually someone
will notice the error.
In your case, if there is a good replica, it will be used in subsequent retries.