Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 143333
b: refs/heads/master
c: 2933970
h: refs/heads/master
i:
  143331: 5a77f58
v: v3
  • Loading branch information
Miklos Szeredi authored and Jens Axboe committed Apr 15, 2009
1 parent 44cf712 commit e648ab0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 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: b3c2d2ddd63944ef2a1e4a43077b602288107e01
refs/heads/master: 2933970b960223076d6affcf7a77e2bc546b8102
18 changes: 2 additions & 16 deletions trunk/fs/splice.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ EXPORT_SYMBOL(__splice_from_pipe);
* @actor: handler that splices the data
*
* Description:
* See __splice_from_pipe. This function locks the input and output inodes,
* See __splice_from_pipe. This function locks the pipe inode,
* otherwise it's identical to __splice_from_pipe().
*
*/
Expand All @@ -793,32 +793,18 @@ ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out,
splice_actor *actor)
{
ssize_t ret;
struct inode *inode = out->f_mapping->host;
struct splice_desc sd = {
.total_len = len,
.flags = flags,
.pos = *ppos,
.u.file = out,
};

/*
* The actor worker might be calling ->write_begin and
* ->write_end. Most of the time, these expect i_mutex to
* be held. Since this may result in an ABBA deadlock with
* pipe->inode, we have to order lock acquiry here.
*
* Outer lock must be inode->i_mutex, as pipe_wait() will
* release and reacquire pipe->inode->i_mutex, AND inode must
* never be a pipe.
*/
WARN_ON(S_ISFIFO(inode->i_mode));
mutex_lock_nested(&inode->i_mutex, I_MUTEX_PARENT);
if (pipe->inode)
mutex_lock_nested(&pipe->inode->i_mutex, I_MUTEX_CHILD);
mutex_lock(&pipe->inode->i_mutex);
ret = __splice_from_pipe(pipe, &sd, actor);
if (pipe->inode)
mutex_unlock(&pipe->inode->i_mutex);
mutex_unlock(&inode->i_mutex);

return ret;
}
Expand Down

0 comments on commit e648ab0

Please sign in to comment.