[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <E1KnyOw-00044y-K4@pomaz-ex.szeredi.hu>
Date: Thu, 09 Oct 2008 18:30:10 +0200
From: Miklos Szeredi <miklos@...redi.hu>
To: torvalds@...ux-foundation.org
CC: miklos@...redi.hu, jens.axboe@...cle.com,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: splice vs O_APPEND
On Thu, 9 Oct 2008, Linus Torvalds wrote:
> And it turns out that handling O_APPEND is actually pretty easy, so
> instead of doing -EINVAL, we can just implement it. Something like this
> (untested, of course).
>
> Does this look better?
Yeah, only the append is now racy because the O_APPEND check is
outside i_mutex. So maybe just stick with -EINVAL in
do_splice_from()? That also covers do_splice_direct(), which is used
in NFS and sendfile() and a couple of other places.
We know that nobody is currently relying on O_APPEND semantics with
splice, so this should be OK.
Untested patch...
Miklos
Index: linux-2.6/fs/splice.c
===================================================================
--- linux-2.6.orig/fs/splice.c 2008-08-29 14:39:20.000000000 +0200
+++ linux-2.6/fs/splice.c 2008-10-09 18:19:25.000000000 +0200
@@ -892,6 +892,9 @@ static long do_splice_from(struct pipe_i
{
int ret;
+ if (out->f_flags & O_APPEND)
+ return -EINVAL;
+
if (unlikely(!out->f_op || !out->f_op->splice_write))
return -EINVAL;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists