From: Herbert Poetzl Subject: unlink (inode_operations) Date: Sat, 5 Jul 2003 22:07:01 +0200 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <20030705200701.GB26995@www.13thfloor.at> Reply-To: herbert@13thfloor.at Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Cc: viro@parcelfarce.linux.theplanet.co.uk Return-path: Received: from www.13thfloor.at ([212.16.59.250]:8924 "EHLO www.13thfloor.at") by vger.kernel.org with ESMTP id S266442AbTGETwb (ORCPT ); Sat, 5 Jul 2003 15:52:31 -0400 To: linux-fsdevel@vger.kernel.org Content-Disposition: inline List-Id: linux-fsdevel.vger.kernel.org Hi All! I'm currently in the process of writing a filesystem which should do nothing but mediate each request to another filesystem (like a noop filter). (to save reading time, you can skip to LABEL HELP) I thought I do it the following way: - on mount a path is given as option this path is translated to an dentry which provides an inode which is 'cloned' and this cloned inode is used as root inode for this filesystem. - on readdir I do a dcache_readdir on the 'original' dentry and pass this back to the caller. - on lookup I do a d_lookup in the original filesystem, again the cloning and return the cloned inode. so far this seems to work reasonably well, now I tried to implement the unlink, again this would perform the unlink in the original filesystem and d_delete the dentry on success. now what I found was that ext2 seems not to d_delete the dentry at all, at least not when called from my code ... somewhere I copied the folowing description of unlink: called by the unlink(2) system call. Only required if you want to support deleting inodes. This should remove the name refered to by the dentry from the directory referred to by the inode. It should d_delete the dentry on success. ---------------------- LABEL HELP my code does the folowing: (o_dir is the 'original' directory inode, o_de the 'original' dentry ) label_a: if (o_dir->i_op && o_dir->i_op->unlink) ret = o_dir->i_op->unlink(o_dir, o_de); label_b: if (!ret) d_delete(de); between label_a and label_b I would expect the d_count of o_de to be decremented ... but this doesn't happen although the file referred to by o_de is unlinked ... obviously I've missed or misunderstood something, so could anybody explain what is (not) happening? TIA, Herbert