Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2224823rdb; Thu, 21 Sep 2023 12:03:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGC29i6Krsf/+2g4+2Np+KL9NQObuUbibMXZJLCwudOw3QH2JufF5RvCTemjGo2loOQvO9p X-Received: by 2002:a17:90a:9202:b0:26b:36a4:feeb with SMTP id m2-20020a17090a920200b0026b36a4feebmr676942pjo.8.1695323014059; Thu, 21 Sep 2023 12:03:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695323014; cv=none; d=google.com; s=arc-20160816; b=w68ZrjnztYfr7HOuIMQ6ZhEkTYJlF0OgFlNZ0itXBP66RL4ezPlKFnmC9eQCoQAjgI tOrenGMV+i2R+a0x9S5J/CO/PBYZHLz9FduYQRh9vorPIZ7LLuRAmg6UOrvFJSQkP62J xyXhNy2ToACQlqJ1CYGJBWsHx7i8LTGs5qaqHvkC9KVMYEk5JtIBm90nnKmFJm78knfX bRzC7br4pkWFglz7YzxemES8wk0ukpiZTJwUqlOfoxTVbLgU/bLrHEwtF/7VkLGIf0um B/rNouEs9e0QkhvweXJuR5kp1fkA2hhmWnLZj2Ig5FPjrZT0IZLKyGX0YqC8vPurAiNN Md4g== 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 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id my18-20020a17090b4c9200b00274274bf0ecsi2302532pjb.61.2023.09.21.12.03.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:03:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id AF13C82922EA; Thu, 21 Sep 2023 11:57:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230396AbjIUS5U (ORCPT + 99 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 lipwig.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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 (lipwig.vger.email [0.0.0.0]); Thu, 21 Sep 2023 11:57:27 -0700 (PDT) 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 */