From patchwork Mon Mar 30 23:06:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Kent X-Patchwork-Id: 11466449 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A32C6912 for ; Mon, 30 Mar 2020 23:07:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8168D20771 for ; Mon, 30 Mar 2020 23:07:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729824AbgC3XHW (ORCPT ); Mon, 30 Mar 2020 19:07:22 -0400 Received: from icp-osb-irony-out6.external.iinet.net.au ([203.59.1.106]:28018 "EHLO icp-osb-irony-out6.external.iinet.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728987AbgC3XHW (ORCPT ); Mon, 30 Mar 2020 19:07:22 -0400 X-SMTP-MATCH: 0 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2BdHgD7eoJe/+im0XZmHgELHIFwCwKCJ4FhEiqDUkiPTwEBAQEBAQaBEjiJaIUUij6BewoBAQEBAQEBAQEbGQECBAEBhESCNCQ2Bw4CEAEBAQUBAQEBAQUDAW2FClhCAQwBhUoEUigNAhgOAkkWE4V+JK4YfzMaAoovgQ4qAYwwGnmBB4FEA4E2gWaBF4ZJgl4EkHaHD0WYG4JGlxUdj0IDjCctrHAMJoFYTS4KgydQGJx/NzCBBgEBhDWKCgEB X-IPAS-Result: A2BdHgD7eoJe/+im0XZmHgELHIFwCwKCJ4FhEiqDUkiPTwEBAQEBAQaBEjiJaIUUij6BewoBAQEBAQEBAQEbGQECBAEBhESCNCQ2Bw4CEAEBAQUBAQEBAQUDAW2FClhCAQwBhUoEUigNAhgOAkkWE4V+JK4YfzMaAoovgQ4qAYwwGnmBB4FEA4E2gWaBF4ZJgl4EkHaHD0WYG4JGlxUdj0IDjCctrHAMJoFYTS4KgydQGJx/NzCBBgEBhDWKCgEB X-IronPort-AV: E=Sophos;i="5.72,326,1580745600"; d="scan'208";a="233609802" Received: from unknown (HELO mickey.themaw.net) ([118.209.166.232]) by icp-osb-irony-out6.iinet.net.au with ESMTP; 31 Mar 2020 07:06:52 +0800 Subject: [PATCH 1/4] autofs: dont call do_expire_wait() in autofs_d_manage() From: Ian Kent To: Al Viro Cc: autofs mailing list , linux-fsdevel , Kernel Mailing List Date: Tue, 31 Mar 2020 07:06:51 +0800 Message-ID: <158560961146.14841.14430383874338917674.stgit@mickey.themaw.net> User-Agent: StGit/unknown-version MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Calling do_expire_wait() in autofs_d_manage() isn't really necessary. If in rcu-walk mode -ECHILD will be returned and if in ref-walk mode and the dentry might be picked for expire (or is expiring) 0 will be returned otherwise it waits for the expire. But waiting is meant to be done in autofs_d_automount() so simplify autofs_d_manage() by testing the expire status and returning only what's needed. Signed-off-by: Ian Kent --- fs/autofs/root.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/autofs/root.c b/fs/autofs/root.c index 5aaa1732bf1e..a3b7c72a298d 100644 --- a/fs/autofs/root.c +++ b/fs/autofs/root.c @@ -410,9 +410,12 @@ static int autofs_d_manage(const struct path *path, bool rcu_walk) return 0; } - /* Wait for pending expires */ - if (do_expire_wait(path, rcu_walk) == -ECHILD) - return -ECHILD; + /* Check for (possible) pending expire */ + if (ino->flags & AUTOFS_INF_WANT_EXPIRE) { + if (rcu_walk) + return -ECHILD; + return 0; + } /* * This dentry may be under construction so wait on mount @@ -432,8 +435,6 @@ static int autofs_d_manage(const struct path *path, bool rcu_walk) */ struct inode *inode; - if (ino->flags & AUTOFS_INF_WANT_EXPIRE) - return 0; if (path_is_mountpoint(path)) return 0; inode = d_inode_rcu(dentry);