replicate: Set setxattr wait-count to child-count to avoid race
replicate: Set setxattr wait-count to child-count to avoid race

A race is seen during a compilebench load against NFS where a NFSv3 MKDIR is
immediately followed by a LOOKUP on the new directory. By the time this lookup
comes in, the setxattr issued by distribute for the mkdir has not returned yet
from all the replicas. Since replicate returns a reply for setxattr after
receiving reply only from one subvol, the MKDIR is unwound from distribute.

When the LOOKUP is received at distribute, the setxattr has still not completed
at the second replica, whereas that is where the lookup is sent by replicate.
Finding that the xattr is missing from the dir, distribute returns ESTALE to
NFS, which return NFS3ERR_STALE to nfs client.

This patch changes replicate setxattr behaviour by forcing replicate to wait for all
children rather than one to call back before unwinding the stack.

Signed-off-by: Shehjar Tikoo <shehjart@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>

BUG: 937 (compilebench fails on NFS+dist+repl+all perf xlators)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=937

Kaushikbv/Gluster,Kaushikbv/Gluster,Kaushikbv/Gluster