lkml.org 
[lkml]   [2003]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 1/3] dentry->d_count fixes


- d_invalidate() can incorrectly return success instead of returning -EBUSY
as we can have situations where lockless d_lookup has found a dentry
successfully before d_invalidate drops it



fs/dcache.c | 3 +++
1 files changed, 3 insertions(+)

diff -puN fs/dcache.c~d_invalidate-fix fs/dcache.c
--- linux-2.5.72-mm2/fs/dcache.c~d_invalidate-fix 2003-06-19 17:34:38.000000000 +0530
+++ linux-2.5.72-mm2-maneesh/fs/dcache.c 2003-06-19 17:35:14.000000000 +0530
@@ -232,14 +232,17 @@ int d_invalidate(struct dentry * dentry)
* we might still populate it if it was a
* working directory or similar).
*/
+ spin_lock(&dentry->d_lock);
if (atomic_read(&dentry->d_count) > 1) {
if (dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode)) {
+ spin_unlock(&dentry->d_lock);
spin_unlock(&dcache_lock);
return -EBUSY;
}
}

__d_drop(dentry);
+ spin_unlock(&dentry->d_lock);
spin_unlock(&dcache_lock);
return 0;
}
_
--
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/

\
 
 \ /
  Last update: 2005-03-22 13:36    [W:1.151 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site