GIT: unionfs2-2.6.27.y: Unionfs: handle partial copyup errors gracefully

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


commit 19bcf7498e952fd3fd5c26bedaf04522563539f1
Author: Erez Zadok <ezk at cs.sunysb.edu>
Date:   Fri Nov 7 16:51:13 2008 -0500

    Unionfs: handle partial copyup errors gracefully
    
    Don't leave any dentries behind if copying up the inode (or setting its
    permission, i.e., using TOMOYO) failed.
    
    CC: Tetsuo Handa <penguin-kernel at i-love.sakura.ne.jp>
    Signed-off-by: Erez Zadok <ezk at cs.sunysb.edu>

diff --git a/fs/unionfs/copyup.c b/fs/unionfs/copyup.c
index ae6ea2b..3b1ab73 100644
--- a/fs/unionfs/copyup.c
+++ b/fs/unionfs/copyup.c
@@ -518,8 +518,17 @@ out_free:
 		dput(old_lower_dentry);
 	kfree(symbuf);
 
-	if (err)
+	if (err) {
+		/*
+		 * if directory creation succeeded, but inode copyup failed,
+		 * then purge new dentries.
+		 */
+		if (dbstart(dentry) < old_bstart &&
+		    ibstart(dentry->d_inode) > dbstart(dentry))
+			__clear(dentry, NULL, old_bstart, old_bend,
+				unionfs_lower_dentry(dentry), dbstart(dentry));
 		goto out;
+	}
 	if (!S_ISDIR(dentry->d_inode->i_mode)) {
 		unionfs_postcopyup_release(dentry);
 		if (!unionfs_lower_inode(dentry->d_inode)) {


More information about the unionfs-cvs mailing list