From: Jonathan Creekmore <jonathan.creekmore@gmail.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>,
stefano.stabellini@eu.citrix.com, ian.jackson@eu.citrix.com,
xen-devel@lists.xenproject.org,
BorisOstrovsky <boris.ostrovsky@oracle.com>,
wei.liu@citrix.com
Subject: Re: [PATCH] libxenstore: Use poll() with a non-blocking read()
Date: Tue, 18 Aug 2015 07:49:16 -0700 [thread overview]
Message-ID: <m2614cps7n.fsf@gmail.com> (raw)
In-Reply-To: <55D2FF72.7050006@citrix.com> (David Vrabel's message of "Tue, 18 Aug 2015 10:48:34 +0100")
David Vrabel <david.vrabel@citrix.com> writes:
> On 16/08/15 09:59, Ian Campbell wrote:
>> On Thu, 2015-08-13 at 16:44 -0500, Jonathan Creekmore wrote:
>>> 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.
>
> I think you should make libxenstore open /dev/xen/xenbus instead. Since
> this is a character device it should work correctly.
>
So, I did a quick test and verified that 1) /dev/xen/xenbus did exist on
my system and 2) that opening /dev/xen/xenbus instead of
/proc/xen/xenbus fixed the problem I was seeing as well. I did think
that it was a little weird that libxenstore was treating a proc file as
a character device. It makes more sense to me to open the actual
character device instead.
> It may be necessary to try /dev/xen/xenbus first and fallback to
> /proc/xen/xenbus.
>
When did /dev/xen/xenbus get created? It is a fairly straightforward
change to just switch to /dev/xen/xenbus and is a bit larger refactor to
probe for its existence first before falling back to
/proc/xen/xenbus.
Either way, I could work up a patch to do this if people are ok with
that user-space change.
That said, I still think that the original patch I submitted is
worthwhile to prevent a subtle, but probably benign, race condition with
changing the blocking flag on a file descriptor that is shared between
two threads.
next prev parent reply other threads:[~2015-08-18 14:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-13 21:44 [PATCH] libxenstore: Use poll() with a non-blocking read() Jonathan Creekmore
2015-08-16 8:59 ` Ian Campbell
2015-08-17 0:46 ` Jonathan Creekmore
2015-08-17 13:44 ` Boris Ostrovsky
2015-08-18 9:48 ` David Vrabel
2015-08-18 14:49 ` Jonathan Creekmore [this message]
2015-08-27 14:04 ` [PATCH v2] libxenstore: prefer using the character device Jonathan Creekmore
2015-08-27 16:56 ` Wei Liu
2015-08-27 18:03 ` Ian Jackson
2015-08-27 20:34 ` Jonathan Creekmore
2015-08-28 9:57 ` David Vrabel
2015-08-31 18:59 ` Jonathan Creekmore
2015-09-01 10:56 ` Wei Liu
2015-09-01 11:28 ` Ian Jackson
2015-09-01 12:03 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2614cps7n.fsf@gmail.com \
--to=jonathan.creekmore@gmail.com \
--cc=boris.ostrovsky@oracle.com \
--cc=david.vrabel@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).