All of lore.kernel.org
 help / color / mirror / Atom feed
* xenfs: implement O_NONBLOCK for /proc/xen/xenbus
@ 2010-06-24 16:32 Paolo Bonzini
  2010-06-26 16:10 ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2010-06-24 16:32 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 57 bytes --]

Trivial patch.  Tested only in the pvops version.

Paolo

[-- Attachment #2: 0001-xenbus-implement-O_NONBLOCK.patch.2.6.18-xen --]
[-- Type: text/plain, Size: 1209 bytes --]

Content-Transfer-Encoding: 7bit
Subject: [PATCH] implement O_NONBLOCK for /proc/xen/xenbus
X-Mercurial-Node: 29260da8baac276184bd4266863c0e69d62b9634
Message-Id: <29260da8baac276184bd.1277396873@yakj.usersys.redhat.com>
User-Agent: Mercurial-patchbomb/1.5.3
Date: Thu, 24 Jun 2010 18:27:53 +0200
From: pbonzini@redhat.com
To: pbonzini@redhat.com

# HG changeset patch
# User Paolo Bonzini <pbonzini@redhat.com>
# Date 1277396822 -7200
# Node ID 29260da8baac276184bd4266863c0e69d62b9634
# Parent  f66d155ce457dab7a191bc199e878c07c2d2aead
implement O_NONBLOCK for /proc/xen/xenbus

This patch implements O_NONBLOCK for /proc/xen/xenbus.  It is a simple
matter of returning -EAGAIN instead of waiting on a queue.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

diff --git a/drivers/xen/xenbus/xenbus_dev.c b/drivers/xen/xenbus/xenbus_dev.c
--- a/drivers/xen/xenbus/xenbus_dev.c
+++ b/drivers/xen/xenbus/xenbus_dev.c
@@ -104,6 +104,9 @@
 	mutex_lock(&u->reply_mutex);
 	while (list_empty(&u->read_buffers)) {
 		mutex_unlock(&u->reply_mutex);
+		if (filp->f_flags & O_NONBLOCK)
+			return -EAGAIN;
+
 		ret = wait_event_interruptible(u->read_waitq,
 					       !list_empty(&u->read_buffers));
 		if (ret)



[-- Attachment #3: 0001-xenbus-implement-O_NONBLOCK.patch.pvops --]
[-- Type: text/plain, Size: 1006 bytes --]

>From 976c72e90458a85de543b1024722d16dac5766a1 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Wed, 23 Jun 2010 18:30:15 +0200
Subject: [PATCH] implement O_NONBLOCK for /proc/xen/xenbus

This patch implements O_NONBLOCK for /proc/xen/xenbus.  It is a simple
matter of returning -EAGAIN instead of waiting on a queue.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 drivers/xen/xenfs/xenbus.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/xen/xenfs/xenbus.c b/drivers/xen/xenfs/xenbus.c
index 6c4269b..64b3be4 100644
--- a/drivers/xen/xenfs/xenbus.c
+++ b/drivers/xen/xenfs/xenbus.c
@@ -123,6 +123,9 @@ static ssize_t xenbus_file_read(struct file *filp,
 	mutex_lock(&u->reply_mutex);
 	while (list_empty(&u->read_buffers)) {
 		mutex_unlock(&u->reply_mutex);
+		if (filp->f_flags & O_NONBLOCK)
+			return -EAGAIN;
+
 		ret = wait_event_interruptible(u->read_waitq,
 					       !list_empty(&u->read_buffers));
 		if (ret)
-- 
1.7.0.1


[-- Attachment #4: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: xenfs: implement O_NONBLOCK for /proc/xen/xenbus
  2010-06-24 16:32 xenfs: implement O_NONBLOCK for /proc/xen/xenbus Paolo Bonzini
@ 2010-06-26 16:10 ` Jeremy Fitzhardinge
  2010-06-28  7:53   ` Paolo Bonzini
  0 siblings, 1 reply; 5+ messages in thread
From: Jeremy Fitzhardinge @ 2010-06-26 16:10 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: xen-devel

On 06/24/2010 05:32 PM, Paolo Bonzini wrote:
> Trivial patch.  Tested only in the pvops version.

What user do you have for this?

    J

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: xenfs: implement O_NONBLOCK for /proc/xen/xenbus
  2010-06-26 16:10 ` Jeremy Fitzhardinge
@ 2010-06-28  7:53   ` Paolo Bonzini
  2010-07-02 11:28     ` Paolo Bonzini
  0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2010-06-28  7:53 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: xen-devel

On 06/26/2010 06:10 PM, Jeremy Fitzhardinge wrote:
> On 06/24/2010 05:32 PM, Paolo Bonzini wrote:
>> Trivial patch.  Tested only in the pvops version.
>
> What user do you have for this?

It was reported by internal QE without many details, likely it was found 
by code inspection or some automated tool.  I didn't ask because the 
patch was easy enough, but I can get more information if you care.

Paolo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: xenfs: implement O_NONBLOCK for /proc/xen/xenbus
  2010-06-28  7:53   ` Paolo Bonzini
@ 2010-07-02 11:28     ` Paolo Bonzini
  2010-07-26  9:33       ` Paolo Bonzini
  0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2010-07-02 11:28 UTC (permalink / raw)
  Cc: Jeremy Fitzhardinge, xen-devel

On 06/28/2010 09:53 AM, Paolo Bonzini wrote:
> On 06/26/2010 06:10 PM, Jeremy Fitzhardinge wrote:
>> On 06/24/2010 05:32 PM, Paolo Bonzini wrote:
>>> Trivial patch. Tested only in the pvops version.
>>
>> What user do you have for this?
>
> It was reported by internal QE without many details, likely it was found
> by code inspection or some automated tool. I didn't ask because the
> patch was easy enough, but I can get more information if you care.

It was found by a test (proc01) in LTP to read every entry of the procfs.

Paolo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: xenfs: implement O_NONBLOCK for /proc/xen/xenbus
  2010-07-02 11:28     ` Paolo Bonzini
@ 2010-07-26  9:33       ` Paolo Bonzini
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2010-07-26  9:33 UTC (permalink / raw)
  To: xen-devel; +Cc: Jeremy Fitzhardinge

On 07/02/2010 01:28 PM, Paolo Bonzini wrote:
> On 06/28/2010 09:53 AM, Paolo Bonzini wrote:
>> On 06/26/2010 06:10 PM, Jeremy Fitzhardinge wrote:
>>> On 06/24/2010 05:32 PM, Paolo Bonzini wrote:
>>>> Trivial patch. Tested only in the pvops version.
>>>
>>> What user do you have for this?
>>
>> It was reported by internal QE without many details, likely it was found
>> by code inspection or some automated tool. I didn't ask because the
>> patch was easy enough, but I can get more information if you care.
>
> It was found by a test (proc01) in LTP to read every entry of the procfs.

ping?  It's not in linux-2.6.18.hg either.

Paolo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-07-26  9:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-24 16:32 xenfs: implement O_NONBLOCK for /proc/xen/xenbus Paolo Bonzini
2010-06-26 16:10 ` Jeremy Fitzhardinge
2010-06-28  7:53   ` Paolo Bonzini
2010-07-02 11:28     ` Paolo Bonzini
2010-07-26  9:33       ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.