The afr_sh_has_*_pending pending functions, which were clearly copied from one another, all have the problem that if they get an error from dict_get_ptr they return immediately. This means they won't check the pending counts for other peers, which should trigger self-heal if they're non-zero. Failing to trigger self-heal when we should makes this a high-priority issue.
http://review.gluster.org/#change,4070 should address this (along with some performance/readability issues).
CHANGE: http://review.gluster.org/4070 (replicate: don't stop checking xattrs because one was absent) merged in master by Anand Avati (avati)
CHANGE: http://review.gluster.org/4242 (tests/bug-865825: turn stat-prefetch off before doing any afr self-heal related tests.) merged in master by Vijay Bellur (vbellur)
CHANGE: http://review.gluster.org/4253 (tests: Perform self-heal in foreground) merged in master by Vijay Bellur (vbellur)