From patchwork Thu Sep 21 07:03:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Kent X-Patchwork-Id: 142839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5071072vqi; Thu, 21 Sep 2023 12:02:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+M+m9itB8BCp/zZqrY7r6mC1lObNm+MWszF2oJ7x6NYJRCCtMKFJOoldI6REpRkMVXK4/ X-Received: by 2002:a17:90a:72c6:b0:273:dfb1:2439 with SMTP id l6-20020a17090a72c600b00273dfb12439mr663152pjk.21.1695322920758; Thu, 21 Sep 2023 12:02:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695322920; cv=none; d=google.com; s=arc-20160816; b=DqeC9ENeVZyPOpc/4dGTOnupKNNbfyqyMpDTqR3clkvjfFH7Fjm3z9LXOyFp8oSp+H 893Fif3eLNxCQUbE6DHzTaj+qu9qXbgpUlTJUlYC7dmgQBJYEhBe1hSCp0R9Cf2qKE4e Bkpyq87tqQXc6icIh+1c7Fe3rzsuVSFUCOgupLr8GXOQ2uHSJpmvBwmBelYsR2CelA58 HoPyuGarM0FgFGYjkoR5ny3xvFJyRbH6Fiqq3DLsHwj8TYae5iSOlnfQH7b/7Ciid55h j/z8uF50O3Kp8cVZIdi4dXlwD6O3HCkYgZY+30/xW3UeIw90P82AziYOKdpwSUV74/kn QxXg== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject; bh=qhU7APQS7+fYRQgdTyxJIyooTIsBKgxyxhOtgyTAZYE=; fh=Vd00GRLUNDtgftEBzBaifz0ZIGFRdtawsvTRUw5VTu8=; b=CLkRF/2bS0nH04MTN/Sw1otJmXwWIV6D9nig+hgqaYqfOaFFBu7NDbYXn2M5GhClo8 Y4GS65J5sjZ4Lozm7bKKWntIjSoBI7Ddy8sIYkOvcHocE0F5i6lljb0XpCfVQz4GlRp1 Pnc5nbJrPTMqi0ly4K3lzeTWeB1Pzmmxn7wrUFjZnon0/yL1C/Fe6OFegfZe7V/zLJcA C5tFi2yNIzKGi4TWM7JPCh0LU0u9j7DmUxu1g0NMY2eGXkHbz1vvehrJ3Uv6CTV7m0u9 FzDA6ZXKjDRB35Y60AWLa5kyPPHdrVdhU0t4vH0hVbWLLBg+PoYGg56l0aiz10sfBNyx DW4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id x18-20020a63b212000000b00578d71ef3d7si1917142pge.733.2023.09.21.12.01.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:02:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8502180A90EB; Thu, 21 Sep 2023 11:57:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230453AbjIUS5U (ORCPT + 28 others); Thu, 21 Sep 2023 14:57:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229593AbjIUS46 (ORCPT ); Thu, 21 Sep 2023 14:56:58 -0400 X-Greylist: delayed 60 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 21 Sep 2023 11:51:05 PDT Received: from smtp01.aussiebb.com.au (smtp01.aussiebb.com.au [IPv6:2403:5800:3:25::1001]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D006E8D9FB; Thu, 21 Sep 2023 11:51:05 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp01.aussiebb.com.au (Postfix) with ESMTP id 1D1AF100572; Thu, 21 Sep 2023 17:03:35 +1000 (AEST) X-Virus-Scanned: Debian amavisd-new at smtp01.aussiebb.com.au Received: from smtp01.aussiebb.com.au ([127.0.0.1]) by localhost (smtp01.aussiebb.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rnrQDSauchoq; Thu, 21 Sep 2023 17:03:35 +1000 (AEST) Received: by smtp01.aussiebb.com.au (Postfix, from userid 116) id 133D5100544; Thu, 21 Sep 2023 17:03:35 +1000 (AEST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from donald.themaw.net (180-150-90-198.b4965a.per.nbn.aussiebb.net [180.150.90.198]) by smtp01.aussiebb.com.au (Postfix) with ESMTP id 7F4CA100223; Thu, 21 Sep 2023 17:03:33 +1000 (AEST) Subject: [PATCH 1/8] autofs: refactor autofs_prepare_pipe() From: Ian Kent To: Al Viro , Christian Brauner Cc: autofs mailing list , linux-fsdevel , Kernel Mailing List , Bill O'Donnell , Miklos Szeredi , David Howells Date: Thu, 21 Sep 2023 15:03:33 +0800 Message-ID: <169527981274.27328.17552761781465494402.stgit@donald.themaw.net> In-Reply-To: <169527971702.27328.16272807830250040704.stgit@donald.themaw.net> References: <169527971702.27328.16272807830250040704.stgit@donald.themaw.net> User-Agent: StGit/1.5 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 21 Sep 2023 11:57:49 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777674926684676157 X-GMAIL-MSGID: 1777674926684676157 Refactor autofs_prepare_pipe() by seperating out a check function to be used later. Signed-off-by: Ian Kent --- fs/autofs/autofs_i.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/autofs/autofs_i.h b/fs/autofs/autofs_i.h index d5a44fa88acf..c24d32be7937 100644 --- a/fs/autofs/autofs_i.h +++ b/fs/autofs/autofs_i.h @@ -209,12 +209,20 @@ int autofs_fill_super(struct super_block *, void *, int); struct autofs_info *autofs_new_ino(struct autofs_sb_info *); void autofs_clean_ino(struct autofs_info *); -static inline int autofs_prepare_pipe(struct file *pipe) +static inline int autofs_check_pipe(struct file *pipe) { if (!(pipe->f_mode & FMODE_CAN_WRITE)) return -EINVAL; if (!S_ISFIFO(file_inode(pipe)->i_mode)) return -EINVAL; + return 0; +} + +static inline int autofs_prepare_pipe(struct file *pipe) +{ + int ret = autofs_check_pipe(pipe); + if (ret < 0) + return ret; /* We want a packet pipe */ pipe->f_flags |= O_DIRECT; /* We don't expect -EAGAIN */