xfs
[Top] [All Lists]

Re: [PATCH 04/12] splice: lift pipe_lock out of splice_to_pipe()

To: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Subject: Re: [PATCH 04/12] splice: lift pipe_lock out of splice_to_pipe()
From: Andreas Schwab <schwab@xxxxxxxxxxxxxx>
Date: Wed, 21 Dec 2016 19:56:11 +0100
Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>, Dave Chinner <david@xxxxxxxxxxxxx>, CAI Qian <caiqian@xxxxxxxxxx>, linux-xfs <linux-xfs@xxxxxxxxxxxxxxx>, xfs@xxxxxxxxxxx, Jens Axboe <axboe@xxxxxxxxx>, Nick Piggin <npiggin@xxxxxxxxx>, linux-fsdevel <linux-fsdevel@xxxxxxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <CA+55aFzPE6FbwX2NuiMkz9G+FzAoiNeb8jOSWwSoX3O7+KuH4Q@xxxxxxxxxxxxxx> (Linus Torvalds's message of "Sun, 18 Dec 2016 14:10:54 -0800")
References: <20160917190023.GA8039@xxxxxxxxxxxxxxxxxx> <20160923190032.GA25771@xxxxxxxxxxxxxxxxxx> <20160923190326.GB2356@xxxxxxxxxxxxxxxxxx> <CA+55aFxzPH2AYvDVWSAomO6bN_sW4+qDv87Xbq8XHMyvBEYe+w@xxxxxxxxxxxxxx> <20160923201025.GJ2356@xxxxxxxxxxxxxxxxxx> <CA+55aFyr-X_6FcWkSXBUcxV0p1BUZw8d=46wawv2x+8y7f8YcQ@xxxxxxxxxxxxxx> <20160924035951.GN2356@xxxxxxxxxxxxxxxxxx> <87shpmxrey.fsf@xxxxxxxxxxxxxx> <CA+55aFyJGz6njFjKe8O0+XRJhCrPHA_wnEuLbGSGypJ0G2-vpQ@xxxxxxxxxxxxxx> <20161218201207.GY1555@xxxxxxxxxxxxxxxxxx> <20161218203003.GZ1555@xxxxxxxxxxxxxxxxxx> <CA+55aFzPE6FbwX2NuiMkz9G+FzAoiNeb8jOSWwSoX3O7+KuH4Q@xxxxxxxxxxxxxx>
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.90 (gnu/linux)
On Dez 18 2016, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> Regardless - Andreas, can you verify that that fixes your issues? I'm
> assuming you had some real load that made you notice this, not just he
> dummy example..

FWIW, I have verified that the testsuite of pv succeeds with this patch:

diff --git a/fs/splice.c b/fs/splice.c
index 5a7750bd2e..63b8f54485 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1086,7 +1086,13 @@ EXPORT_SYMBOL(do_splice_direct);
 
 static int wait_for_space(struct pipe_inode_info *pipe, unsigned flags)
 {
-       while (pipe->nrbufs == pipe->buffers) {
+       for (;;) {
+               if (unlikely(!pipe->readers)) {
+                       send_sig(SIGPIPE, current, 0);
+                       return -EPIPE;
+               }
+               if (pipe->nrbufs != pipe->buffers)
+                       return 0;
                if (flags & SPLICE_F_NONBLOCK)
                        return -EAGAIN;
                if (signal_pending(current))
@@ -1095,7 +1101,6 @@ static int wait_for_space(struct pipe_inode_info *pipe, 
unsigned flags)
                pipe_wait(pipe);
                pipe->waiting_writers--;
        }
-       return 0;
 }
 
 static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe,
-- 
2.11.0


Andreas.

-- 
Andreas Schwab, schwab@xxxxxxxxxxxxxx
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

<Prev in Thread] Current Thread [Next in Thread>