Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 143334
b: refs/heads/master
c: eb443e5
h: refs/heads/master
v: v3
  • Loading branch information
Miklos Szeredi authored and Jens Axboe committed Apr 15, 2009
1 parent e648ab0 commit 9c68c2c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 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: 2933970b960223076d6affcf7a77e2bc546b8102
refs/heads/master: eb443e5a25d43996deb62b9bcee1a4ce5dea2ead
34 changes: 23 additions & 11 deletions trunk/fs/splice.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,17 +895,29 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
};
ssize_t ret;

WARN_ON(S_ISFIFO(inode->i_mode));
mutex_lock_nested(&inode->i_mutex, I_MUTEX_PARENT);
ret = file_remove_suid(out);
if (likely(!ret)) {
if (pipe->inode)
mutex_lock_nested(&pipe->inode->i_mutex, I_MUTEX_CHILD);
ret = __splice_from_pipe(pipe, &sd, pipe_to_file);
if (pipe->inode)
mutex_unlock(&pipe->inode->i_mutex);
}
mutex_unlock(&inode->i_mutex);
if (pipe->inode)
mutex_lock_nested(&pipe->inode->i_mutex, I_MUTEX_PARENT);

splice_from_pipe_begin(&sd);
do {
ret = splice_from_pipe_next(pipe, &sd);
if (ret <= 0)
break;

mutex_lock_nested(&inode->i_mutex, I_MUTEX_CHILD);
ret = file_remove_suid(out);
if (!ret)
ret = splice_from_pipe_feed(pipe, &sd, pipe_to_file);
mutex_unlock(&inode->i_mutex);
} while (ret > 0);
splice_from_pipe_end(pipe, &sd);

if (pipe->inode)
mutex_unlock(&pipe->inode->i_mutex);

if (sd.num_spliced)
ret = sd.num_spliced;

if (ret > 0) {
unsigned long nr_pages;

Expand Down

0 comments on commit 9c68c2c

Please sign in to comment.