[Unionfs] unionfs-2.5_for_2.6.27-rc6 and Kernels 2.6.27 to 2.6.27.4

Erez Zadok ezk at cs.sunysb.edu
Thu Nov 6 13:21:11 EST 2008


In message <49133485.5060905 at msgid.tls.msk.ru>, Michael Tokarev writes:
> Daniel Reichelt wrote:
> > Hi list,
> > 
> > I have an unionfs mount setup like this:
> > 
> > # mkdir br1 br2 rwunion
> > # mount -t nfs -o ro server:/nfsexport /br2
> > # mount -t unionfs -o dirs=/br1=rw:/br2=ro none /rwunion/
> > 
> > So far so good. When I try to add new files or remove files that pre-existed on
> > the ro-nfs branch, that works just fine. However appending/chaning files
> > originating from the ro-nfs branch, I get this:
> > 
> > # ls -la /br1
> > # ls -la /br2
> > -rw-r--r-- 1 root root   55 2008-11-06 04:41 test
> > 
> > # ls -la /rwunion
> > -rw-r--r-- 1 root root   55 2008-11-06 04:41 test
> > 
> > # echo >test
> > bash: test: Permission denied
> 
> This is matches my expirence as well.  Quite annoying sometimes... :)

Did you try this patch which I posted a while back?  Let me know if it works
for you or not.  If not, I'll dig deeper and see what's going on.

Cheers,
Erez.


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 bbd49c8..5b6ff23 100644
--- a/fs/unionfs/copyup.c
+++ b/fs/unionfs/copyup.c
@@ -519,8 +519,17 @@ out_free:
 		dput(old_lower_dentry);
 	kfree(symbuf);
 
-	if (err)
+	if (err) {
+		/*
+		 * if directory creation succeeeded, 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 mailing list