GIT: unionfs2-2.6.27.y: Unionfs: fixes to cache-coherency checking code

Erez Zadok ezk at fsl.cs.sunysb.edu
Thu Aug 12 23:16:51 EDT 2010


commit f3b395b45b5f1d15c41a4558f31c0fd38792e12d
Author: Erez_Zadok <ezk at cs.sunysb.edu>
Date:   Tue Jul 31 03:33:24 2007 -0400

    Unionfs: fixes to cache-coherency checking code
    
    Under memory pressure, in_newer_lower could be called on uninitialized
    dentries or inodes.  So return 0 safely in that case (rather than oops).
    This is OK because is_newer_lower will be called again on the same object(s)
    and cache-coherency will be validated and maintained then.
    
    Signed-off-by: Erez Zadok <ezk at cs.sunysb.edu>

diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c
index 11d898d..f3c1258 100644
--- a/fs/unionfs/dentry.c
+++ b/fs/unionfs/dentry.c
@@ -189,10 +189,15 @@ out:
 int is_newer_lower(const struct dentry *dentry)
 {
 	int bindex;
-	struct inode *inode = dentry->d_inode;
+	struct inode *inode;
 	struct inode *lower_inode;
 
-	if (!inode)
+	/* ignore if we're called on semi-initialized dentries/inodes */
+	if (!dentry || !UNIONFS_D(dentry))
+		return 0;
+	inode = dentry->d_inode;
+	if (!inode || !UNIONFS_I(inode) ||
+	    ibstart(inode) < 0 || ibend(inode) < 0)
 		return 0;
 
 	for (bindex = ibstart(inode); bindex <= ibend(inode); bindex++) {


More information about the unionfs-cvs mailing list