[patch 1/3] dentry->d_count fixes

From: Maneesh Soni (maneesh@in.ibm.com)
Date: Thu Jun 19 2003 - 08:10:13 EST


- 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/



This archive was generated by hypermail 2b29 : Mon Jun 23 2003 - 22:00:29 EST