commit 58197260a9e83f2bfdf9a9b0e64ec5f68414d029
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date:   Tue Apr 3 16:52:50 2007 -0400

    start cleanup thread only if everything ok in unionfs_read_super

diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index 203056b..63b5c0c 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -538,6 +538,7 @@ static int unionfs_read_super(struct super_block *sb, void 
*raw_data,
        int err = 0;
 
        struct unionfs_dentry_info *hidden_root_info = NULL;
+       struct odf_sb_info *odf;
        int bindex, bstart, bend;
        char *odf_options = NULL;
        int *bid = NULL, high_bid;
@@ -577,13 +578,14 @@ static int unionfs_read_super(struct super_block *sb, 
void *raw_data,
                UNIONFS_SB(sb)->odf = NULL;
                goto out_free;
        }
+       odf = UNIONFS_SB(sb)->odf;
        put_ns = 1;
 
        /* if this is an old odf reconstruct the dirs part of the mount time 
options
         * from the odf data on disk and discard the old options
         */
-       if (!odf_is_new(UNIONFS_SB(sb)->odf)) {
-               odf_options = odf_read_sb_data(UNIONFS_SB(sb)->odf, &bid);
+       if (!odf_is_new(odf)) {
+               odf_options = odf_read_sb_data(odf, &bid);
                if (IS_ERR(odf_options)) {
                        printk(KERN_WARNING "unionfs_read_super: could not load 
options from odf\n");
                        err = PTR_ERR(odf_options);
@@ -594,7 +596,7 @@ static int unionfs_read_super(struct super_block *sb, void 
*raw_data,
                        printk(KERN_WARNING "unionfs: Ignoring dirs option\n");
                raw_data = odf_options;
        }
-       
+
        hidden_root_info = unionfs_parse_options(sb, raw_data);
        if (IS_ERR(hidden_root_info)) {
                printk(KERN_WARNING
@@ -610,24 +612,22 @@ static int unionfs_read_super(struct super_block *sb, 
void *raw_data,
        }
 
        /* if new bit set, unset it and save branch conf */           
-       if (odf_is_new(UNIONFS_SB(sb)->odf)) {
+       if (odf_is_new(odf)) {
 
                /* generate new uuids */
-               err = odf_update_uuids(UNIONFS_SB(sb)->odf, NULL, 0,
+               err = odf_update_uuids(odf, NULL, 0,
                                hidden_root_info->lower_paths,
                                hidden_root_info->bend - 
hidden_root_info->bstart + 1);
                if (err)
                        goto out_free;
 
-               err = odf_write_sb_data(
-                               UNIONFS_SB(sb)->odf,
-                               UNIONFS_SB(sb)->data,
+               err = odf_write_sb_data(odf,UNIONFS_SB(sb)->data,
                                hidden_root_info->lower_paths,
                                hidden_root_info->bend - 
hidden_root_info->bstart + 1);
                if (err)
                        goto out_free;
                /* here we can safely mark the odf as not new */
-               odf_unset_newbit(UNIONFS_SB(sb)->odf);
+               odf_unset_newbit(odf);
        }
 
        /* set the hidden superblock field of upper superblock */
@@ -655,7 +655,7 @@ static int unionfs_read_super(struct super_block *sb, void 
*raw_data,
        }
        if (high_bid > UNIONFS_SB(sb)->high_branch_id)
                 UNIONFS_SB(sb)->high_branch_id = high_bid;
-       UNIONFS_SB(sb)->odf->opaque_branch_id = branch_id(sb, 0);
+       odf->opaque_branch_id = branch_id(sb, 0);
 
        /* Unionfs: Max Bytes is the maximum bytes from highest priority branch 
*/
        unionfs_read_lock(sb);
@@ -691,8 +691,7 @@ static int unionfs_read_super(struct super_block *sb, void 
*raw_data,
        set_dbend(sb->s_root, bend);
        
        /* save odf root dentry */
-       UNIONFS_D(sb->s_root)->odf_info = 
-                       UNIONFS_SB(sb)->odf->odi_ns;
+       UNIONFS_D(sb->s_root)->odf_info = UNIONFS_SB(sb)->odf->odi_ns;
        put_ns = 0;
        
        /* Set the generation number to one, since this is for the mount. */
@@ -701,8 +700,12 @@ static int unionfs_read_super(struct super_block *sb, void 
*raw_data,
        /* call interpose to create the upper level inode */
        err = unionfs_interpose(sb->s_root, sb, 0);
        unionfs_unlock_dentry(sb->s_root);
-       if (!err)
+       if (!err) {
+               /* its now ok to start the cleanup thread */
+               run_sioa(odf->cleanup, __odf_cleanup,
+                       
msecs_to_jiffies(odf->cleanup->cleanup.attr->timeout->val));
                goto out;
+       }
        /* else fall through */
 
 out_freedpd:
@@ -733,6 +736,10 @@ out_dput:
 
 out_free:
        if (UNIONFS_SB(sb)->odf) {
+               /* cleanup thread is not started,free it here so 
+                * odf_put_super doesnt wait for it */
+               kfree(UNIONFS_SB(sb)->odf->cleanup);
+               UNIONFS_SB(sb)->odf->cleanup = NULL;
                if (put_ns)
                        odf_put_info(UNIONFS_SB(sb)->odf->odi_ns);
                odf_put_super(UNIONFS_SB(sb)->odf);
diff --git a/fs/unionfs/odf.c b/fs/unionfs/odf.c
index b49872e..a6176b1 100644
--- a/fs/unionfs/odf.c
+++ b/fs/unionfs/odf.c
@@ -69,8 +69,6 @@ struct odf_sb_info* odf_read_super(char *options)
        sioa->cleanup.attr = get_attributes();
        sioa->cleanup.force = !odfforce; /* if set we dont force clean*/
        osi->cleanup = sioa;
-       run_sioa(sioa, __odf_cleanup, 
-               msecs_to_jiffies(sioa->cleanup.attr->timeout->val));
        osi->mnt = nd.mnt;
        mntget(osi->mnt);
        dget(osi->mnt->mnt_sb->s_root);
@@ -104,7 +102,8 @@ void odf_put_super(struct odf_sb_info *osi)
        odf_put_info(osi->odi_ic);
        dput(osi->mnt->mnt_sb->s_root);
        mntput(osi->mnt);
-       complete_sioa(osi->cleanup);
+       if (osi->cleanup)
+               complete_sioa(osi->cleanup);
        kfree(osi->cleanup);
 }
 
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to