Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2449694rdb; Thu, 21 Sep 2023 21:12:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHjjQPgMy+atXvf9Q9jvcA3fNqn4dyw7UIX+zGDrCnAj11D57GCIu7Vsl5JrdT+sQ7qAltX X-Received: by 2002:a17:903:278b:b0:1bd:edac:af44 with SMTP id jw11-20020a170903278b00b001bdedacaf44mr6537498plb.51.1695355977176; Thu, 21 Sep 2023 21:12:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695355977; cv=none; d=google.com; s=arc-20160816; b=X4wEGy2F/4cyxZmSeUb01c14c76eO7cBjME6dYc0MkupBzBlyWxrr+lzaOINbOMwiR h/DUmfzrfEfKR7gah37mCwf95vzVvDeE7g13nUw21OScVkI13xzkFw6LBAnMRHJuoy2u Ewuo7kUeY7Obu/OxtEFC5+ipLVfW+zoItCuBmwU0VEtz2hn/gioKYBjYiERgfZ4LuMF+ hSH2chlEb1zP6QUlRscxaeCtezdG+sxBEcB2WAKpk+fYSMeVM8LXMbAbTTZZ+Ol1KEqx FX+OW1VjiPsp/9J1KFiO2kDMk0BOdoG2yDpKAbm1NRMUwqbUtpsajPCCFx+1vjBGG65N aoFg== 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:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=Orfn+zsuM68FHIsSvumK/hPQ+xdBHw1ePrGBE2OK2hE=; fh=tOzwWtfY/Ihw0ZG9uDufqX7N1fYPvJMmg28cxm4BgX4=; b=iQH5aEID5m3cR4Z66xqknpL/6cMk+dfsuaTEj/cv6JIzUYeOzLDjjjoADovJ3OnZ1v n6u7tjxjg6NE1I+f1GceZm3WG5Q0ee8AspxQcsiykLUgkQVqAgTxiYG5FLgPWw20Ja9V q7z06lvspEs7Job+SdcGEltY0tmmPhy2KILkaR+s6NAq6waGC05RA+Xei82GHIYMU9dO 55eRQvIIPhjH+OhgX9b8yP/dMMV1NFmOK5uvEZ4GPaNf7KfDU0y91iS/0TlzTswciAXX sptqSYr4Grg2cBURKGwOY0+zi1txTQX3iM8sEaGkladnvwKCC/3CRlfzqOhIQeF6uf6Z Hpzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@themaw.net header.s=fm1 header.b=NKYYXYpo; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=jGrLgkJV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id z17-20020a170903019100b001b8ae69289dsi3397803plg.539.2023.09.21.21.12.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 21:12:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@themaw.net header.s=fm1 header.b=NKYYXYpo; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=jGrLgkJV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 64A7682F098D; Thu, 21 Sep 2023 21:12:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229935AbjIVEMr (ORCPT + 99 others); Fri, 22 Sep 2023 00:12:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229634AbjIVEMm (ORCPT ); Fri, 22 Sep 2023 00:12:42 -0400 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D93FE197; Thu, 21 Sep 2023 21:12:36 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 4996C5C0222; Fri, 22 Sep 2023 00:12:36 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 22 Sep 2023 00:12:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=themaw.net; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1695355956; x= 1695442356; bh=Orfn+zsuM68FHIsSvumK/hPQ+xdBHw1ePrGBE2OK2hE=; b=N KYYXYpo+MooxRerSaDOtajao5gkfFD5+zVqKlWdG3i+MqOgNeleLoTf1ioTDWBt4 cLK1j77m9Kdl7lANkCB3XjzMkkHgs09hQO/JcgM90sLFjwyU7mtDsKZLH57y5Biw S6M6OJNKHwveFhh96Ldm3jtawickWqkZGzyb25UMboFLQyvKGmy9qFXNw7y8G8xQ pZc9iH5X8mFKGedwMfqVULjHjP7YgQ0MLLViGAlNvs5lhTLbQcE+zYA3F/J8s0xC L0aZz9Is7EoVd3l1bVMU8XAn5m317X6B3IDcWz7hvR+K3ERjrZ4y8pBXJTMqrvak SSbHhFScEWBauYveVkzEA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1695355956; x= 1695442356; bh=Orfn+zsuM68FHIsSvumK/hPQ+xdBHw1ePrGBE2OK2hE=; b=j GrLgkJVgl2gjOoYSv+olMjthDTifVDgMhEIPQfQkiLjFFb8IxesvOpYBcxAZVMiM GB42oY5qR29b72Y2Dd0sCXznDYB/HZhR5iHa4jbm2miBpHAd47H9L13hm+2zJK79 zRdeZepjDLFBErFzI41QiDO1eM7Qw5QVZDiI7koHTQgV4Mgdavz65OzIm6+IakC6 NeTeJcC0p5qJHfMjvDvJVpDk6zlSaKWGY0ISbetiIepW4GBWFRmYkslVDdU0qcXC Z0y1LhPPO5h9pIEp0b/O28CAXW5qJ0GMToFK4u6vy1jenpuuoLNQLCQMXnHFkyY4 vQWUoXvdMry/wUy5IP/nQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudekjedgjeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepkfgrnhcu mfgvnhhtuceorhgrvhgvnhesthhhvghmrgifrdhnvghtqeenucggtffrrghtthgvrhhnpe duleegueffgfehudeufedtffeiudfghfejgeehvdffgefgjeetvdfffeeihfdvveenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrrghvvghnse hthhgvmhgrfidrnhgvth X-ME-Proxy: Feedback-ID: i31e841b0:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 22 Sep 2023 00:12:32 -0400 (EDT) From: Ian Kent To: Al Viro , Christian Brauner Cc: autofs mailing list , linux-fsdevel , Kernel Mailing List , Bill O'Donnell , Miklos Szeredi , David Howells , Ian Kent Subject: [PATCH 1/8] autofs: refactor autofs_prepare_pipe() Date: Fri, 22 Sep 2023 12:12:08 +0800 Message-ID: <20230922041215.13675-2-raven@themaw.net> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230922041215.13675-1-raven@themaw.net> References: <20230922041215.13675-1-raven@themaw.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Thu, 21 Sep 2023 21:12:53 -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 */ -- 2.41.0