[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080401173624.GA28217@2ka.mipt.ru>
Date: Tue, 1 Apr 2008 21:36:24 +0400
From: Evgeniy Polyakov <johnpol@....mipt.ru>
To: Mika Penttilä <mika.penttila@...umbus.fi>
Cc: David Miller <davem@...emloft.net>, axboe@...nel.dk,
netdev@...r.kernel.org
Subject: Re: Fix for the fundamental network/block layer race in sendfile().
Hi.
On Tue, Apr 01, 2008 at 08:14:47PM +0300, Mika Penttilä (mika.penttila@...umbus.fi) wrote:
> Aren't you breaking the other types of splices, like splice to file
> which doesn't have the wakeup thing.
Do we care about them? Likely we do...
Thanks for pointing!
Inlined fix on top of previous patch, attached full diff.
Not tested with other splices though, but is rather straightforward :)
Is there simple application to run?
--- /tmp/splice.c 2008-04-01 21:30:39.000000000 +0400
+++ ./fs/splice.c 2008-04-01 21:29:53.000000000 +0400
@@ -631,7 +631,8 @@
ret = 0;
do_wakeup = 0;
- atomic_set(&pipe->god_blessed_us, pipe->nrbufs);
+ if (actor == pipe_to_sendpage)
+ atomic_set(&pipe->god_blessed_us, pipe->nrbufs);
for (;;) {
if (pipe->nrbufs) {
@@ -670,8 +671,9 @@
}
if (!sd->total_len) {
- wait_event_interruptible(pipe->wait,
- !atomic_read(&pipe->god_blessed_us));
+ if (actor == pipe_to_sendpage)
+ wait_event_interruptible(pipe->wait,
+ !atomic_read(&pipe->god_blessed_us));
break;
}
}
@@ -679,7 +681,8 @@
if (pipe->nrbufs)
continue;
- wait_event_interruptible(pipe->wait, !atomic_read(&pipe->god_blessed_us));
+ if (actor == pipe_to_sendpage)
+ wait_event_interruptible(pipe->wait, !atomic_read(&pipe->god_blessed_us));
if (!pipe->writers)
break;
--
Evgeniy Polyakov
View attachment "1" of type "text/plain" (4891 bytes)
Powered by blists - more mailing lists