From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: Is a NULL check missing in nfs_lookup? Date: Fri, 5 Jan 2007 17:22:01 +0000 Message-ID: <20070105172201.GB17561@ftp.linux.org.uk> References: <1167999770.6050.39.camel@lade.trondhjem.org> <1168009222.29243.19.camel@localhost.localdomain> <1168012905.6050.59.camel@lade.trondhjem.org> <1168017077.29243.38.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Trond Myklebust , Chaitanya Patti , linux-fsdevel Return-path: Received: from zeniv.linux.org.uk ([195.92.253.2]:33789 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422631AbXAERWO (ORCPT ); Fri, 5 Jan 2007 12:22:14 -0500 To: Shaya Potter Content-Disposition: inline In-Reply-To: <1168017077.29243.38.camel@localhost.localdomain> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Fri, Jan 05, 2007 at 12:11:17PM -0500, Shaya Potter wrote: > ok, I guess what I don't understand is when are > > dentry->d_sb->s_root and nd->mnt->mnt_root not equivalent. > > I guess it would be "when crossing a mountpoint on the server", so I > look at nfs_follow_mountpoint() and basically see that you create a new > mountpoint and a new nd for that. And since superblock objects are only > per "real" file system not per mount point, they will be different. > > I guess the question is, why shouldn't a dentry object know what > vfsmount it belongs to is? Can it belong to multiple vfsmount objects? Yes. dentry belongs to superblock. vfsmount refers to a subtree of some superblock's dentry tree. There can be any number of vfsmounts refering to subtrees of the same fs. Some might refer to the entire tree, some - to its arbitrary subtrees (possibly as small as a single file). There can be any number of vfsmounts refering to any given subtree. Think what happens when you create a binding. Or when you clone an entire namespace. (Pieces of) the same filesystem might be mounted in a lot of places. vfsmount describes a part of unified tree delimited by mountpoints; if the same fs (or its parts) are seen under several mountpoints, you get vfsmounts that refer to the same fs instance, i.e. the same superblock and dentry tree.