From patchwork Fri Sep 22 04:12:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Kent X-Patchwork-Id: 143172 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5323366vqi; Thu, 21 Sep 2023 21:49:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqCd884qPIlsaDd7Kj2HccgFiRVmAKUkg9Bxrtif4ILISUVPaFnEXCrGIjTEzBTZ8Ck5Mu X-Received: by 2002:a17:90a:bd06:b0:263:4305:4e82 with SMTP id y6-20020a17090abd0600b0026343054e82mr7193955pjr.6.1695358172681; Thu, 21 Sep 2023 21:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695358172; cv=none; d=google.com; s=arc-20160816; b=Ff557uySqAEnIWrwhQizqzB0tKES+PtFmyUUDA3kT394v/6L54v8VGzcPnU5CMyztO jJ2HECaKSQxxeq++2flxvgvZcAg4V/Pj3vZ7Bqla6cPTxLoyyP1woYSLThW/MhYKBQuS JrWrxB9hIZOJ8fzICWZYSzgmFQiFECUGC6ep+6JhyVPDYjkdJ6prMosubLAFtbk+6iY/ VePe/h3FIQu+r29SSDyBA2p6aFtd6GIBNTZMiCbZ4kJ1Mg7PZt+adwdZ539f/7+fDHln HZYAUsEyoWD9z61rf5IyoA6ryaDldOOtbG23MZBn8UsHutLDl3M7fOpmn0RUWuMxkDU+ MaUg== 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 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id bf18-20020a17090b0b1200b0026b6a7d9e43si3033787pjb.14.2023.09.21.21.49.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 21:49:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; 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 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 645EF8370877; Thu, 21 Sep 2023 21:12:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229476AbjIVEMr (ORCPT + 30 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 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 morse.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 (morse.vger.email [0.0.0.0]); Thu, 21 Sep 2023 21:12:50 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777711890803933921 X-GMAIL-MSGID: 1777711890803933921 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 */