Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4757258iob; Mon, 9 May 2022 00:26:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxS8QIVAL8m4vYFM3zUVmbbndvZHWuSaczOFi23aVZkuXw44VqkJE2b7TzjZmYTRZfZrXGp X-Received: by 2002:a05:6a00:b94:b0:50f:2255:ae03 with SMTP id g20-20020a056a000b9400b0050f2255ae03mr15025418pfj.74.1652081174350; Mon, 09 May 2022 00:26:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652081174; cv=none; d=google.com; s=arc-20160816; b=ccIL9z6OYYKBpnuu2eVBpeNnzzJ5v7nuKm1MQezZNeFDEkjbP3PnyCpJd2e0rLpaC8 6Ra68yUeVlGKfq9FKH19ULTvKG+5joN0iTxCJtHecSQADlTpkEKXBYXrci2jT4jG7H/y 9hQN62LZOwmjuBRYSrJshKvGLP+SHGBlCiP4P46H7k6BKXhwBR6Ng2S8C3ZRfu+jMrw5 s5jPj4yZyqTvU+LMHO+WyJPCqX4REKOcgy9UNwyMHc58WngwGKg14mtBFKZjbM4cVXGW OEr3DMMbuMUSuMcqSbkIBDZdm4f5GWjKAVOcaBFQDF+fhQNzLWaFLisdpw5JIkF4xC+e 7FaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Wd8gYjVNot+OGTAjpQ+lrHEbATeZZO+VBcsYC6MJTr4=; b=HsjRILDbv+QOqW9BrRJXMn0g+iQxtU/KnJspkseoQBY5N7smzYqcnaIc7HrMlpcP9D t/W9o2avBT+AoTpZx2Ym8z4aIzv391pdG1CLQAy3Xs1c2hj7hAbHlTOqb/XVmnwl5bBm /hSjqAGQKe0i96EPuTbScYqJUxFB49zg9kIUZiD+oKP5JrbkCnhZP2CUIbPt3fT29hUx LqQCoR63OaPAOQeKQO4wWG3/BufDIbt0k1oJIATe3hDqo756omtyhuJTuZUnk5rhX9hK XBVzcoXX0FmDeVyexf+c/M8gru7CEqEZ6ZO7mmfLsTGZtFrbfVJAnxKtTiJygfzXF9S0 Nzig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=YTT1ypjO; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id c3-20020a170902724300b00158b5b65721si8754338pll.321.2022.05.09.00.26.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 00:26:14 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=YTT1ypjO; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B6C501AB833; Mon, 9 May 2022 00:23:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377175AbiEGV4S (ORCPT + 99 others); Sat, 7 May 2022 17:56:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233529AbiEGV4O (ORCPT ); Sat, 7 May 2022 17:56:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E313CFD10; Sat, 7 May 2022 14:52:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8326F60F2D; Sat, 7 May 2022 21:52:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9956DC385A5; Sat, 7 May 2022 21:52:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1651960345; bh=VUBEB/P2WIQw0SMyiFMZdKktomMMIezyj6B6YeN0fcM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=YTT1ypjOFayfH/VIwXhN9k5FX9ncnibe6OKtZMXDFP1r9CQouE87+i/BZV4MrH0F4 6SEmVcA9WN2HY1vLSEzzSzyu3T+VibHmN8Zg+7ByrhgSImc5tubb4/uzRZYTZnT1Rx L4JZUGK9wkgdnBNfRSEBg1UC6K7JjKz1nbfUBsv4= Date: Sat, 7 May 2022 14:52:24 -0700 From: Andrew Morton To: Andrei Vagin Cc: LKML , linux-fsdevel , stable@kernel.org, Alexander Viro Subject: Re: [PATCH] fs: sendfile handles O_NONBLOCK of out_fd Message-Id: <20220507145224.a9b6555969d6e66586b6514c@linux-foundation.org> In-Reply-To: References: <20220415005015.525191-1-avagin@gmail.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2 May 2022 00:01:46 -0700 Andrei Vagin wrote: > Andrew, could you take a look at this patch? > > Here is a small reproducer for the problem: > > #define _GNU_SOURCE /* See feature_test_macros(7) */ > #include > #include > #include > #include > #include > #include > #include > > > #define FILE_SIZE (1UL << 30) > int main(int argc, char **argv) { > int p[2], fd; > > if (pipe2(p, O_NONBLOCK)) > return 1; > > fd = open(argv[1], O_RDWR | O_TMPFILE, 0666); > if (fd < 0) > return 1; > ftruncate(fd, FILE_SIZE); > > if (sendfile(p[1], fd, 0, FILE_SIZE) == -1) { > fprintf(stderr, "FAIL\n"); > } > if (sendfile(p[1], fd, 0, FILE_SIZE) != -1 || errno != EAGAIN) { > fprintf(stderr, "FAIL\n"); > } > return 0; > } > > It worked before b964bf53e540, it is stuck after b964bf53e540, and it > works again with this fix. Thanks. How did b964bf53e540 cause this? do_splice_direct() accidentally does the right thing even when SPLICE_F_NONBLOCK was not passed? I assume that Al will get to this. Meanwhile I can toss it into linux-next to get some exposure and so it won't be lost.