From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: aliased directories, was Re: 2.6.8.1-mm2 Date: Thu, 19 Aug 2004 10:39:47 +0100 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <20040819103947.A7445@infradead.org> References: <20040819014204.2d412e9b.akpm@osdl.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org Return-path: Received: from imladris.demon.co.uk ([193.237.130.41]:12295 "EHLO phoenix.infradead.org") by vger.kernel.org with ESMTP id S264346AbUHSJjz (ORCPT ); Thu, 19 Aug 2004 05:39:55 -0400 To: Andrew Morton , viro@parcelfarce.linux.theplanet.co.uk, reiser@namesys.com Content-Disposition: inline In-Reply-To: <20040819014204.2d412e9b.akpm@osdl.org>; from akpm@osdl.org on Thu, Aug 19, 2004 at 01:42:04AM -0700 List-Id: linux-fsdevel.vger.kernel.org > +reiser4-aliased-dir.patch Looks like we're getting hardlinks on directories through the backdoor now. Hans, are you volunteering to audit the VFS for all the other assumptions? From: Hans Reiser Reiser4 pseudo files exist within regular files also. For example, "/etc/passwd/..uid" is a valid path. This introduces situation impossible in the traditional UNIX file system: non-leaf object in file system name-space tree ("/etc/passwd"), may have more than one name (nlink > 1). But in normal UNIX file system all non-leaf objects are directories, and directories cannot have multiple names. Specifically, directory can have only one dentry. During rename(2) this is used to check whether file is renamed within the same directory and moved to another one. This check doesn't work in reiser4 as is. Fix it. Signed-off-by: Andrew Morton --- 25-akpm/fs/namei.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -puN fs/namei.c~reiser4-aliased-dir fs/namei.c --- 25/fs/namei.c~reiser4-aliased-dir Wed Aug 18 16:42:44 2004 +++ 25-akpm/fs/namei.c Wed Aug 18 16:42:44 2004 @@ -1169,7 +1169,7 @@ struct dentry *lock_rename(struct dentry { struct dentry *p; - if (p1 == p2) { + if (p1->d_inode == p2->d_inode) { down(&p1->d_inode->i_sem); return NULL; } @@ -1200,7 +1200,7 @@ struct dentry *lock_rename(struct dentry void unlock_rename(struct dentry *p1, struct dentry *p2) { up(&p1->d_inode->i_sem); - if (p1 != p2) { + if (p1->d_inode != p2->d_inode) { up(&p2->d_inode->i_sem); up(&p1->d_inode->i_sb->s_vfs_rename_sem); } _