MAR-112: RRD transfer lock can prevent master transition
MAR-112: RRD transfer lock can prevent master transition

If the master loses connectivity during a RRD transfer, the RRD mutex
will never be released.  When performing a emergency master transition,
the first thing that occurs is to save the local RRDs to disk, which
requires the RRD mutex.  This will never succeed, thus XAPI gets stuck
trying to shut down.

Instead of locking the mutex, we try to acquire it for a few seconds.
If the lock can not be taken, the loss of some RRD data is preferable
to not being able to transition at all.

Signed-off-by: Ted M Lin <2a6ec19851ae96f2a0830c3c040b66071081b940@marathontechnologies.com>

jjd27/xen-api,anoobs/xen-api,cheng-z/xen-api,rafalmiel/xen-api,euanh/xen-api,cheng--zhang/xen-api,rafalmiel/xen-api,vasilenkomike/xen-api,cheng--zhang/xen-api,Frezzle/xen-api,Frezzle/xen-api,vasilenkomike/xen-api,cheng-z/xen-api,thomassa/xen-api,agimofcarmen/xen-api,thomassa/xen-api,jjd27/xen-api,vasilenkomike/xen-api,salvocambria/xen-api,cheng-z/xen-api,ravippandey/xen-api,huizh/xen-api,cheng-z/xen-api,vasilenkomike/xen-api,simonjbeaumont/xen-api,guard163/xen-api,euanh/xen-api,simonjbeaumont/xen-api,Frezzle/xen-api,cheng-z/xen-api,guard163/xen-api,simonjbeaumont/xen-api,srowe/xen-api,rafalmiel/xen-api,huizh/xen-api,robertbreker/xen-api,jjd27/xen-api,robertbreker/xen-api,salvocambria/xen-api,koushikcgit/xen-api,koushikcgit/xen-api,cheng--zhang/xen-api,ravippandey/xen-api,cheng-z/xen-api,Frezzle/xen-api,anoobs/xen-api,jjd27/xen-api,koushikcgit/xen-api,guard163/xen-api,cheng--zhang/xen-api,agimofcarmen/xen-api,guard163/xen-api,jjd27/xen-api,djs55/xen-api,agimofcarmen/xen-api,robertbreker/xen-api,ravippandey/xen-api,anoobs/xen-api,srowe/xen-api,koushikcgit/xen-api,vasilenkomike/xen-api,thomassa/xen-api,robertbreker/xen-api,Frezzle/xen-api,vasilenkomike/xen-api,euanh/xen-api,djs55/xen-api,rafalmiel/xen-api,guard163/xen-api,agimofcarmen/xen-api,srowe/xen-api,anoobs/xen-api,cheng-z/xen-api,jjd27/xen-api,srowe/xen-api,ravippandey/xen-api,euanh/xen-api,euanh/xen-api,salvocambria/xen-api,simonjbeaumont/xen-api,cheng--zhang/xen-api,agimofcarmen/xen-api,srowe/xen-api,thomassa/xen-api,thomassa/xen-api,huizh/xen-api,koushikcgit/xen-api,simonjbeaumont/xen-api,djs55/xen-api,djs55/xen-api,ravippandey/xen-api,simonjbeaumont/xen-api,euanh/xen-api,salvocambria/xen-api,huizh/xen-api,thomassa/xen-api,huizh/xen-api,agimofcarmen/xen-api,robertbreker/xen-api,anoobs/xen-api,anoobs/xen-api,rafalmiel/xen-api,huizh/xen-api,cheng--zhang/xen-api,rafalmiel/xen-api,koushikcgit/xen-api,salvocambria/xen-api,robertbreker/xen-api,cheng--zhang/xen-api,salvocambria/xen-api,djs55/xen-api,guard163/xen-api,ravippandey/xen-api,djs55/xen-api