lkml.org 
[lkml]   [2008]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: splice vs O_APPEND
From
Date
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;


\
 
 \ /
  Last update: 2008-10-09 18:33    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site