Messages in this thread Patch in this message | | | Date | Thu, 19 Jun 2003 18:40:46 +0530 | From | Maneesh Soni <> | Subject | [patch 2/3] dentry->d_count fixes |
| |
- nfs_unlink() can race with lockless d_lookup() as d_lookup() can successfully lookup a dentry for which nfs_unlink() can assume that no one else is using and can go ahead and do nfs_safe_remove() on it. By using per dentry lock, it is solved as we d_lookup() will fail the lookup for unhashed dentries.
fs/nfs/dir.c | 3 +++ 1 files changed, 3 insertions(+)
diff -puN fs/nfs/dir.c~nfs_unlink-d_count-fix fs/nfs/dir.c --- linux-2.5.72-mm2/fs/nfs/dir.c~nfs_unlink-d_count-fix 2003-06-19 17:38:51.000000000 +0530 +++ linux-2.5.72-mm2-maneesh/fs/nfs/dir.c 2003-06-19 17:38:56.000000000 +0530 @@ -1015,7 +1015,9 @@ static int nfs_unlink(struct inode *dir, lock_kernel(); spin_lock(&dcache_lock); + spin_lock(&dentry->d_lock); if (atomic_read(&dentry->d_count) > 1) { + spin_unlock(&dentry->d_lock); spin_unlock(&dcache_lock); error = nfs_sillyrename(dir, dentry); unlock_kernel(); @@ -1025,6 +1027,7 @@ static int nfs_unlink(struct inode *dir, __d_drop(dentry); need_rehash = 1; } + spin_unlock(&dentry->d_lock); spin_unlock(&dcache_lock); error = nfs_safe_remove(dentry); if (!error) _ -- Maneesh Soni IBM Linux Technology Center, IBM India Software Lab, Bangalore. Phone: +91-80-5044999 email: maneesh@in.ibm.com http://lse.sourceforge.net/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |