Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1509185rwb; Fri, 18 Nov 2022 21:06:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf6jhqxe71UYg7AH5sEa72qEhH3WbhNXL+KJYdwxEO0zLqazwRwWdLvw09/L2GDNvgali2F9 X-Received: by 2002:a17:902:f08c:b0:17c:892e:7c8e with SMTP id p12-20020a170902f08c00b0017c892e7c8emr2651540pla.92.1668834362522; Fri, 18 Nov 2022 21:06:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668834362; cv=none; d=google.com; s=arc-20160816; b=KU5Pq1tLFKJMTVH8I9eVeSwhjFQ4FskDubSx0b+3o0pCHBkrNEA1p4/Ikt4FwX/KP2 GQ04ODldDBZiYz2IBAQefId82abWYhEIw7DcVpuZf4P/NNhjBDGzs8yK4w9sJi/n7Q44 lZhoA9V1YwkhacaSagjVOq8jW3Wy8JF16hOBpsDkL/eTWTDtMMHTCK3rTA2Um+iFEUZc jEPeNFEL7/FSB4i2EodDltqgnW2bE1O0cBfqJd2vAZiwp24K/4q31SZYwBA8vOxs1b3w uiJoYk9D6nwLpOoLjYCsJ6X/06y17+Q6GDyT+rQQevwe0npvuH7ADPX/qdSkooYgm/fb +Hzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=SJWklytu4XN4G6PI77eHjQA+9EaF4oxISWvc8B/9PuE=; b=0/vIJKfY71ndJ6zpaRmrcRCVLKIdbh/c863Q8SOmdjGCEG/ACSJkkWIc5P6w9RMd9l g58dTU2wngu3s4xLtJU5GXzaPHW2wckWkI/5lvnnO8K4Pd0Y1fAa0SOHd79JEjFp1DY8 friwGfAOqJPBcm2Qs4lCNXdb/+LJ/8d1/Qm5AOuf7T3/TMe0uepTIBdvrVSfm5jWoJyp dt8j5CKIwUorLzLHRdmThaO7DzOG8NurLg2TCu0cOlik5fgbFa+jmS3OhvAUqocdQ4yM /fTxE/zHaPMEdRXVHccq20SmzwJvxjj8iIkfJ9XGM6yYJYzl71QGPAFeLJk37Kr/6C/7 DEuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=oCkXTzhw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r10-20020a63d90a000000b00476c770e17asi5572320pgg.764.2022.11.18.21.05.51; Fri, 18 Nov 2022 21:06:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=oCkXTzhw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231954AbiKSEq0 (ORCPT + 90 others); Fri, 18 Nov 2022 23:46:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229663AbiKSEqW (ORCPT ); Fri, 18 Nov 2022 23:46:22 -0500 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DB8DA2883; Fri, 18 Nov 2022 20:46:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=SJWklytu4XN4G6PI77eHjQA+9EaF4oxISWvc8B/9PuE=; b=oCkXTzhw0EUfCL14MWFML46AZV RE4mrm4fRCV9t6PtQOuGnHYAqPP44npCEm4xsdp08/fgRHrS/EhUI4Y7M/RXLGioE8o+jIlXJt3QL 9Cak56NJSdR6EUQ5KVecxQaxBRchw4GS5i+u00Kh5YgPaZouRRneVNCk2E7m7MBfAVQvbgNv81apC F+tRUd/YkK8nrakQmNUJs+0dOyU+Pml3zRuWJP74o6gSgJe45ePBi+iEQDpnztXBA2Ip3T6hexmVW fEhnzuD8z/r6DkGB8Gg5KVNa5BfKgsnSd8wIn60/pff3Ml0K5h5/uqpG8KS2Zsa1w7DnstegOLiXw +7Xm7ipw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1owFk9-004zAW-2t; Sat, 19 Nov 2022 04:46:17 +0000 Date: Sat, 19 Nov 2022 04:46:17 +0000 From: Al Viro To: Peilin Ye Cc: Peilin Ye , Cong Wang , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] coredump: Use vmsplice_to_pipe() for pipes in dump_emit_page() Message-ID: References: <20221029005147.2553-1-yepeilin.cs@gmail.com> <20221031210349.3346-1-yepeilin.cs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221031210349.3346-1-yepeilin.cs@gmail.com> Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham 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, Oct 31, 2022 at 02:03:49PM -0700, Peilin Ye wrote: > + n = vmsplice_to_pipe(file, &iter, 0); > + if (n == -EBADF) > + n = __kernel_write_iter(cprm->file, &iter, &pos); Yuck. If anything, I would rather put a flag into coredump_params and check it instead; this check for -EBADF is both unidiomatic and brittle. Suppose someday somebody looks at vmsplice(2) and decides that it would make sense to lift the "is it a pipe" check into e.g. vmsplice_type(). There's no obvious reasons not to, unless one happens to know that coredump relies upon that check done in vmsplice_to_pipe(). It's asking for trouble several years down the road. Make it explicit and independent from details of error checking in vmsplice(2).