commit 3798f117738b1762b31059c74c6bca829d4de5d4
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date:   Thu Mar 29 14:59:40 2007 -0400

    cleanup thread to always cleanup everything on mounts/remounts

diff --git a/fs/unionfs/odf.c b/fs/unionfs/odf.c
index 81b2479..6890eb3 100644
--- a/fs/unionfs/odf.c
+++ b/fs/unionfs/odf.c
@@ -67,6 +67,7 @@ struct odf_sb_info* odf_read_super(char *options)
        }
        sioa->cleanup.odf = osi;
        sioa->cleanup.attr = get_attributes();
+       sioa->cleanup.force = 1;
        osi->cleanup = sioa;
        run_sioa(sioa, __odf_cleanup, 
                msecs_to_jiffies(sioa->cleanup.attr->timeout->val));
@@ -1343,7 +1344,12 @@ void __odf_cleanup(void *args)
        odi_ic = cl->odf->odi_ic;
        odf_lock(odi_ic);
        vfs_statfs(cl->odf->odi_sb->dentry, &stat);
-       if (stat.f_bavail * 100 < stat.f_blocks * (100 - 
cl->attr->thresh_b->val)) {
+       if (cl->force) {
+               cl->force = 0;
+               printk("unionfs cleanup thread: forced cleanup\n");
+               cleanup = 1;
+       }
+       else if (stat.f_bavail * 100 < stat.f_blocks * (100 - 
cl->attr->thresh_b->val)) {
                cleanup = 1;
                printk("unionfs cleanup thread: free blocks below critical 
size\n");
        }
diff --git a/fs/unionfs/sioq.h b/fs/unionfs/sioq.h
index 16ff555..6e542eb 100644
--- a/fs/unionfs/sioq.h
+++ b/fs/unionfs/sioq.h
@@ -36,6 +36,7 @@ struct unlink_args {
 struct cleanup_args {
        struct odf_sb_info *odf;
        struct unionfs_attributes *attr;
+       int force;
 };
 
 struct sioq_args {
diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index 510b81a..662d3c8 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -422,6 +422,7 @@ static int unionfs_remount_fs(struct super_block *sb, int 
*flags,
        struct unionfs_data *new_data = NULL, *tmp_data = NULL;
        struct path *new_lower_paths = NULL, *tmp_lower_paths = NULL;
        int new_high_branch_id; /* new high branch ID */
+       struct odf_sb_info *odf = UNIONFS_SB(sb)->odf;
 
        unionfs_write_lock(sb);
 
@@ -677,13 +678,12 @@ out_no_change:
        /* now update the odf. rewrite the superblock data file with all
         * the new branch information
         */
-       err = odf_write_sb_data(UNIONFS_SB(sb)->odf,
-                       new_data,
-                       new_lower_paths,
-                       new_branches);
+       err = odf_write_sb_data(odf, new_data, new_lower_paths, new_branches);
        if (err)
                goto out_release;
-        UNIONFS_SB(sb)->odf->opaque_branch_id = new_data[0].branch_id;
+       odf->opaque_branch_id = new_data[0].branch_id;
+       odf->cleanup->cleanup.force = 1;
+       wake_up_and_wait_sioa(odf->cleanup);
 
        /*
         * OK, just before we actually put the new set of branches in place,
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to