Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 26020
b: refs/heads/master
c: a4514eb
h: refs/heads/master
v: v3
  • Loading branch information
Jens Axboe committed Apr 19, 2006
1 parent 2782712 commit 343bab8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2a27250e6cf47ca1ea3bea0a55e4b7889c097627
refs/heads/master: a4514ebd8e12c63c09ab02be518db545bd1d24af
45 changes: 30 additions & 15 deletions trunk/fs/splice.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,22 +720,26 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
ssize_t ret;

ret = move_from_pipe(pipe, out, ppos, len, flags, pipe_to_file);

/*
* If file or inode is SYNC and we actually wrote some data, sync it.
*/
if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(mapping->host))
&& ret > 0) {
if (ret > 0) {
struct inode *inode = mapping->host;
int err;

mutex_lock(&inode->i_mutex);
err = generic_osync_inode(mapping->host, mapping,
OSYNC_METADATA|OSYNC_DATA);
mutex_unlock(&inode->i_mutex);
*ppos += ret;

/*
* If file or inode is SYNC and we actually wrote some data,
* sync it.
*/
if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(inode))) {
int err;

mutex_lock(&inode->i_mutex);
err = generic_osync_inode(inode, mapping,
OSYNC_METADATA|OSYNC_DATA);
mutex_unlock(&inode->i_mutex);

if (err)
ret = err;
if (err)
ret = err;
}
}

return ret;
Expand Down Expand Up @@ -937,6 +941,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
{
struct pipe_inode_info *pipe;
loff_t offset, *off;
long ret;

pipe = in->f_dentry->d_inode->i_pipe;
if (pipe) {
Expand All @@ -951,7 +956,12 @@ static long do_splice(struct file *in, loff_t __user *off_in,
} else
off = &out->f_pos;

return do_splice_from(pipe, out, off, len, flags);
ret = do_splice_from(pipe, out, off, len, flags);

if (off_out && copy_to_user(off_out, off, sizeof(loff_t)))
ret = -EFAULT;

return ret;
}

pipe = out->f_dentry->d_inode->i_pipe;
Expand All @@ -967,7 +977,12 @@ static long do_splice(struct file *in, loff_t __user *off_in,
} else
off = &in->f_pos;

return do_splice_to(in, off, pipe, len, flags);
ret = do_splice_to(in, off, pipe, len, flags);

if (off_in && copy_to_user(off_in, off, sizeof(loff_t)))
ret = -EFAULT;

return ret;
}

return -EINVAL;
Expand Down

0 comments on commit 343bab8

Please sign in to comment.