[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] libxenstore: prefer using the character device



commit 9c89dc95201ffed5fead17b35754bf9440fdbdc0
Author:     Jonathan Creekmore <jonathan.creekmore@xxxxxxxxx>
AuthorDate: Thu Aug 27 09:04:38 2015 -0500
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Tue Sep 1 12:41:35 2015 +0100

    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@xxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/xenstore/xs_lib.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tools/xenstore/xs_lib.c b/tools/xenstore/xs_lib.c
index af4f75a..0c7744e 100644
--- a/tools/xenstore/xs_lib.c
+++ b/tools/xenstore/xs_lib.c
@@ -81,6 +81,8 @@ const char *xs_domain_dev(void)
 #if defined(__RUMPUSER_XEN__) || defined(__RUMPRUN__)
        return "/dev/xen/xenbus";
 #elif defined(__linux__)
+       if (access("/dev/xen/xenbus", F_OK) == 0)
+               return "/dev/xen/xenbus";
        return "/proc/xen/xenbus";
 #elif defined(__NetBSD__)
        return "/kern/xen/xenbus";
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.