commit 1992bd44fd52b3845f9673518f97fe3a8eb5d3c7
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date: Thu Mar 29 15:59:10 2007 -0400
added odfforce mount/remount option
diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index a261736..1d8298e 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -429,6 +429,10 @@ static struct unionfs_dentry_info
*unionfs_parse_options(struct super_block *sb,
optarg = strchr(optname, '=');
if (optarg)
*optarg++ = '\0';
+
+ /* taken care of in odf_parse_options */
+ if (!strcmp("odfforce", optname))
+ continue;
/* All of our options take an argument now. Insert ones that
* don't, above this check.
@@ -452,6 +456,7 @@ static struct unionfs_dentry_info
*unionfs_parse_options(struct super_block *sb,
continue;
}
+ /* taken care of in odf_parse_options */
if (!strcmp("odf", optname))
continue;
diff --git a/fs/unionfs/odf.c b/fs/unionfs/odf.c
index 6890eb3..007f84a 100644
--- a/fs/unionfs/odf.c
+++ b/fs/unionfs/odf.c
@@ -9,11 +9,11 @@ struct odf_sb_info* odf_read_super(char *options)
struct odf_sb_info *osi;
char *odffile = NULL;
struct sioa_args *sioa;
- int err = 0;
+ int err, odfforce;
- err = odf_parse_options(options, &odffile);
- if (err) {
- osi = ERR_PTR(err);
+ odfforce = odf_parse_options(options, &odffile);
+ if (odfforce < 0) {
+ osi = ERR_PTR(odfforce);
goto out;
}
@@ -67,7 +67,7 @@ struct odf_sb_info* odf_read_super(char *options)
}
sioa->cleanup.odf = osi;
sioa->cleanup.attr = get_attributes();
- sioa->cleanup.force = 1;
+ 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));
@@ -165,17 +165,25 @@ out:
printk("unionfs: Invalid odf\n");
return err;
}
+
+/* returns 1 if odfforce found, 0 if not */
int odf_parse_options(char *options, char **odf_path)
{
int err = 0;
char *ptr, *ptrend;
- ptr = strstr(options,"odf=");
+ /* check for odf= part of the options */
+ if (!strncmp(options, "odf=", 4))
+ ptr = options;
+ else
+ ptr = strstr(options,",odf=");
if (!ptr) {
err = -EINVAL;
printk("unionfs: odf option required\n");
goto out;
}
+ if (ptr != options)
+ ptr++;
ptr+=4;
ptrend = (strchr(ptr, ','));
if (!ptrend)
@@ -188,6 +196,27 @@ int odf_parse_options(char *options, char **odf_path)
}
*odf_path = kzalloc(ptrend - ptr + 1,GFP_KERNEL);
strncpy(*odf_path, ptr, ptrend - ptr);
+
+ /* now check for odfforce */
+ if (!strncmp(options, "odfforce", 8))
+ ptr = options;
+ else
+ ptr = strstr(options,",odfforce");
+ if (ptr) {
+ if (ptr != options)
+ ptr++;
+ ptr+=8;
+ ptrend = (strchr(ptr, ','));
+ if (!ptrend)
+ ptrend = ptr + strlen(ptr);
+ if (ptr != ptrend) {
+ printk("unionfs: odfforce option does not take an
argument\n");
+ err = -EINVAL;
+ goto out;
+ }
+ err = 1;
+ }
+ else err = 0;
out:
return err;
}
diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index 662d3c8..4ae492f 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -423,6 +423,7 @@ static int unionfs_remount_fs(struct super_block *sb, int
*flags,
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;
+ int odfforce = 0 ; /* whether the odfforce option was provided */
unionfs_write_lock(sb);
@@ -553,6 +554,16 @@ static int unionfs_remount_fs(struct super_block *sb, int
*flags,
goto out_no_change;
}
+ if (!strcmp("odfforce", optname)) {
+ if (optarg) {
+ printk("unionfs: %s does not take an
argument\n", optname);
+ err = -EINVAL;
+ goto out_release;
+ }
+ odfforce = 1;
+ continue;
+ }
+
/*
* All of our options take an argument now. (Insert ones
* that don't above this check.) So at this stage optname
@@ -682,8 +693,14 @@ out_no_change:
if (err)
goto out_release;
odf->opaque_branch_id = new_data[0].branch_id;
- odf->cleanup->cleanup.force = 1;
- wake_up_and_wait_sioa(odf->cleanup);
+
+ /* if odfforce is not set, wake up the cleanup thread and force it to
+ * cleanup everything
+ */
+ if (!odfforce) {
+ 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