linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL -mm] 0/2 Unionfs updates/fixes/cleanups
@ 2007-12-08 20:46 Erez Zadok
  2007-12-08 20:46 ` [PATCH 1/2] Unionfs: cleanup/consolidate branch-mode parsing code Erez Zadok
  2007-12-08 20:46 ` [PATCH 2/2] Unionfs: reduce the amount of cache-coherency debugging messages Erez Zadok
  0 siblings, 2 replies; 5+ messages in thread
From: Erez Zadok @ 2007-12-08 20:46 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch


The following is a series of patches related to Unionfs: just a couple of
small bug fixes and/or optimizations.

These patches were tested (where appropriate) on Linus's 2.6.24 latest code
(as of v2.6.24-rc4-124-gf194d13), MM, as well as the backports to
2.6.{23,22,21,20,19,18,9} on ext2/3/4, xfs, reiserfs, nfs2/3/4, jffs2,
ramfs, tmpfs, cramfs, and squashfs (where available).  See
http://unionfs.filesystems.org/ to download back-ported unionfs code.

Please pull from the 'master' branch of
git://git.kernel.org/pub/scm/linux/kernel/git/ezk/unionfs.git

to receive the following:

Erez Zadok (2):
      Unionfs: cleanup/consolidate branch-mode parsing code
      Unionfs: reduce the amount of cache-coherency debugging messages

 dentry.c |   38 +++++++++++++++++++++++---------------
 main.c   |   44 ++++++++++++++++++++++----------------------
 super.c  |   12 ++++++++----
 union.h  |    3 +--
 4 files changed, 54 insertions(+), 43 deletions(-)

---
Erez Zadok
ezk@cs.sunysb.edu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] Unionfs: cleanup/consolidate branch-mode parsing code
  2007-12-08 20:46 [GIT PULL -mm] 0/2 Unionfs updates/fixes/cleanups Erez Zadok
@ 2007-12-08 20:46 ` Erez Zadok
  2007-12-08 20:46 ` [PATCH 2/2] Unionfs: reduce the amount of cache-coherency debugging messages Erez Zadok
  1 sibling, 0 replies; 5+ messages in thread
From: Erez Zadok @ 2007-12-08 20:46 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

Also a bug fix: disallow unrecognized branch modes at mount time, instead of
defaulting to "rw".

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/main.c  |   44 ++++++++++++++++++++++----------------------
 fs/unionfs/super.c |   12 ++++++++----
 fs/unionfs/union.h |    3 +--
 3 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index ffb0da1..22aa6e6 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -256,30 +256,21 @@ static int is_branch_overlap(struct dentry *dent1, struct dentry *dent2)
 }
 
 /*
- * Parse branch mode helper function
+ * Parse "ro" or "rw" options, but default to "rw" if no mode options was
+ * specified.  Fill the mode bits in @perms.  If encounter an unknown
+ * string, return -EINVAL.  Otherwise return 0.
  */
-int __parse_branch_mode(const char *name)
+int parse_branch_mode(const char *name, int *perms)
 {
-	if (!name)
+	if (!name || !strcmp(name, "rw")) {
+		*perms = MAY_READ | MAY_WRITE;
 		return 0;
-	if (!strcmp(name, "ro"))
-		return MAY_READ;
-	if (!strcmp(name, "rw"))
-		return (MAY_READ | MAY_WRITE);
-	return 0;
-}
-
-/*
- * Parse "ro" or "rw" options, but default to "rw" of no mode options
- * was specified.
- */
-int parse_branch_mode(const char *name)
-{
-	int perms = __parse_branch_mode(name);
-
-	if (perms == 0)
-		perms = MAY_READ | MAY_WRITE;
-	return perms;
+	}
+	if (!strcmp(name, "ro")) {
+		*perms = MAY_READ;
+		return 0;
+	}
+	return -EINVAL;
 }
 
 /*
@@ -350,8 +341,17 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info
 		if (mode)
 			*mode++ = '\0';
 
-		perms = parse_branch_mode(mode);
+		err = parse_branch_mode(mode, &perms);
+		if (err) {
+			printk(KERN_ERR "unionfs: invalid mode \"%s\" for "
+			       "branch %d\n", mode, bindex);
+			goto out;
+		}
+		/* ensure that leftmost branch is writeable */
 		if (!bindex && !(perms & MAY_WRITE)) {
+			printk(KERN_ERR "unionfs: leftmost branch cannot be "
+			       "read-only (use \"-o ro\" to create a "
+			       "read-only union)\n");
 			err = -EINVAL;
 			goto out;
 		}
diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index 88f77d7..d9cf2a7 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -181,8 +181,8 @@ static noinline int do_remount_mode_option(char *optarg, int cur_branches,
 		goto out;
 	}
 	*modename++ = '\0';
-	perms = __parse_branch_mode(modename);
-	if (perms == 0) {
+	err = parse_branch_mode(modename, &perms);
+	if (err) {
 		printk(KERN_ERR "unionfs: invalid mode \"%s\" for \"%s\"\n",
 		       modename, optarg);
 		goto out;
@@ -350,13 +350,17 @@ found_insertion_point:
 		modename = strchr(new_branch, '=');
 	if (modename)
 		*modename++ = '\0';
-	perms = parse_branch_mode(modename);
-
 	if (!new_branch || !*new_branch) {
 		printk(KERN_ERR "unionfs: null new branch\n");
 		err = -EINVAL;
 		goto out;
 	}
+	err = parse_branch_mode(modename, &perms);
+	if (err) {
+		printk(KERN_ERR "unionfs: invalid mode \"%s\" for "
+		       "branch \"%s\"\n", modename, new_branch);
+		goto out;
+	}
 	err = path_lookup(new_branch, LOOKUP_FOLLOW, &nd);
 	if (err) {
 		printk(KERN_ERR "unionfs: error accessing "
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 283b085..20bff7b 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -474,8 +474,7 @@ static inline int is_robranch(const struct dentry *dentry)
  */
 extern char *alloc_whname(const char *name, int len);
 extern int check_branch(struct nameidata *nd);
-extern int __parse_branch_mode(const char *name);
-extern int parse_branch_mode(const char *name);
+extern int parse_branch_mode(const char *name, int *perms);
 
 /*
  * These two functions are here because it is kind of daft to copy and paste
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] Unionfs: reduce the amount of cache-coherency debugging messages
  2007-12-08 20:46 [GIT PULL -mm] 0/2 Unionfs updates/fixes/cleanups Erez Zadok
  2007-12-08 20:46 ` [PATCH 1/2] Unionfs: cleanup/consolidate branch-mode parsing code Erez Zadok
@ 2007-12-08 20:46 ` Erez Zadok
  1 sibling, 0 replies; 5+ messages in thread
From: Erez Zadok @ 2007-12-08 20:46 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch, Erez Zadok

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/dentry.c |   38 +++++++++++++++++++++++---------------
 1 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c
index 05d9914..7d27987 100644
--- a/fs/unionfs/dentry.c
+++ b/fs/unionfs/dentry.c
@@ -195,9 +195,11 @@ out:
  * file system doesn't change its inode times quick enough, resulting in a
  * false positive indication (which is harmless, it just makes unionfs do
  * extra work in re-validating the objects).  To minimize the chances of
- * these situations, we delay the detection of changed times by
- * UNIONFS_MIN_CC_TIME (which defaults to 3 seconds, as with NFS's
- * acregmin).
+ * these situations, we still consider such small time changes valid, but we
+ * don't print debugging messages unless the time changes are greater than
+ * UNIONFS_MIN_CC_TIME (which defaults to 3 seconds, as with NFS's acregmin)
+ * because significant changes are more likely due to users manually
+ * touching lower files.
  */
 bool is_newer_lower(const struct dentry *dentry)
 {
@@ -219,20 +221,26 @@ bool is_newer_lower(const struct dentry *dentry)
 			continue;
 
 		/* check if mtime/ctime have changed */
-		if (unlikely((lower_inode->i_mtime.tv_sec -
-			      inode->i_mtime.tv_sec) > UNIONFS_MIN_CC_TIME)) {
-			pr_info("unionfs: new lower inode mtime "
-				"(bindex=%d, name=%s)\n", bindex,
-				dentry->d_name.name);
-			show_dinode_times(dentry);
+		if (unlikely(timespec_compare(&inode->i_mtime,
+					      &lower_inode->i_mtime) < 0)) {
+			if ((lower_inode->i_mtime.tv_sec -
+			     inode->i_mtime.tv_sec) > UNIONFS_MIN_CC_TIME) {
+				pr_info("unionfs: new lower inode mtime "
+					"(bindex=%d, name=%s)\n", bindex,
+					dentry->d_name.name);
+				show_dinode_times(dentry);
+			}
 			return true;
 		}
-		if (unlikely((lower_inode->i_ctime.tv_sec -
-			      inode->i_ctime.tv_sec) > UNIONFS_MIN_CC_TIME)) {
-			pr_info("unionfs: new lower inode ctime "
-				"(bindex=%d, name=%s)\n", bindex,
-				dentry->d_name.name);
-			show_dinode_times(dentry);
+		if (unlikely(timespec_compare(&inode->i_ctime,
+					      &lower_inode->i_ctime) < 0)) {
+			if ((lower_inode->i_ctime.tv_sec -
+			     inode->i_ctime.tv_sec) > UNIONFS_MIN_CC_TIME) {
+				pr_info("unionfs: new lower inode ctime "
+					"(bindex=%d, name=%s)\n", bindex,
+					dentry->d_name.name);
+				show_dinode_times(dentry);
+			}
 			return true;
 		}
 	}
-- 
1.5.2.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [GIT PULL -mm] 0/2 Unionfs updates/fixes/cleanups
@ 2007-12-14 15:47 Erez Zadok
  0 siblings, 0 replies; 5+ messages in thread
From: Erez Zadok @ 2007-12-14 15:47 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch


The following is a series of patches related to Unionfs.

These patches were tested (where appropriate) on Linus's 2.6.24 latest code
(as of v2.6.24-rc5-43-gda8cadb), MM (MMOTM stamp-2007-12-13-15-37), as well
as the backports to 2.6.{23,22,21,20,19,18,9} on ext2/3/4, xfs, reiserfs,
nfs2/3/4, jffs2, ramfs, tmpfs, cramfs, and squashfs (where available).  Also
tested with LTP-full.  See http://unionfs.filesystems.org/ to download
back-ported unionfs code.

Please pull from the 'master' branch of
git://git.kernel.org/pub/scm/linux/kernel/git/ezk/unionfs.git

to receive the following:

Erez Zadok (2):
      Unionfs: avoid using drop_pagecache_sb in remount
      Unionfs: clarify usage.txt mount options

 Documentation/filesystems/unionfs/usage.txt |   38 +++++++++++++++++++---------
 fs/drop_caches.c                            |    4 --
 fs/unionfs/dentry.c                         |   11 ++++++++
 fs/unionfs/super.c                          |   34 ++++++++-----------------
 fs/unionfs/union.h                          |    1 
 include/linux/mm.h                          |    2 -
 6 files changed, 52 insertions(+), 38 deletions(-)

---
Erez Zadok
ezk@cs.sunysb.edu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [GIT PULL -mm] 0/2 Unionfs updates/fixes/cleanups
@ 2008-05-09 20:07 Erez Zadok
  0 siblings, 0 replies; 5+ messages in thread
From: Erez Zadok @ 2008-05-09 20:07 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel, viro, hch


Just two small changes.

Please pull from the 'master' branch of
git://git.kernel.org/pub/scm/linux/kernel/git/ezk/unionfs.git

to receive the following:

Erez Zadok (2):
      Unionfs: use new umount_begin prototype
      Unionfs: move fs/Makefile entry up to minimize merge conflicts

 Makefile        |    2 +-
 unionfs/super.c |   19 ++++---------------
 2 files changed, 5 insertions(+), 16 deletions(-)

Thanks.
---
Erez Zadok
ezk@cs.sunysb.edu

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-05-09 20:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-08 20:46 [GIT PULL -mm] 0/2 Unionfs updates/fixes/cleanups Erez Zadok
2007-12-08 20:46 ` [PATCH 1/2] Unionfs: cleanup/consolidate branch-mode parsing code Erez Zadok
2007-12-08 20:46 ` [PATCH 2/2] Unionfs: reduce the amount of cache-coherency debugging messages Erez Zadok
  -- strict thread matches above, loose matches on Subject: below --
2007-12-14 15:47 [GIT PULL -mm] 0/2 Unionfs updates/fixes/cleanups Erez Zadok
2008-05-09 20:07 Erez Zadok

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).