Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp992685ybk; Wed, 20 May 2020 18:02:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbXKY1L+WZ5M/dUnhVUDvZk60Rre7UXtvuYLRI1MsnqREH3pO/y3yd/S/0MXV19UO9lyXp X-Received: by 2002:aa7:c6c6:: with SMTP id b6mr5764797eds.53.1590022958857; Wed, 20 May 2020 18:02:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590022958; cv=none; d=google.com; s=arc-20160816; b=VBcuSSXlvGtV8j3TMrgiVoaoP8HbuTtEj5okZqUzkNLjRyi3wSW3hW1odRFvfoJGpE oIAKwArCVV4eq8Oq96avvutHQHgKv1UOYFgI/0Bu09IGSKArwLXJZAon4JTMpstGcI6w o6Jl6b+s/eP+UP1e0luHEkIUExJAYvohRHlFwnbfKi93P42scypeKgVL/dGeeV1W3kDi cq7w5BTRbTirqwLEHSfs6j6dVZ5ug9+1gzZTbCk1kIL52qVzXqFY+xF0LcA4SI1jUGyz Xj4Ju70n71cVSTTr3pobCSH8fINi3smKl2+97tkFbn1eyuOY2V8D2wJCs0e3LAZ6bhrU OEdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature; bh=jT9Di9Gytbq5y3irbSRWLGGaMPsV1xwHwqo+qbRkmvA=; b=c2mSz4XyDEGeRb4fLsY5qKXcD+oLIF/Etn+tsVjhwufYJML/Vm5ZufGLGaaW60yjJm daoETK0/Q4tq3N5hCkM8g28hrZWP0nroJ8TlHxhBaNK/Zk10yFLZJp5eUPeLiRnDXYar Vui5NF5uzrfk9RdwsygsSQvQmU57xU8Y4ubPKoixKsu4KdD0bEjSAGOmeksdd4XVNqwn wM1LPmbiOTaryg96sR9EGprafLgitmR1a7a7NgwNgOildgbmPcJ9zsPtoScGwWKe9/Qe 6OQddNjasKe29Znfvyeve4AOUMICyY40XBdZtmn8s6YWxnIn24hVEJ3HM1vNxA/rjBE4 ss5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=ZD0AuMOU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dj19si2218799edb.255.2020.05.20.18.02.14; Wed, 20 May 2020 18:02:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=ZD0AuMOU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727823AbgEUA6z (ORCPT + 99 others); Wed, 20 May 2020 20:58:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726896AbgEUA6y (ORCPT ); Wed, 20 May 2020 20:58:54 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD54FC061A0E for ; Wed, 20 May 2020 17:58:54 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id 5so2194642pjd.0 for ; Wed, 20 May 2020 17:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=jT9Di9Gytbq5y3irbSRWLGGaMPsV1xwHwqo+qbRkmvA=; b=ZD0AuMOUJeZZYN5K3BnGKSMjdNdT2svIAbct2lS5ofpASdahojBgZugHzq4HXpT6kP lctIj0S7YwAeJytKW+zRgUMlM7zDMhNjSiNz7sLZVMwn8qct4B0+2SyWadqBP9GqFr5S gzBkVVWnHpeXf2KK5jBfSLIV/tmuiHsLQbteUJzBtEhSUiBy8foULBExdkN8NShL5Y2I QvSzsBswo8h1j4qu7QiV8jG1nBqZm6jSC8yCoRLoKzq4tuDC6imeN5iXxvd4KeDgqsnR xVZuC84tr1wAC0daZgJXVi7HSrOc/JWtVf8fEtJFKf5kDmhZmv93SAl01yMTE01g0/gv a63g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=jT9Di9Gytbq5y3irbSRWLGGaMPsV1xwHwqo+qbRkmvA=; b=RKwx1p6Vr+t0n6BfBsMygSVjN/j2Zbcba9vkEqzBGY5NJrQFVtKXDiF4fb3880VhIh Tgjw+ZxGtMRDdKzKxFXpF5Q6D5nAgHu57aKIUJ6GfmjU7HtCccWPxvr4m3SA6G4DcjZM WvfhmZtdN2Zq3xy0N8NzfzVGHL7hE0NXF5+nJO8NVP06Ti8sHT64tcELt4ECYFm8T6TV enOptqS2zhSGvm8J9jJTTMxpTjmGOd9Ot5wc7SmcXYwUK1YcmVn5fj1tZnw3MV/22Xpt aNMWXIA2FORBB4/P+d9pTCqqMyCR5oEg3xTFo9ToZCTb4GI673mJfSzFpszI+0z0TBzQ FO4w== X-Gm-Message-State: AOAM531lo1nG6EbHxZcozW5f2YBwtTi47sTZ6zyprtDM23ATfdT8BoLp kicSLHizEIh6yTZKwe4IIaHX3vTttbY= X-Received: by 2002:a17:90a:930c:: with SMTP id p12mr9212902pjo.64.1590022734334; Wed, 20 May 2020 17:58:54 -0700 (PDT) Received: from [192.168.86.156] (cpe-75-85-219-51.dc.res.rr.com. [75.85.219.51]) by smtp.gmail.com with ESMTPSA id o201sm3309618pfd.115.2020.05.20.17.58.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 May 2020 17:58:53 -0700 (PDT) Subject: Re: [PATCH]: splice fix opipe_prep() full check From: Jens Axboe To: David Howells Cc: "linux-kernel@vger.kernel.org" , Linus Torvalds References: Message-ID: Date: Wed, 20 May 2020 18:58:52 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/20/20 6:42 PM, Jens Axboe wrote: > The patch converting pipes to head and tail pointers mistakenly > turned the splice pipe-to-pipe opipe check into something > nonsensical. It's supposed to check if we have room in the pipe, > and return success if we do. If not, wait for room in the pipe. > Instead it's now returning success for a full pipe, and entering > the slow path for a non-full pipe. Forgot to CC Linus - Linus, could you pick this up, or do you want me to queue it up. Moving to 5.6 internally at FB triggers this pretty easily, causing a hard hang as we'll get stuck in an infinite busy loop in splice_pipe_to_pipe(). > > Cc: stable@vger.kernel.org > Fixes: 8cefc107ca54 ("pipe: Use head and tail pointers for the ring, not cursor and length") > Signed-off-by: Jens Axboe > > --- > > I didn't check if the offending commit had other logical fumbles. > > diff --git a/fs/splice.c b/fs/splice.c > index fd0a1e7e5959..4e53efbd621d 100644 > --- a/fs/splice.c > +++ b/fs/splice.c > @@ -1494,7 +1494,7 @@ static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags) > * Check pipe occupancy without the inode lock first. This function > * is speculative anyways, so missing one is ok. > */ > - if (pipe_full(pipe->head, pipe->tail, pipe->max_usage)) > + if (!pipe_full(pipe->head, pipe->tail, pipe->max_usage)) > return 0; > > ret = 0; > -- Jens Axboe