aboutsummaryrefslogtreecommitdiffstats
path: root/fs/splice.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/splice.c')
-rw-r--r--fs/splice.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/fs/splice.c b/fs/splice.c
index fd6b278d447b..349576b2c75a 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -784,7 +784,7 @@ EXPORT_SYMBOL(__splice_from_pipe);
784 * @actor: handler that splices the data 784 * @actor: handler that splices the data
785 * 785 *
786 * Description: 786 * Description:
787 * See __splice_from_pipe. This function locks the input and output inodes, 787 * See __splice_from_pipe. This function locks the pipe inode,
788 * otherwise it's identical to __splice_from_pipe(). 788 * otherwise it's identical to __splice_from_pipe().
789 * 789 *
790 */ 790 */
@@ -793,7 +793,6 @@ ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out,
793 splice_actor *actor) 793 splice_actor *actor)
794{ 794{
795 ssize_t ret; 795 ssize_t ret;
796 struct inode *inode = out->f_mapping->host;
797 struct splice_desc sd = { 796 struct splice_desc sd = {
798 .total_len = len, 797 .total_len = len,
799 .flags = flags, 798 .flags = flags,
@@ -801,24 +800,11 @@ ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out,
801 .u.file = out, 800 .u.file = out,
802 }; 801 };
803 802
804 /*
805 * The actor worker might be calling ->write_begin and
806 * ->write_end. Most of the time, these expect i_mutex to
807 * be held. Since this may result in an ABBA deadlock with
808 * pipe->inode, we have to order lock acquiry here.
809 *
810 * Outer lock must be inode->i_mutex, as pipe_wait() will
811 * release and reacquire pipe->inode->i_mutex, AND inode must
812 * never be a pipe.
813 */
814 WARN_ON(S_ISFIFO(inode->i_mode));
815 mutex_lock_nested(&inode->i_mutex, I_MUTEX_PARENT);
816 if (pipe->inode) 803 if (pipe->inode)
817 mutex_lock_nested(&pipe->inode->i_mutex, I_MUTEX_CHILD); 804 mutex_lock(&pipe->inode->i_mutex);
818 ret = __splice_from_pipe(pipe, &sd, actor); 805 ret = __splice_from_pipe(pipe, &sd, actor);
819 if (pipe->inode) 806 if (pipe->inode)
820 mutex_unlock(&pipe->inode->i_mutex); 807 mutex_unlock(&pipe->inode->i_mutex);
821 mutex_unlock(&inode->i_mutex);
822 808
823 return ret; 809 return ret;
824} 810}