commit 5bdac3142f7aaa6300c6f74fe5e5172c1653e83f
Author: Erez Zadok <[EMAIL PROTECTED](none)>
Date:   Fri May 18 01:45:18 2007 -0400

    bug fix: retry lookup for different silly-renamed files
    
    When we have to copyup an open-but-unlinked file, we have to give it a
    temporary name, similar to NFS's silly-renamed files.  So we generate
    temporary file names until we find one that doesn't exist, and use it.  The
    code had a bug where if the silly-renamed file name already existed, Unionfs
    would oops upon copyup to that temp name.

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 919378a..7a2b218 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -50,6 +50,7 @@ static int copyup_deleted_file(struct file *file, struct 
dentry *dentry,
         * the name exists in the dest branch, but it'd be nice to catch it
         * sooner than later.
         */
+retry:
        tmp_dentry = NULL;
        do {
                char *suffix = name + nlen - countersize;
@@ -73,8 +74,11 @@ static int copyup_deleted_file(struct file *file, struct 
dentry *dentry,
 
        err = copyup_named_file(dentry->d_parent->d_inode, file, name, bstart,
                                bindex, file->f_dentry->d_inode->i_size);
-       if (err)
+       if (err) {
+               if (err == -EEXIST)
+                       goto retry;
                goto out;
+       }
 
        /* bring it to the same state as an unlinked file */
        hidden_dentry = unionfs_lower_dentry_idx(dentry, dbstart(dentry));
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to