libxenstore: prefer using the character device
authorJonathan Creekmore <jonathan.creekmore@gmail.com>
Thu, 27 Aug 2015 14:04:38 +0000 (09:04 -0500)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 1 Sep 2015 11:41:35 +0000 (12:41 +0100)
commit9c89dc95201ffed5fead17b35754bf9440fdbdc0
treef0761083000451f102ffbff1bafd2be5e3d3c6bd
parentd1ef21a5d1222c3b32d3d2314aafc16e948040f6
libxenstore: prefer using the character device

With the addition of FMODE_ATOMIC_POS in the Linux 3.14 kernel,
concurrent blocking file accesses to a single open file descriptor can
cause a deadlock trying to grab the file position lock. If a watch has
been set up, causing a read_thread to blocking read on the file
descriptor, then future writes that would cause the background read to
complete will block waiting on the file position lock before they can
execute. This race condition only occurs when libxenstore is accessing
the xenstore daemon through the /proc/xen/xenbus file and not through
the unix domain socket, which is the case when the xenstore daemon is
running as a stub domain or when oxenstored is passed
--disable-socket. Accessing the daemon from the true character device
also does not exhibit this problem.

On Linux, prefer using the character device file over the proc file if
the character device exists.

Signed-off-by: Jonathan Creekmore <jonathan.creekmore@gmail.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/xenstore/xs_lib.c