commit 8ad883b9ca85d017e5423752c2a7c04383d23bce
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date:   Wed Feb 21 17:57:48 2007 -0500

    bugs

diff --git a/fs/unionfs/dirhelper.c b/fs/unionfs/dirhelper.c
index 0123f8f..a8e7ab5 100644
--- a/fs/unionfs/dirhelper.c
+++ b/fs/unionfs/dirhelper.c
@@ -216,7 +216,7 @@ int odf_cache_dir(struct dentry *d_upper, struct dentry 
*d_odf)
        
        /* compare mtimes, do not proceed if equal */
        if (i_odf && i_odf->i_size) { 
-               if( timespec_equal(&i_odf->i_mtime, 
+               if(timespec_equal(&i_odf->i_mtime,
                                &d_upper->d_inode->i_mtime))
                goto out;
                
@@ -231,7 +231,6 @@ int odf_cache_dir(struct dentry *d_upper, struct dentry 
*d_odf)
                err = notify_change(d_odf, &attr);
                if (err)
                        goto out;
-
        }
        odf_file = dentry_open(d_odf,
                        UNIONFS_SB(sb)->odf->mnt,
diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index 18e8a49..34e5219 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -75,7 +75,8 @@ int unionfs_interpose(struct dentry *dentry, struct 
super_block *sb, int flag)
                if (!UNIONFS_D(dentry)->odf_info)
                        err = odf_lookup(dentry->d_parent, dentry, odf_flag);
                if (err){
-                       printk("unionfs_interpose: odf failed to create 
dentry\n");
+                       printk("unionfs_interpose: odf failed to create dentry: 
%s, %d\n", 
+                               dentry->d_name.name, err);
                        goto out;
                }
                /* check whiteouts and opaqueness */
diff --git a/fs/unionfs/odf.c b/fs/unionfs/odf.c
index 9cc90d7..94ba039 100644
--- a/fs/unionfs/odf.c
+++ b/fs/unionfs/odf.c
@@ -250,11 +250,14 @@ struct odf_dentry_info *__odf_lookup(struct 
odf_dentry_info *parent, const char
        struct dentry *odf_dentry;
        struct odf_dentry_info *odi = old_odi;
        struct inode *odf_i_dir = parent->dentry->d_inode;
-       int err = 0;
+       int opaque, err = 0;
+       uid_t olduid;
+       gid_t oldgid;
        
        odf_dentry = lookup_one_len(name, parent->dentry, len);
        
        if (IS_ERR(odf_dentry)) {
+               printk("odf_lookup: failed to lookup %s\n", name);
                odf_put_info(old_odi);
                odi = (struct odf_dentry_info *)odf_dentry;
                goto out;
@@ -275,34 +278,44 @@ struct odf_dentry_info *__odf_lookup(struct 
odf_dentry_info *parent, const char
                if (name[0]=='.')
                        BUG_ON(len==1 || (name[1]=='.'&&len==2));
        
+               olduid = current->fsuid;
+               oldgid = current->fsgid;
+
                /* FIXME need to check hardlinks before create */
                odf_lock(parent); /* lock parent */
 
-               if (flags & ODF_LOOKUP_FILE)
+               if (flags & ODF_LOOKUP_FILE) {
+                       current->fsuid = 0;
+                       current->fsgid = 0;
                        err = vfs_create(odf_i_dir, odf_dentry, S_IRWXUGO, 0 );
-
-               else if (flags & ODF_LOOKUP_DIR)
+               }
+               else if (flags & ODF_LOOKUP_DIR) {
+                       current->fsuid = 0;
+                       current->fsgid = 0;
                        err = vfs_mkdir(odf_i_dir, odf_dentry, S_IRWXUGO);
-
+               }
                else {
                        dput(odf_dentry);
                        odf_unlock(parent);
                        goto out;
                }
+               odf_unlock(parent);
+
+               current->fsuid = oldgid;
+               current->fsgid = olduid;
+
                if (err) {
-                       printk(KERN_WARNING "odf_lookup: could not create odf 
dentry" );
+                       printk(KERN_WARNING "odf_lookup: could not create odf 
dentry %s, %d\n", name, err);
+                       dput(odf_dentry);
                        odf_put_info(old_odi);
                        odi = ERR_PTR(err); 
                        goto out;
                }
 
-               odf_unlock(parent);
 
                /* set opaqueness to 0 or -1 */
-               if (flags & ODF_LOOKUP_OPQ)
-                       __odf_set_opaque(odf_dentry->d_inode,0);
-               else    
-                       __odf_set_opaque(odf_dentry->d_inode,-1);
+               opaque = (flags & ODF_LOOKUP_OPQ) ? 0 : -1;
+               __odf_set_opaque(odf_dentry->d_inode, opaque);
                __odf_set_wh(odf_dentry->d_inode,0);
        }
        else {
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to