From patchwork Thu Jul 23 23:46:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 6856531 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id ACBC79F1D4 for ; Thu, 23 Jul 2015 23:47:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA03C20698 for ; Thu, 23 Jul 2015 23:47:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AF89720694 for ; Thu, 23 Jul 2015 23:47:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752687AbbGWXrN (ORCPT ); Thu, 23 Jul 2015 19:47:13 -0400 Received: from mx2.suse.de ([195.135.220.15]:36212 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752615AbbGWXrM (ORCPT ); Thu, 23 Jul 2015 19:47:12 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 05FD6AAC1; Thu, 23 Jul 2015 23:47:10 +0000 (UTC) Date: Fri, 24 Jul 2015 09:46:57 +1000 From: NeilBrown To: "J. Bruce Fields" Cc: Kinglong Mee , Al Viro , "linux-nfs@vger.kernel.org" , linux-fsdevel@vger.kernel.org, Trond Myklebust Subject: Re: export table lookup: was [PATCH 10/10 v7] nfsd: Allows user un-mounting filesystem where nfsd exports base on Message-ID: <20150724094657.0ca793b4@noble> In-Reply-To: <20150722150840.GH22718@fieldses.org> References: <55A11010.6050005@gmail.com> <55A111A8.2040701@gmail.com> <20150713133934.6a4ef77d@noble> <20150715210756.GE21669@fieldses.org> <20150716094046.445c038b@noble> <20150716205148.GC10673@fieldses.org> <20150722075824.3e7498ce@noble> <20150722150840.GH22718@fieldses.org> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-suse-linux-gnu) MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, 22 Jul 2015 11:08:40 -0400 "J. Bruce Fields" wrote: > I've had this nagging todo to work out if there are other interesting > consequences of the fact that the cache is internally keyed on one thing > and appears to mountd to be keyed on another. (And that there's a > complicated many<->many relationship between those two things.) But I > haven't gotten to it. Could be all unlikely corner cases, for all I > know. Even corner cases are worth resolving - and you got me interested now:-) I think the distinction between pathnames and mnt+dentry is not quite the important one. I think mnt+dentry is the primary object - it is what a filehandle maps to and what a pathname maps to. The problem is that some mnt+dentry pairs do not have matching path names. If nfsd gets hold of one of these pairs, it shouldn't try asking mountd about it because there is no way to ask the question, and even if there was it isn't clear there is any way for mountd to answer. If think that nfsd should assume that any such mountpoint is not exported. So something vaguely like: Would mean that if I # cd /tmp/a/b/c # mount --bind /etc /tmp/a # /bin/pwd I get /tmp//(unreachable)/a/b/c would could be checked for by nfsd to decide that there is no point asking user-space. I'm not at all certain that this is a good interface (or that the code isn't racy) - it is just a proof-of-concept. We should probably place the (unreachable) at the front rather than in the middle. Does that seem like a reasonable approach from your understanding of the problem? Thanks, NeilBrown --- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/dcache.c b/fs/dcache.c index 5c8ea15e73a5..a0651872ae8e 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -2943,6 +2943,12 @@ restart: if (error) break; + if (unlikely(d_mountpoint(dentry))) { + struct mount *mounted = __lookup_mnt(vfsmnt, dentry); + if (mounted) + prepend(&bptr, &blen, "//(unreachable)",15); + } + dentry = parent; } if (!(seq & 1))