From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3359BC05027 for ; Sat, 11 Feb 2023 03:20:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230025AbjBKDUc (ORCPT ); Fri, 10 Feb 2023 22:20:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbjBKDUM (ORCPT ); Fri, 10 Feb 2023 22:20:12 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 045EF85B05 for ; Fri, 10 Feb 2023 19:18:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676085535; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fUy/CuYrWJP2Bt4Lb/Dgly0Z7KbcxY16FRGX/OI4RVI=; b=FgIUUup6g6DYbJP0BFZeHn/VQHAMv5yf8VRhgm4CA+NNgunT3QgBs5tXe8InQ4//d0uq3O xnyy5jYO/Ub4Uruj67wqod8MEMuQtSRb44RUxgMwzyFhMxOTJOhuGh8Ybrh5p+OU2d3T92 Zu2yPFvPVJEF1xAf5Sleih/OzwetfoY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-465-1ACS6fHSOc6JBoGHdLfIUA-1; Fri, 10 Feb 2023 22:18:51 -0500 X-MC-Unique: 1ACS6fHSOc6JBoGHdLfIUA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D9DB21C0514F; Sat, 11 Feb 2023 03:18:50 +0000 (UTC) Received: from T590 (ovpn-8-18.pek2.redhat.com [10.72.8.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 580F3400DFA1; Sat, 11 Feb 2023 03:18:42 +0000 (UTC) Date: Sat, 11 Feb 2023 11:18:38 +0800 From: Ming Lei To: Linus Torvalds Cc: Jens Axboe , Andy Lutomirski , Dave Chinner , Matthew Wilcox , Stefan Metzmacher , linux-fsdevel , Linux API Mailing List , io-uring , "linux-kernel@vger.kernel.org" , Al Viro , Samba Technical , ming.lei@redhat.com Subject: Re: copy on write for splice() from file to pipe? Message-ID: References: <1dd85095-c18c-ed3e-38b7-02f4d13d9bd6@kernel.dk> <7a2e5b7f-c213-09ff-ef35-d6c2967b31a7@kernel.dk> <2bb12591-9d24-6b26-178f-05e939bf3251@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On Fri, Feb 10, 2023 at 02:08:35PM -0800, Linus Torvalds wrote: > On Fri, Feb 10, 2023 at 1:51 PM Jens Axboe wrote: > > > > Speaking of splice/io_uring, Ming posted this today: > > > > https://lore.kernel.org/io-uring/20230210153212.733006-1-ming.lei@redhat.com/ > > Ugh. Some of that is really ugly. Both 'ignore_sig' and > 'ack_page_consuming' just look wrong. Pure random special cases. > > And that 'ignore_sig' is particularly ugly, since the only thing that > sets it also sets SPLICE_F_NONBLOCK. > > And the *only* thing that actually then checks that field is > 'splice_from_pipe_next()', where there are exactly two > signal_pending() checks that it adds to, and > > (a) the first one is to protect from endless loops > > (b) the second one is irrelevant when SPLICE_F_NONBLOCK is set > > So honestly, just NAK on that series. > > I think that instead of 'ignore_sig' (which shouldn't exist), that > first 'signal_pending()' check in splice_from_pipe_next() should just > be changed into a 'fatal_signal_pending()'. Good point, here the signal is often from task_work_add() called by io_uring. > > But that 'ack_page_consuming' thing looks even more disgusting, and > since I'm not sure why it even exists, I don't know what it's doing > wrong. The motivation is for confirming that if the produced buffer can be used for READ or WRITE. Another way could be to add PIPE_BUF_FLAG_MAY_READ[WRITE]. thanks, Ming