* Re: [PATCH 2/2] pipe: do not return POLLERR for fifo_poll
[not found] ` <ilomki.fs3loe.5j02sm6rx63x13ip2d9643lta.beaver@cs.helsinki.fi>
@ 2005-08-26 0:02 ` Andrew Morton
2005-08-26 7:03 ` Pekka J Enberg
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2005-08-26 0:02 UTC (permalink / raw)
To: Pekka Enberg; +Cc: linux-kernel, manfred
Pekka Enberg <penberg@cs.helsinki.fi> wrote:
>
> This patch changes fifo_poll not to return POLLERR to take care of a FIXME
> in fs/pipe.c stating that "Most unices do not set POLLERR for fifos." The
> comment has been there since 2.3.99-pre3 so either apply this patch or
> alternatively, I can send a new one removing the unnecessary abstraction.
>
> ...
> --- 2.6-mm.orig/fs/pipe.c
> +++ 2.6-mm/fs/pipe.c
> @@ -399,8 +399,8 @@ pipe_ioctl(struct inode *pino, struct fi
> }
>
> /* No kernel lock held - fine */
> -static unsigned int
> -pipe_poll(struct file *filp, poll_table *wait)
> +static inline unsigned int
> +__pipe_poll(struct file *filp, poll_table *wait, int can_err)
> {
> unsigned int mask;
> struct inode *inode = filp->f_dentry->d_inode;
> @@ -420,15 +420,24 @@ pipe_poll(struct file *filp, poll_table
>
> if (filp->f_mode & FMODE_WRITE) {
> mask |= (nrbufs < PIPE_BUFFERS) ? POLLOUT | POLLWRNORM : 0;
> - if (!info->readers)
> + if (can_err && !info->readers)
> mask |= POLLERR;
> }
>
> return mask;
> }
>
> -/* FIXME: most Unices do not set POLLERR for fifos */
> -#define fifo_poll pipe_poll
> +static unsigned int
> +pipe_poll(struct file *filp, poll_table *wait)
> +{
> + return __pipe_poll(filp, wait, 1);
> +}
> +
> +static unsigned int
> +fifo_poll(struct file *filp, poll_table *wait)
> +{
> + return __pipe_poll(filp, wait, 0);
> +}
>
> static int
> pipe_release(struct inode *inode, int decr, int decw)
A userspace-visible change, no?
So there's a risk in changing it. What do we get in return? Worried.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] pipe: do not return POLLERR for fifo_poll
2005-08-26 0:02 ` [PATCH 2/2] pipe: do not return POLLERR for fifo_poll Andrew Morton
@ 2005-08-26 7:03 ` Pekka J Enberg
2005-08-26 17:16 ` Manfred Spraul
0 siblings, 1 reply; 4+ messages in thread
From: Pekka J Enberg @ 2005-08-26 7:03 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, manfred
Pekka Enberg <penberg@cs.helsinki.fi> wrote:
> > This patch changes fifo_poll not to return POLLERR to take care of a FIXME
> > in fs/pipe.c stating that "Most unices do not set POLLERR for fifos." The
> > comment has been there since 2.3.99-pre3 so either apply this patch or
> > alternatively, I can send a new one removing the unnecessary abstraction.
On Thu, 25 Aug 2005, Andrew Morton wrote:
> A userspace-visible change, no?
>
> So there's a risk in changing it. What do we get in return? Worried.
FWIW I have been running on this for few days now without any noticeable
regressions. We get a solved FIXME in return but like I said I am a happy
to remove the redundant abstraction if this is too risky.
Pekka
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] pipe: do not return POLLERR for fifo_poll
2005-08-26 7:03 ` Pekka J Enberg
@ 2005-08-26 17:16 ` Manfred Spraul
2005-08-26 17:54 ` [PATCH] pipe: remove redundant fifo_poll abstraction Pekka Enberg
0 siblings, 1 reply; 4+ messages in thread
From: Manfred Spraul @ 2005-08-26 17:16 UTC (permalink / raw)
To: Pekka J Enberg; +Cc: Andrew Morton, linux-kernel
Pekka J Enberg wrote:
>FWIW I have been running on this for few days now without any noticeable
>regressions. We get a solved FIXME in return but like I said I am a happy
>to remove the redundant abstraction if this is too risky.
>
>
>
I would prefer just to remove the abstraction, together with a comment
that Linux fifos behave exactly like pipes, unlike the behavior of most
unices.
--
Manfred
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] pipe: remove redundant fifo_poll abstraction
2005-08-26 17:16 ` Manfred Spraul
@ 2005-08-26 17:54 ` Pekka Enberg
0 siblings, 0 replies; 4+ messages in thread
From: Pekka Enberg @ 2005-08-26 17:54 UTC (permalink / raw)
To: Andrew Morton; +Cc: Manfred Spraul, linux-kernel
On Fri, 2005-08-26 at 19:16 +0200, Manfred Spraul wrote:
> I would prefer just to remove the abstraction, together with a comment
> that Linux fifos behave exactly like pipes, unlike the behavior of most
> unices.
[PATCH] pipe: remove redundant fifo_poll abstraction
This patch removes a redundant fifo_poll() abstraction from fs/pipe.c and adds
a big fat comment stating we set POLLERR for FIFOs too on Linux unlike most
Unices.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
pipe.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
Index: 2.6-mm/fs/pipe.c
===================================================================
--- 2.6-mm.orig/fs/pipe.c
+++ 2.6-mm/fs/pipe.c
@@ -419,6 +419,10 @@ pipe_poll(struct file *filp, poll_table
if (filp->f_mode & FMODE_WRITE) {
mask |= (nrbufs < PIPE_BUFFERS) ? POLLOUT | POLLWRNORM : 0;
+ /*
+ * Most Unices do not set POLLERR for FIFOs but on Linux they
+ * behave exactly like pipes for poll().
+ */
if (!PIPE_READERS(*inode))
mask |= POLLERR;
}
@@ -426,9 +430,6 @@ pipe_poll(struct file *filp, poll_table
return mask;
}
-/* FIXME: most Unices do not set POLLERR for fifos */
-#define fifo_poll pipe_poll
-
static int
pipe_release(struct inode *inode, int decr, int decw)
{
@@ -572,7 +573,7 @@ struct file_operations read_fifo_fops =
.read = pipe_read,
.readv = pipe_readv,
.write = bad_pipe_w,
- .poll = fifo_poll,
+ .poll = pipe_poll,
.ioctl = pipe_ioctl,
.open = pipe_read_open,
.release = pipe_read_release,
@@ -584,7 +585,7 @@ struct file_operations write_fifo_fops =
.read = bad_pipe_r,
.write = pipe_write,
.writev = pipe_writev,
- .poll = fifo_poll,
+ .poll = pipe_poll,
.ioctl = pipe_ioctl,
.open = pipe_write_open,
.release = pipe_write_release,
@@ -597,7 +598,7 @@ struct file_operations rdwr_fifo_fops =
.readv = pipe_readv,
.write = pipe_write,
.writev = pipe_writev,
- .poll = fifo_poll,
+ .poll = pipe_poll,
.ioctl = pipe_ioctl,
.open = pipe_rdwr_open,
.release = pipe_rdwr_release,
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-08-26 17:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <ilomk8.i0yljb.2ul6sqfgelx5ik5dngkbmbkeu.beaver@cs.helsinki.fi>
[not found] ` <ilomki.fs3loe.5j02sm6rx63x13ip2d9643lta.beaver@cs.helsinki.fi>
2005-08-26 0:02 ` [PATCH 2/2] pipe: do not return POLLERR for fifo_poll Andrew Morton
2005-08-26 7:03 ` Pekka J Enberg
2005-08-26 17:16 ` Manfred Spraul
2005-08-26 17:54 ` [PATCH] pipe: remove redundant fifo_poll abstraction Pekka Enberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox