From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerome de Vivie Subject: Re: [FiST] a problem with dget Date: Wed, 26 Mar 2003 21:43:12 +0100 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <3E8210E0.2FFDED78@free.fr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-fsdevel@vger.kernel.org, fist@cs.columbia.edu Return-path: To: Nir Tzachar List-Id: linux-fsdevel.vger.kernel.org Nir Tzachar wrote: >=20 > hello all. >=20 > i encountered a strange problem, involving the reference count of > dentries. >=20 > first, let me describe my file system (i'll be brief.. ): > im implementing a file system which is supposed to emulate an object > storage device. i use a wrapper like file system (much like wrapfs, > and actually based on it) to store files on an underlying f/s as obje= cts. >=20 > i hope someone can help me, i've been tackling this problem for more = than > a week: when i create a file(say "tmp"), all is fine. > the problem arises when i umount and then remount the file system. > after im done with lookup (inode->i_op->lookup), dentry->d_count.coun= ter > =3D=3D1, as should be. but, when i enter the unlink function > (inode->i_op->unlink ) its dentry->d_count.counter =3D=3D 0 . why is = that? > nowhere in the vfs code does anyone decreases the counter b4 > inode->i_op->unlink is called . am i right? This counter should at least be at 1. You should do a dget before each lower level call and a dput after (in case the dentry is freed by another process when you are inside unlink). Tracking usage count is no= t easy, you can try this macro inside "lookup" and "d_release": #if 1 /* for debugging dget/dput */ #define dcount(x) printk("(%s):%i at %s:%i\n",(x)->d_name.name, atomic_read(&(x)->d_count), __FILE__, __LINE__) #else #define dcount(x) #endif Try also to unmount the lower level fs. If there are pending dentries, you will see this message: "VFS: Busy inodes after unmount. Self-destruct in 5 seconds. Have a nice day..." regards, j. --=20 J=E9r=F4me de Vivie - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html