xfs
[Top] [All Lists]

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

To: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
Subject: Re: [PATCH 04/12] splice: lift pipe_lock out of splice_to_pipe()
From: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 18 Dec 2016 14:10:54 -0800
Cc: Andreas Schwab <schwab@xxxxxxxxxxxxxx>, 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
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=l35OpfKN3U+1eywwsC9vc8BEtEhJKirz7qUk6yjPbqA=; b=cJ0dPNfGlWlPP4uTFD7FM1fNYCPD5HYU4caqf5bXJW5JJBRtBfVzoht4UlLa3/ix5z A5u72Ez18mif0ugbROe2qXOltrtdf0i4vEkHPkU6b9WrxyrfwYq4fc9sr/1AI/pwBehN +ANUPjKil2Wxbtd35Wz6NUlc1IqzDf1Gj1BHos+ilw/SdKyVAuMZXLret0/UNhvyPJDe +tCfXYSlTsFJulD3y6qLHb2EItP+J4eEBN8+wpcti92b8z+ikIT8Wgkrc+1qCBvRoBQS DBWVJBlKWlPGdQmUmFXEOF1B3Hfsia70OisC/5+PUGfqpq+wvOoAi8E0QH2c9BaNhwNG McXg==
In-reply-to: <20161218203003.GZ1555@xxxxxxxxxxxxxxxxxx>
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>
Sender: linus971@xxxxxxxxx
On Sun, Dec 18, 2016 at 12:30 PM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> OK, I see what's going on - it's wait_for_space() lifted past the checks
> for lack of readers.  The fix, AFAICS, is simply

Ugh. Does it have to be duplicated?

How about just making the wait_for_space() loop be a for-loop, and writing it as

   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))
                return -ERESTARTSYS;
        pipe->waiting_writers++;
        pipe_wait(pipe);
        pipe->waiting_writers--;
   }

and just having it once?

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..

            Linus

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