Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp95917iog; Thu, 16 Jun 2022 23:02:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uWrM0U7Y66CTKyw+aD8JBPghXinPWbUnFG3YB5pjBzadoC4MInSRWSuq55eBULBJzIutcr X-Received: by 2002:a17:90b:1d90:b0:1e8:5a44:820e with SMTP id pf16-20020a17090b1d9000b001e85a44820emr8798559pjb.217.1655445746181; Thu, 16 Jun 2022 23:02:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655445746; cv=none; d=google.com; s=arc-20160816; b=rKGZhZx25ayi7iMYbDNzfIdsdJjPpnfHy7DJuaT7P8zzS6+4rDlmg92/U2Ak6eLQtE K8RWRA9OhReI9CeDfHEmrCUFON69yXk1jPtIHV2cDkPF9hgSjLhdYr4EpJyLCm9i+uPS PvUT5a+WMlTSH2WQYwWiJpu/ZXPxY6LOVe8a6U3QTjlHK6x/7mm53Hlx3nsj+03MWUQg PvpAzkyr9WvrCJZT89W/OXx0GZuWUHmjBdZbrESoMzNYN1gL6rdyJv4bKD7FJZlkEZI1 6HM9pUhwHjSQEsEyon6jwZjNw/1te33oI/KUnCPy1+z3F6aurqq8ILNCX+tJjtZ/kJEU Wpvg== 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=18G6HVr2/ZZgEyir1NT+dUZUUz/uQY1MdX6zqhjWhkI=; b=HVoH51oQQy6+V8eHyoDn+F7bljA4joKkgveoSdfK11hfv1D7+DtTk5Wm5irDv1K8fF bMFU3lN6VRVGi2YdqI1R2QkLiteYqAAYVm8HxLeUhkp++4zkZTrJOvDXl8DJ0FWKWUgN GZxCUgh4Z8o1qh1YRSA3QshnT4MAf0LypY28RkRuPQtsL1OO11AAJ6NuNFOXdhw0k4WJ 4TdcAqv4g3ZXFySxVYQDmQrrFEsuZi2JZyK/m4KHLPvSNnPIYfsxdROe9k3rJcBbg5x7 c/GL+ZWk5a1ZzWz0uUyGhEGF8ttvkXK6rK+Gd5sSyOzgtDbjhrcq/xbkpDV059zqy3Xl Du8g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a170903018b00b0015d17ba5b65si4589098plg.22.2022.06.16.23.01.25; Thu, 16 Jun 2022 23:02:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380094AbiFQFfy (ORCPT + 99 others); Fri, 17 Jun 2022 01:35:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379903AbiFQFft (ORCPT ); Fri, 17 Jun 2022 01:35:49 -0400 Received: from smtp03.aussiebb.com.au (2403-5800-3-25--1003.ip6.aussiebb.net [IPv6:2403:5800:3:25::1003]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53CB44756C; Thu, 16 Jun 2022 22:35:48 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by smtp03.aussiebb.com.au (Postfix) with ESMTP id 047A31A00A1; Fri, 17 Jun 2022 15:35:47 +1000 (AEST) X-Virus-Scanned: Debian amavisd-new at smtp03.aussiebb.com.au Received: from smtp03.aussiebb.com.au ([127.0.0.1]) by localhost (smtp03.aussiebb.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TxA8BIMRwdjp; Fri, 17 Jun 2022 15:35:46 +1000 (AEST) Received: by smtp03.aussiebb.com.au (Postfix, from userid 119) id ECECE1A00A2; Fri, 17 Jun 2022 15:35:46 +1000 (AEST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, RDNS_DYNAMIC,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 smtp03.aussiebb.com.au (Postfix) with ESMTP id 8AFC91A009C; Fri, 17 Jun 2022 15:35:46 +1000 (AEST) Subject: [PATCH 4/6] autofs: add comment about autofs_mountpoint_changed() From: Ian Kent To: Al Viro Cc: David Howells , Miklos Szeredi , linux-fsdevel , Kernel Mailing List Date: Fri, 17 Jun 2022 13:35:46 +0800 Message-ID: <165544414635.250070.10563886994408560172.stgit@donald.themaw.net> In-Reply-To: <165544393032.250070.3426550720222448062.stgit@donald.themaw.net> References: <165544393032.250070.3426550720222448062.stgit@donald.themaw.net> User-Agent: StGit/1.1 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 The function autofs_mountpoint_changed() is unusual, add a comment about two cases for which it is needed. Signed-off-by: Ian Kent --- fs/autofs/root.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/fs/autofs/root.c b/fs/autofs/root.c index e0fa71eb5c05..ca03c1cae2be 100644 --- a/fs/autofs/root.c +++ b/fs/autofs/root.c @@ -291,9 +291,26 @@ static struct dentry *autofs_mountpoint_changed(struct path *path) struct dentry *dentry = path->dentry; struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb); - /* - * If this is an indirect mount the dentry could have gone away - * as a result of an expire and a new one created. + /* If this is an indirect mount the dentry could have gone away + * and a new one created. + * + * This is unusual and I can't remember the case for which it + * was originally added now. But an example of how this can + * happen is an autofs indirect mount that has the "browse" + * option set and also has the "symlink" option in the autofs + * map entry. In this case the daemon will remove the browse + * directory and create a symlink as the mount leaving the + * struct path stale. + * + * Another not so obvious case is when a mount in an autofs + * indirect mount that uses the "nobrowse" option is being + * expired at the same time as a path walk. If the mount has + * been umounted but the mount point directory seen before + * becoming unhashed (during a lockless path walk) when a stat + * family system call is made the mount won't be re-mounted as + * it should. In this case the mount point that's been removed + * (by the daemon) will be stale and the a new mount point + * dentry created. */ if (autofs_type_indirect(sbi->type) && d_unhashed(dentry)) { struct dentry *parent = dentry->d_parent;