[Unionfs] interpose hard-link bug

hooanon05 at yahoo.co.jp hooanon05 at yahoo.co.jp
Wed Mar 1 01:12:56 EST 2006


There is a bug in unionfs_interpose() in main.c.
When the target entry is hard-linked, the unionfs inode will be broken.

Junjiro Okajima

--- unionfs-20060221-0341/main.c	23 Feb 2006 00:47:37 -0000	1.1
+++ unionfs-20060221-0341/main.c	27 Feb 2006 21:05:38 -0000	1.2
@@ -81,6 +81,7 @@ int unionfs_interpose(struct dentry *den
 			err = -ENOMEM;
 			goto out;
 		}
+		mutex_lock(&inode->i_mutex);
 	} else {
 		ino_t ino;
 		/* get unique inode number for unionfs */
@@ -101,11 +102,11 @@ int unionfs_interpose(struct dentry *den
 			err = -EACCES;	/* should be impossible??? */
 			goto out;
 		}
-	}
 
-	mutex_lock(&inode->i_mutex);
-	if (atomic_read(&inode->i_count) > 1)
-		goto skip;
+		mutex_lock(&inode->i_mutex);
+		if (atomic_read(&inode->i_count) > 1)
+			goto skip;
+	}
 
 	for (bindex = bstart; bindex <= bend; bindex++) {
 		hidden_dentry = dtohd_index(dentry, bindex);




More information about the unionfs mailing list