Skip to contentSkip to conversation

00/19 fsstack+Unionfs updates/fixes/cleanups

GIT PULL New Erez Zadok 1 participant 20 messages Jul 30, 2008 VFS

lore
Share & tools
lore

Erez Zadok

author
#0 lore raw

The following is a series of patchsets related to Unionfs, and one for fsstack. This series includes four types of changes:

1. Fold in Hugh Dickins's fsstack_copy_inode_size fix. Since it depends on code in unionfs, I'm temporarily folding this patch into my tree. I'll extract it into a separate patch which can be applied cleanly against 2.6.27-rc in the next few days.

2. Assorted fixes to adderess VFS API changes in 2.6.26/2.6.27-rc1:
->symlink, ->permission, nameidata intent flags changed, and kmem_cache_create prototype changed.

3. Extracted all whiteout related code into a separate file, and cleaned it up a lot. Now the main unionfs code calls somewhat generic functions such as "check if there's a whiteout" or "create a whiteout" and the like. Once Bharata whiteout code makes it in, it would be easy to make unionfs use filesystem-native whiteout support.

4. Reworked much of the lookup code in unionfs to ensure that we have a vfsmount at every lookup stage, esp. when crossing directories. In particular, started using vfs_path_lookup instead of lookup_one_len. These changes are a first but important step towards getting rid of all vfs_* calls within unionfs in preparation for having Miklos's path_* calls.

There were also a few smaller bug fixes: memleak (also from Hugh Dickins), some cache coherency fixes, and a fix to an LTP/rename13 regression.

These patches were tested (where appropriate) on v2.6.27-rc1, MM, as well as the backports to 2.6.{26,25,24,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-20080630 and with a continuous parallel kernel compile (while forcing cache flushing, manipulating lower branches, etc.). 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 (18):
Unionfs: simplify the macros used to get/set the dentry start/end branches
Unionfs: move a rename helper closer to rename code
Unionfs: create and consolidate helpers to iput lower objects
Unionfs: create and consolidate helpers to path-put lower objects
Unionfs: simplify stale-inode detection code
Unionfs: overhaul whiteout code
Unionfs: lookup overhaul using vfs_path_lookup
Unionfs: free lower paths array when destroying dentry's private data
Unionfs: cache coherency fixes
Unionfs: remove old lookup code
Unionfs: update maintainers
Unionfs: update copyrights
Unionfs: minor checkpatch fixes
Unionfs: properly hash newly created inodes
Unionfs: symlink no longer takes a mode parameter
Unionfs: permission no longer takes a nameidata parameter
Unionfs: LOOKUP_ACCESS intent no longer exists
Unionfs: use new kmem_cache_create constructor prototype

Hugh Dickins (1):
LTP's iogen01 doio tests used to hang nicely on 32-bit SMP when /tmp was a

 MAINTAINERS              |    3 
 fs/stack.c               |   58 ++-
 fs/unionfs/Makefile      |    2 
 fs/unionfs/commonfops.c  |   32 -
 fs/unionfs/copyup.c      |   45 +-
 fs/unionfs/debug.c       |    8 
 fs/unionfs/dentry.c      |  123 +++----
 fs/unionfs/dirfops.c     |   28 -
 fs/unionfs/dirhelper.c   |  130 -------
 fs/unionfs/fanout.h      |  158 ++++++---
 fs/unionfs/file.c        |    6 
 fs/unionfs/inode.c       |  225 ++-----------
 fs/unionfs/lookup.c      |  769 ++++++++++++++++++++---------------------------
 fs/unionfs/main.c        |   40 --
 fs/unionfs/mmap.c        |    6 
 fs/unionfs/rdstate.c     |    6 
 fs/unionfs/rename.c      |  206 ++++--------
 fs/unionfs/sioq.c        |   26 -
 fs/unionfs/sioq.h        |    7 
 fs/unionfs/subr.c        |  209 ------------
 fs/unionfs/super.c       |   22 -
 fs/unionfs/union.h       |   58 +--
 fs/unionfs/unlink.c      |   28 -
 fs/unionfs/whiteout.c    |  577 +++++++++++++++++++++++++++++++++++
 fs/unionfs/xattr.c       |    6 
 include/linux/fs_stack.h |    3 
 include/linux/union_fs.h |    6 
 27 files changed, 1384 insertions(+), 1403 deletions(-)

Thanks.
---
Erez Zadok
[email protected]

author
#1 lore raw

PATCH 1/19 LTP's iogen01 doio tests used to hang nicely on 32-bit SMP when /tmp was a

From: Hugh Dickins <[email protected]>

But akpm was dissatisfied with the resulting patch: its lack of commentary, the #ifs, the nesting around i_size_read, the lack of attention to i_blocks. I promised to redo it with the general spin_lock_32bit() he proposed; but disliked the result, partly because "32bit" obscures the real constraints, which are best commented within fsstack_copy_inode_size itself.

This version adds those comments, and uses sizeof comparisons which the compiler can optimize out, instead of CONFIG_SMP, CONFIG_LSF. BITS_PER_LONG.

---
 fs/stack.c               |   58 ++++++++++++++++++++++++++++++++++++++-------
 include/linux/fs_stack.h |    3 +-
 2 files changed, 50 insertions(+), 11 deletions(-)
fs/stack.c +49 -9
index 4336f2b..a66ff6c 100644
@@ -19,16 +19,56 @@
  * This function cannot be inlined since i_size_{read,write} is rather
  * heavy-weight on 32-bit systems
  */
-void fsstack_copy_inode_size(struct inode *dst, const struct inode *src)
+void fsstack_copy_inode_size(struct inode *dst, struct inode *src)
 {
-#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
-	spin_lock(&dst->i_lock);
-#endif
-	i_size_write(dst, i_size_read(src));
-	dst->i_blocks = src->i_blocks;
-#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
-	spin_unlock(&dst->i_lock);
-#endif
+	loff_t i_size;
+	blkcnt_t i_blocks;
+
+	/*
+	 * i_size_read() includes its own seqlocking and protection from
+	 * preemption (see include/linux/fs.h): we need nothing extra for
+	 * that here, and prefer to avoid nesting locks than attempt to
+	 * keep i_size and i_blocks in synch together.
+	 */
+	i_size = i_size_read(src);
+
+	/*
+	 * But if CONFIG_LSF (on 32-bit), we ought to make an effort to keep
+	 * the two halves of i_blocks in synch despite SMP or PREEMPT - though
+	 * stat's generic_fillattr() doesn't bother, and we won't be applying
+	 * quotas (where i_blocks does become important) at the upper level.
+	 *
+	 * We don't actually know what locking is used at the lower level; but
+	 * if it's a filesystem that supports quotas, it will be using i_lock
+	 * as in inode_add_bytes().  tmpfs uses other locking, and its 32-bit
+	 * is (just) able to exceed 2TB i_size with the aid of holes; but its
+	 * i_blocks cannot carry into the upper long without almost 2TB swap -
+	 * let's ignore that case.
+	 */
+	if (sizeof(i_blocks) > sizeof(long))
+		spin_lock(&src->i_lock);
+	i_blocks = src->i_blocks;
+	if (sizeof(i_blocks) > sizeof(long))
+		spin_unlock(&src->i_lock);
+
+	/*
+	 * If CONFIG_SMP on 32-bit, it's vital for fsstack_copy_inode_size()
+	 * to hold some lock around i_size_write(), otherwise i_size_read()
+	 * may spin forever (see include/linux/fs.h).  We don't necessarily
+	 * hold i_mutex when this is called, so take i_lock for that case.
+	 *
+	 * And if CONFIG_LSF (on 32-bit), continue our effort to keep the
+	 * two halves of i_blocks in synch despite SMP or PREEMPT: use i_lock
+	 * for that case too, and do both at once by combining the tests.
+	 *
+	 * There is none of this locking overhead in the 64-bit case.
+	 */
+	if (sizeof(i_size) > sizeof(long) || sizeof(i_blocks) > sizeof(long))
+		spin_lock(&dst->i_lock);
+	i_size_write(dst, i_size);
+	dst->i_blocks = i_blocks;
+	if (sizeof(i_size) > sizeof(long) || sizeof(i_blocks) > sizeof(long))
+		spin_unlock(&dst->i_lock);
 }
 EXPORT_SYMBOL_GPL(fsstack_copy_inode_size);
 
include/linux/fs_stack.h +1 -2
index 6b52faf..6615a52 100644
@@ -21,8 +21,7 @@
 
 /* externs for fs/stack.c */
 extern void fsstack_copy_attr_all(struct inode *dest, const struct inode *src);
-extern void fsstack_copy_inode_size(struct inode *dst,
-				    const struct inode *src);
+extern void fsstack_copy_inode_size(struct inode *dst, struct inode *src);
 
 /* inlines */
 static inline void fsstack_copy_attr_atime(struct inode *dest,
Signature · 1 line
1.5.2.2
author
#2 lore raw

PATCH 2/19 Unionfs: simplify the macros used to get/set the dentry start/end branches

In reply to Erez Zadok
---
 fs/unionfs/commonfops.c |    6 ++--
 fs/unionfs/copyup.c     |   14 ++++++------
 fs/unionfs/dentry.c     |    6 +---
 fs/unionfs/fanout.h     |   48 +++++-----------------------------------------
 fs/unionfs/inode.c      |    2 +-
 fs/unionfs/lookup.c     |   18 ++++++----------
 fs/unionfs/main.c       |    4 +-
 fs/unionfs/rename.c     |   10 ++++----
 fs/unionfs/subr.c       |    4 +-
 fs/unionfs/super.c      |    2 +-
 10 files changed, 36 insertions(+), 78 deletions(-)
fs/unionfs/commonfops.c +3 -3
index 631e081..6f61fb0 100644
@@ -290,7 +290,7 @@ static int do_delayed_copyup(struct file *file)
 	}
 	/* for reg file, we only open it "once" */
 	fbend(file) = fbstart(file);
-	set_dbend(dentry, dbstart(dentry));
+	dbend(dentry) = dbstart(dentry);
 	ibend(dentry->d_inode) = ibstart(dentry->d_inode);
 
 out:
@@ -823,8 +823,8 @@ static int unionfs_ioctl_queryfile(struct file *file, unsigned int cmd,
 		}
 	}
 	/* restore original dentry's offsets */
-	set_dbstart(dentry, orig_bstart);
-	set_dbend(dentry, orig_bend);
+	dbstart(dentry) = orig_bstart;
+	dbend(dentry) = orig_bend;
 	ibstart(dentry->d_inode) = orig_bstart;
 	ibend(dentry->d_inode) = orig_bend;
 
fs/unionfs/copyup.c +7 -7
index 6d1e461..b918897 100644
@@ -354,8 +354,8 @@ static void __clear(struct dentry *dentry, struct dentry *old_lower_dentry,
 {
 	/* get rid of the lower dentry and all its traces */
 	unionfs_set_lower_dentry_idx(dentry, new_bindex, NULL);
-	set_dbstart(dentry, old_bstart);
-	set_dbend(dentry, old_bend);
+	dbstart(dentry) = old_bstart;
+	dbend(dentry) = old_bend;
 
 	dput(new_lower_dentry);
 	dput(old_lower_dentry);
@@ -633,8 +633,8 @@ static void __cleanup_dentry(struct dentry *dentry, int bindex,
 		new_bstart = bindex;
 	if (new_bend < 0)
 		new_bend = bindex;
-	set_dbstart(dentry, new_bstart);
-	set_dbend(dentry, new_bend);
+	dbstart(dentry) = new_bstart;
+	dbend(dentry) = new_bend;
 
 }
 
@@ -657,9 +657,9 @@ static void __set_dentry(struct dentry *upper, struct dentry *lower,
 {
 	unionfs_set_lower_dentry_idx(upper, bindex, lower);
 	if (likely(dbstart(upper) > bindex))
-		set_dbstart(upper, bindex);
+		dbstart(upper) = bindex;
 	if (likely(dbend(upper) < bindex))
-		set_dbend(upper, bindex);
+		dbend(upper) = bindex;
 }
 
 /*
@@ -883,6 +883,6 @@ void unionfs_postcopyup_release(struct dentry *dentry)
 		}
 	}
 	bindex = dbstart(dentry);
-	set_dbend(dentry, bindex);
+	dbend(dentry) = bindex;
 	ibend(dentry->d_inode) = ibstart(dentry->d_inode) = bindex;
 }
fs/unionfs/dentry.c +2 -4
index e5f894c..44b17ce 100644
@@ -106,8 +106,7 @@ static bool __unionfs_d_revalidate_one(struct dentry *dentry,
 		bstart = dbstart(dentry);
 		bend = dbend(dentry);
 		__dput_lowers(dentry, bstart, bend);
-		set_dbstart(dentry, -1);
-		set_dbend(dentry, -1);
+		dbstart(dentry) = dbend(dentry) = -1;
 
 		interpose_flag = INTERPOSE_REVAL_NEG;
 		if (positive) {
@@ -542,8 +541,7 @@ static void unionfs_d_iput(struct dentry *dentry, struct inode *inode)
 			unionfs_set_lower_dentry_idx(dentry, bindex, NULL);
 		}
 	}
-	set_dbstart(dentry, -1);
-	set_dbend(dentry, -1);
+	dbstart(dentry) = dbend(dentry) = -1;
 
 drop_lower_inodes:
 	rc = atomic_read(&inode->i_count);
fs/unionfs/fanout.h +6 -42

60 lines not on this page · raw message

fs/unionfs/inode.c +1 -1
index a1d7aaf..8b4da54 100644
@@ -644,7 +644,7 @@ static int unionfs_mkdir(struct inode *parent, struct dentry *dentry, int mode)
 				unionfs_set_lower_dentry_idx(dentry, i, NULL);
 			}
 		}
-		set_dbend(dentry, bindex);
+		dbend(dentry) = bindex;
 
 		/*
 		 * Only INTERPOSE_LOOKUP can return a value other than 0 on
fs/unionfs/lookup.c +7 -11
index 7f512c2..33be53c 100644
@@ -206,8 +206,7 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,
 		if (wh_lower_dentry->d_inode) {
 			/* We found a whiteout so let's give up. */
 			if (S_ISREG(wh_lower_dentry->d_inode->i_mode)) {
-				set_dbend(dentry, bindex);
-				set_dbopaque(dentry, bindex);
+				dbend(dentry) = dbopaque(dentry) = bindex;
 				dput(wh_lower_dentry);
 				break;
 			}
@@ -276,7 +275,7 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,
 
 		/* store underlying dentry */
 		if (dbstart(dentry) == -1)
-			set_dbstart(dentry, bindex);
+			dbstart(dentry) = bindex;
 		unionfs_set_lower_dentry_idx(dentry, bindex, lower_dentry);
 		/*
 		 * FIXME: the following line needs to get fixed to allow
@@ -285,7 +284,7 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,
 		unionfs_set_lower_mnt_idx(dentry, bindex,
 					  unionfs_mntget(parent_dentry,
 							 bindex));
-		set_dbend(dentry, bindex);
+		dbend(dentry) = bindex;
 
 		/* update parent directory's atime with the bindex */
 		fsstack_copy_attr_atime(parent_dentry->d_inode,
@@ -306,8 +305,7 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,
 			err = opaque;
 			goto out_free;
 		} else if (opaque) {
-			set_dbend(dentry, bindex);
-			set_dbopaque(dentry, bindex);
+			dbend(dentry) = dbopaque(dentry) = bindex;
 			break;
 		}
 	}
@@ -353,8 +351,7 @@ out_negative:
 				     first_lower_dentry);
 	unionfs_set_lower_mnt_idx(dentry, first_dentry_offset,
 				  first_lower_mnt);
-	set_dbstart(dentry, first_dentry_offset);
-	set_dbend(dentry, first_dentry_offset);
+	dbstart(dentry) = dbend(dentry) = first_dentry_offset;
 
 	if (lookupmode == INTERPOSE_REVAL_NEG)
 		BUG_ON(dentry->d_inode != NULL);
@@ -421,8 +418,7 @@ out_free:
 	}
 	kfree(UNIONFS_D(dentry)->lower_paths);
 	UNIONFS_D(dentry)->lower_paths = NULL;
-	set_dbstart(dentry, -1);
-	set_dbend(dentry, -1);
+	dbstart(dentry) = dbend(dentry) = -1;
 
 out:
 	if (!err && UNIONFS_D(dentry)) {
@@ -582,7 +578,7 @@ void update_bstart(struct dentry *dentry)
 		if (!lower_dentry)
 			continue;
 		if (lower_dentry->d_inode) {
-			set_dbstart(dentry, bindex);
+			dbstart(dentry) = bindex;
 			break;
 		}
 		dput(lower_dentry);
fs/unionfs/main.c +2 -2
index b76264a..b8f84bb 100644
@@ -675,8 +675,8 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data,
 		unionfs_set_lower_dentry_idx(sb->s_root, bindex, d);
 		unionfs_set_lower_mnt_idx(sb->s_root, bindex, m);
 	}
-	set_dbstart(sb->s_root, bstart);
-	set_dbend(sb->s_root, bend);
+	dbstart(sb->s_root) = bstart;
+	dbend(sb->s_root) = bend;
 
 	/* Set the generation number to one, since this is for the mount. */
 	atomic_set(&UNIONFS_D(sb->s_root)->generation, 1);
fs/unionfs/rename.c +5 -5
index cc16eb2..fe8d877 100644
@@ -156,9 +156,9 @@ out:
 	if (!err) {
 		/* Fixup the new_dentry. */
 		if (bindex < dbstart(new_dentry))
-			set_dbstart(new_dentry, bindex);
+			dbstart(new_dentry) = bindex;
 		else if (bindex > dbend(new_dentry))
-			set_dbend(new_dentry, bindex);
+			dbend(new_dentry) = bindex;
 	}
 
 	kfree(wh_name);
@@ -298,7 +298,7 @@ static int do_unionfs_rename(struct inode *old_dir,
 				       &nd);
 		unlock_dir(lower_parent);
 		if (!local_err) {
-			set_dbopaque(old_dentry, bwh_old);
+			dbopaque(old_dentry) = bwh_old;
 		} else {
 			/*
 			 * we can't fix anything now, so we cop-out and use
@@ -426,9 +426,9 @@ static int may_rename_dir(struct dentry *dentry)
 	if (dbend(dentry) == bstart || dbopaque(dentry) == bstart)
 		return 0;
 
-	set_dbstart(dentry, bstart + 1);
+	dbstart(dentry) = bstart + 1;
 	err = check_empty(dentry, NULL);
-	set_dbstart(dentry, bstart);
+	dbstart(dentry) = bstart;
 	if (err == -ENOTEMPTY)
 		err = -EXDEV;
 	return err;
fs/unionfs/subr.c +2 -2
index 1a40f63..b76fa7a 100644
@@ -107,7 +107,7 @@ int create_whiteout(struct dentry *dentry, int start)
 
 	/* set dbopaque so that lookup will not proceed after this branch */
 	if (!err)
-		set_dbopaque(dentry, bindex);
+		dbopaque(dentry) = bindex;
 
 out:
 	kfree(name);
@@ -195,7 +195,7 @@ int make_dir_opaque(struct dentry *dentry, int bindex)
 	if (!diropq->d_inode)
 		err = vfs_create(lower_dir, diropq, S_IRUGO, &nd);
 	if (!err)
-		set_dbopaque(dentry, bindex);
+		dbopaque(dentry) = bindex;
 	release_lower_nd(&nd, err);
 
 	dput(diropq);
fs/unionfs/super.c +1 -1
index b110760..1a172af 100644
@@ -771,7 +771,7 @@ out_no_change:
 	/* update our unionfs_sb_info and root dentry index of last branch */
 	i = sbmax(sb);		/* save no. of branches to release at end */
 	sbend(sb) = new_branches - 1;
-	set_dbend(sb->s_root, new_branches - 1);
+	dbend(sb->s_root) = new_branches - 1;
 	old_ibstart = ibstart(sb->s_root->d_inode);
 	old_ibend = ibend(sb->s_root->d_inode);
 	ibend(sb->s_root->d_inode) = new_branches - 1;
Signature · 1 line
1.5.2.2
author
#3 lore raw

PATCH 3/19 Unionfs: move a rename helper closer to rename code

In reply to Erez Zadok
---
 fs/unionfs/rename.c |   42 ++++++++++++++++++++++++++++++++++++++++++
 fs/unionfs/subr.c   |   42 ------------------------------------------
 fs/unionfs/union.h  |    3 ---
 3 files changed, 42 insertions(+), 45 deletions(-)
fs/unionfs/rename.c +42 -0
index fe8d877..5b3f1a3 100644
@@ -18,6 +18,48 @@
 
 #include "union.h"
 
+/*
+ * This is a helper function for rename, used when rename ends up with hosed
+ * over dentries and we need to revert.
+ */
+static int unionfs_refresh_lower_dentry(struct dentry *dentry, int bindex)
+{
+	struct dentry *lower_dentry;
+	struct dentry *lower_parent;
+	int err = 0;
+
+	verify_locked(dentry);
+
+	unionfs_lock_dentry(dentry->d_parent, UNIONFS_DMUTEX_CHILD);
+	lower_parent = unionfs_lower_dentry_idx(dentry->d_parent, bindex);
+	unionfs_unlock_dentry(dentry->d_parent);
+
+	BUG_ON(!S_ISDIR(lower_parent->d_inode->i_mode));
+
+	lower_dentry = lookup_one_len(dentry->d_name.name, lower_parent,
+				      dentry->d_name.len);
+	if (IS_ERR(lower_dentry)) {
+		err = PTR_ERR(lower_dentry);
+		goto out;
+	}
+
+	dput(unionfs_lower_dentry_idx(dentry, bindex));
+	iput(unionfs_lower_inode_idx(dentry->d_inode, bindex));
+	unionfs_set_lower_inode_idx(dentry->d_inode, bindex, NULL);
+
+	if (!lower_dentry->d_inode) {
+		dput(lower_dentry);
+		unionfs_set_lower_dentry_idx(dentry, bindex, NULL);
+	} else {
+		unionfs_set_lower_dentry_idx(dentry, bindex, lower_dentry);
+		unionfs_set_lower_inode_idx(dentry->d_inode, bindex,
+					    igrab(lower_dentry->d_inode));
+	}
+
+out:
+	return err;
+}
+
 static int __unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 			    struct inode *new_dir, struct dentry *new_dentry,
 			    int bindex, struct dentry **wh_old)
fs/unionfs/subr.c +0 -42

48 lines not on this page · raw message

fs/unionfs/union.h +0 -3
index edd5685..7ddbad1 100644
@@ -346,9 +346,6 @@ extern int check_empty(struct dentry *dentry,
 extern int delete_whiteouts(struct dentry *dentry, int bindex,
 			    struct unionfs_dir_state *namelist);
 
-/* Re-lookup a lower dentry. */
-extern int unionfs_refresh_lower_dentry(struct dentry *dentry, int bindex);
-
 extern void unionfs_reinterpose(struct dentry *this_dentry);
 extern struct super_block *unionfs_duplicate_super(struct super_block *sb);
 
Signature · 1 line
1.5.2.2
author
#4 lore raw

PATCH 4/19 Unionfs: create and consolidate helpers to iput lower objects

In reply to Erez Zadok
---
 fs/unionfs/commonfops.c |    5 +---
 fs/unionfs/copyup.c     |    5 +--
 fs/unionfs/dentry.c     |   25 +-----------------------
 fs/unionfs/fanout.h     |   49 +++++++++++++++++++++++++++++++++++++++++++++++
 fs/unionfs/super.c      |    6 +----
 fs/unionfs/unlink.c     |   22 ++------------------
 6 files changed, 57 insertions(+), 55 deletions(-)
fs/unionfs/commonfops.c +1 -4
index 6f61fb0..585c5c9 100644
@@ -280,14 +280,11 @@ static int do_delayed_copyup(struct file *file)
 			unionfs_set_lower_mnt_idx(dentry, bindex, NULL);
 		}
 		if (unionfs_lower_dentry_idx(dentry, bindex)) {
-			BUG_ON(!dentry->d_inode);
-			iput(unionfs_lower_inode_idx(dentry->d_inode, bindex));
-			unionfs_set_lower_inode_idx(dentry->d_inode, bindex,
-						    NULL);
 			dput(unionfs_lower_dentry_idx(dentry, bindex));
 			unionfs_set_lower_dentry_idx(dentry, bindex, NULL);
 		}
 	}
+	iput_lowers(dentry->d_inode, bstart, bend, false);
 	/* for reg file, we only open it "once" */
 	fbend(file) = fbstart(file);
 	dbend(dentry) = dbstart(dentry);
fs/unionfs/copyup.c +2 -3
index b918897..f20b984 100644
@@ -877,11 +877,10 @@ void unionfs_postcopyup_release(struct dentry *dentry)
 		if (unionfs_lower_dentry_idx(dentry, bindex)) {
 			dput(unionfs_lower_dentry_idx(dentry, bindex));
 			unionfs_set_lower_dentry_idx(dentry, bindex, NULL);
-			iput(unionfs_lower_inode_idx(dentry->d_inode, bindex));
-			unionfs_set_lower_inode_idx(dentry->d_inode, bindex,
-						    NULL);
 		}
 	}
+	iput_lowers(dentry->d_inode, dbstart(dentry)+1, dbend(dentry), false);
+
 	bindex = dbstart(dentry);
 	dbend(dentry) = bindex;
 	ibend(dentry->d_inode) = ibstart(dentry->d_inode) = bindex;
fs/unionfs/dentry.c +1 -24
index 44b17ce..a7960ac 100644
@@ -35,22 +35,6 @@ static inline void __dput_lowers(struct dentry *dentry, int start, int end)
 	}
 }
 
-static inline void __iput_lowers(struct inode *inode, int start, int end)
-{
-	struct inode *lower_inode;
-	int bindex;
-
-	if (start < 0)
-		return;
-	for (bindex = start; bindex <= end; bindex++) {
-		lower_inode = unionfs_lower_inode_idx(inode, bindex);
-		if (!lower_inode)
-			continue;
-		unionfs_set_lower_inode_idx(inode, bindex, NULL);
-		iput(lower_inode);
-	}
-}
-
 /*
  * Revalidate a single dentry.
  * Assume that dentry's info node is locked.
@@ -111,14 +95,7 @@ static bool __unionfs_d_revalidate_one(struct dentry *dentry,
 		interpose_flag = INTERPOSE_REVAL_NEG;
 		if (positive) {
 			interpose_flag = INTERPOSE_REVAL;
-
-			bstart = ibstart(dentry->d_inode);
-			bend = ibend(dentry->d_inode);
-			__iput_lowers(dentry->d_inode, bstart, bend);
-			kfree(UNIONFS_I(dentry->d_inode)->lower_inodes);
-			UNIONFS_I(dentry->d_inode)->lower_inodes = NULL;
-			ibstart(dentry->d_inode) = -1;
-			ibend(dentry->d_inode) = -1;
+			iput_lowers_all(dentry->d_inode, true);
 		}
 
 		result = unionfs_lookup_backend(dentry, &lowernd,
fs/unionfs/fanout.h +49 -0

53 lines not on this page · raw message

fs/unionfs/super.c +1 -5
index 1a172af..9715529 100644
@@ -789,11 +789,7 @@ out_no_change:
 		new_lower_inodes[i] = lower_dentry->d_inode;
 	}
 	/* 2. release reference on all older lower inodes */
-	for (i = old_ibstart; i <= old_ibend; i++) {
-		iput(unionfs_lower_inode_idx(sb->s_root->d_inode, i));
-		unionfs_set_lower_inode_idx(sb->s_root->d_inode, i, NULL);
-	}
-	kfree(UNIONFS_I(sb->s_root->d_inode)->lower_inodes);
+	iput_lowers(sb->s_root->d_inode, old_ibstart, old_ibend, true);
 	/* 3. update root dentry's inode to new lower_inodes array */
 	UNIONFS_I(sb->s_root->d_inode)->lower_inodes = new_lower_inodes;
 	new_lower_inodes = NULL;
fs/unionfs/unlink.c +3 -19
index cad0386..3d6ca5f 100644
@@ -146,12 +146,8 @@ int unionfs_unlink(struct inode *dir, struct dentry *dentry)
 	/* call d_drop so the system "forgets" about us */
 	if (!err) {
 		unionfs_postcopyup_release(dentry);
-		if (inode->i_nlink == 0) {
-			/* drop lower inodes */
-			iput(unionfs_lower_inode(inode));
-			unionfs_set_lower_inode(inode, NULL);
-			ibstart(inode) = ibend(inode) = -1;
-		}
+		if (inode->i_nlink == 0) /* drop lower inodes */
+			iput_lowers_all(inode, false);
 		d_drop(dentry);
 		/*
 		 * if unlink/whiteout succeeded, parent dir mtime has
@@ -264,21 +260,9 @@ out:
 	 * about us.
 	 */
 	if (!err) {
-		struct inode *inode = dentry->d_inode;
-		BUG_ON(!inode);
-		iput(unionfs_lower_inode_idx(inode, dstart));
-		unionfs_set_lower_inode_idx(inode, dstart, NULL);
+		iput_lowers_all(dentry->d_inode, false);
 		dput(unionfs_lower_dentry_idx(dentry, dstart));
 		unionfs_set_lower_dentry_idx(dentry, dstart, NULL);
-		/*
-		 * If the last directory is unlinked, then mark istart/end
-		 * as -1, (to maintain the invariant that if there are no
-		 * lower objects, then branch index start and end are set to
-		 * -1).
-		 */
-		if (!unionfs_lower_inode_idx(inode, dstart) &&
-		    !unionfs_lower_inode_idx(inode, dend))
-			ibstart(inode) = ibend(inode) = -1;
 		d_drop(dentry);
 		/* update our lower vfsmnts, in case a copyup took place */
 		unionfs_postcopyup_setmnt(dentry);
Signature · 1 line
1.5.2.2
author
#5 lore raw

PATCH 5/19 Unionfs: create and consolidate helpers to path-put lower objects

In reply to Erez Zadok
---
 fs/unionfs/commonfops.c |    9 +------
 fs/unionfs/copyup.c     |   23 ++++++------------
 fs/unionfs/dentry.c     |   31 ++------------------------
 fs/unionfs/fanout.h     |   55 +++++++++++++++++++++++++++++++++++++++++++++++
 fs/unionfs/lookup.c     |   14 +++--------
 5 files changed, 71 insertions(+), 61 deletions(-)
fs/unionfs/commonfops.c +1 -8
index 585c5c9..5816d41 100644
@@ -275,15 +275,8 @@ static int do_delayed_copyup(struct file *file)
 			fput(unionfs_lower_file_idx(file, bindex));
 			unionfs_set_lower_file_idx(file, bindex, NULL);
 		}
-		if (unionfs_lower_mnt_idx(dentry, bindex)) {
-			unionfs_mntput(dentry, bindex);
-			unionfs_set_lower_mnt_idx(dentry, bindex, NULL);
-		}
-		if (unionfs_lower_dentry_idx(dentry, bindex)) {
-			dput(unionfs_lower_dentry_idx(dentry, bindex));
-			unionfs_set_lower_dentry_idx(dentry, bindex, NULL);
-		}
 	}
+	path_put_lowers(dentry, bstart, bend, false);
 	iput_lowers(dentry->d_inode, bstart, bend, false);
 	/* for reg file, we only open it "once" */
 	fbend(file) = fbstart(file);
fs/unionfs/copyup.c +8 -15
index f20b984..55d48aa 100644
@@ -866,22 +866,15 @@ void unionfs_postcopyup_setmnt(struct dentry *dentry)
  */
 void unionfs_postcopyup_release(struct dentry *dentry)
 {
-	int bindex;
+	int bstart, bend;
 
 	BUG_ON(S_ISDIR(dentry->d_inode->i_mode));
-	for (bindex = dbstart(dentry)+1; bindex <= dbend(dentry); bindex++) {
-		if (unionfs_lower_mnt_idx(dentry, bindex)) {
-			unionfs_mntput(dentry, bindex);
-			unionfs_set_lower_mnt_idx(dentry, bindex, NULL);
-		}
-		if (unionfs_lower_dentry_idx(dentry, bindex)) {
-			dput(unionfs_lower_dentry_idx(dentry, bindex));
-			unionfs_set_lower_dentry_idx(dentry, bindex, NULL);
-		}
-	}
-	iput_lowers(dentry->d_inode, dbstart(dentry)+1, dbend(dentry), false);
+	bstart = dbstart(dentry);
+	bend = dbend(dentry);
+
+	path_put_lowers(dentry, bstart + 1, bend, false);
+	iput_lowers(dentry->d_inode, bstart + 1, bend, false);
 
-	bindex = dbstart(dentry);
-	dbend(dentry) = bindex;
-	ibend(dentry->d_inode) = ibstart(dentry->d_inode) = bindex;
+	dbend(dentry) = bstart;
+	ibend(dentry->d_inode) = ibstart(dentry->d_inode) = bstart;
 }
fs/unionfs/dentry.c +3 -28
index a7960ac..51c0baf 100644
@@ -455,8 +455,6 @@ static int unionfs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
 
 static void unionfs_d_release(struct dentry *dentry)
 {
-	int bindex, bstart, bend;
-
 	unionfs_read_lock(dentry->d_sb, UNIONFS_SMUTEX_CHILD);
 	if (unlikely(!UNIONFS_D(dentry)))
 		goto out;	/* skip if no lower branches */
@@ -471,20 +469,7 @@ static void unionfs_d_release(struct dentry *dentry)
 	}
 
 	/* Release all the lower dentries */
-	bstart = dbstart(dentry);
-	bend = dbend(dentry);
-	for (bindex = bstart; bindex <= bend; bindex++) {
-		dput(unionfs_lower_dentry_idx(dentry, bindex));
-		unionfs_set_lower_dentry_idx(dentry, bindex, NULL);
-		/* NULL lower mnt is ok if this is a negative dentry */
-		if (!dentry->d_inode && !unionfs_lower_mnt_idx(dentry, bindex))
-			continue;
-		unionfs_mntput(dentry, bindex);
-		unionfs_set_lower_mnt_idx(dentry, bindex, NULL);
-	}
-	/* free private data (unionfs_dentry_info) here */
-	kfree(UNIONFS_D(dentry)->lower_paths);
-	UNIONFS_D(dentry)->lower_paths = NULL;
+	path_put_lowers_all(dentry, true);
 
 	unionfs_unlock_dentry(dentry);
 
@@ -500,7 +485,7 @@ out:
  */
 static void unionfs_d_iput(struct dentry *dentry, struct inode *inode)
 {
-	int bindex, rc;
+	int rc;
 
 	BUG_ON(!dentry);
 	unionfs_read_lock(dentry->d_sb, UNIONFS_SMUTEX_CHILD);
@@ -508,17 +493,7 @@ static void unionfs_d_iput(struct dentry *dentry, struct inode *inode)
 
 	if (!UNIONFS_D(dentry) || dbstart(dentry) < 0)
 		goto drop_lower_inodes;
-	for (bindex = dbstart(dentry); bindex <= dbend(dentry); bindex++) {
-		if (unionfs_lower_mnt_idx(dentry, bindex)) {
-			unionfs_mntput(dentry, bindex);
-			unionfs_set_lower_mnt_idx(dentry, bindex, NULL);
-		}
-		if (unionfs_lower_dentry_idx(dentry, bindex)) {
-			dput(unionfs_lower_dentry_idx(dentry, bindex));
-			unionfs_set_lower_dentry_idx(dentry, bindex, NULL);
-		}
-	}
-	dbstart(dentry) = dbend(dentry) = -1;
+	path_put_lowers_all(dentry, false);
 
 drop_lower_inodes:
 	rc = atomic_read(&inode->i_count);
fs/unionfs/fanout.h +55 -0

59 lines not on this page · raw message

fs/unionfs/lookup.c +4 -10
index 33be53c..f6bb748 100644
@@ -407,18 +407,12 @@ out_drop:
 	d_drop(dentry);
 
 out_free:
-	/* should dput all the underlying dentries on error condition */
-	bstart = dbstart(dentry);
-	if (bstart >= 0) {
-		bend = dbend(dentry);
-		for (bindex = bstart; bindex <= bend; bindex++) {
-			dput(unionfs_lower_dentry_idx(dentry, bindex));
-			unionfs_mntput(dentry, bindex);
-		}
-	}
+	/* should dput/mntput all the underlying dentries on error condition */
+	if (dbstart(dentry) >= 0)
+		path_put_lowers_all(dentry, false);
+	/* free lower_paths unconditionally */
 	kfree(UNIONFS_D(dentry)->lower_paths);
 	UNIONFS_D(dentry)->lower_paths = NULL;
-	dbstart(dentry) = dbend(dentry) = -1;
 
 out:
 	if (!err && UNIONFS_D(dentry)) {
Signature · 1 line
1.5.2.2
author
#6 lore raw

PATCH 6/19 Unionfs: simplify stale-inode detection code

In reply to Erez Zadok
---
 fs/unionfs/dentry.c |   16 +++++++++++++++-
 fs/unionfs/lookup.c |   10 ++--------
 fs/unionfs/main.c   |   14 +-------------
 fs/unionfs/union.h  |    2 +-
 4 files changed, 19 insertions(+), 23 deletions(-)
fs/unionfs/dentry.c +15 -1
index 51c0baf..cd4611b 100644
@@ -18,6 +18,20 @@
 
 #include "union.h"
 
+bool is_negative_lower(const struct dentry *dentry)
+{
+	int bindex;
+	struct dentry *lower_dentry;
+
+	BUG_ON(!dentry || dbstart(dentry) < 0);
+	for (bindex = dbstart(dentry); bindex <= dbend(dentry); bindex++) {
+		lower_dentry = unionfs_lower_dentry_idx(dentry, bindex);
+		/* XXX: what if lower_dentry is NULL? */
+		if (lower_dentry && lower_dentry->d_inode)
+			return false;
+	}
+	return true;
+}
 
 static inline void __dput_lowers(struct dentry *dentry, int start, int end)
 {
@@ -113,7 +127,7 @@ static bool __unionfs_d_revalidate_one(struct dentry *dentry,
 			dentry = result;
 		}
 
-		if (unlikely(positive && UNIONFS_I(dentry->d_inode)->stale)) {
+		if (unlikely(positive && is_negative_lower(dentry))) {
 			make_bad_inode(dentry->d_inode);
 			d_drop(dentry);
 			valid = false;
fs/unionfs/lookup.c +2 -8
index f6bb748..1ba7103 100644
@@ -320,11 +320,9 @@ out_negative:
 		goto out;
 
 	/* If we've only got negative dentries, then use the leftmost one. */
-	if (lookupmode == INTERPOSE_REVAL) {
-		if (dentry->d_inode)
-			UNIONFS_I(dentry->d_inode)->stale = 1;
+	if (lookupmode == INTERPOSE_REVAL)
 		goto out;
-	}
+
 	if (!lower_dir_dentry) {
 		err = -ENOENT;
 		goto out;
@@ -424,7 +422,6 @@ out:
 		     !UNIONFS_I(dentry->d_inode)->lower_inodes)) {
 			unionfs_mntput(dentry->d_sb->s_root, bstart);
 			dput(first_lower_dentry);
-			UNIONFS_I(dentry->d_inode)->stale = 1;
 		}
 	}
 	kfree(whname);
@@ -433,9 +430,6 @@ out:
 		unionfs_unlock_dentry(dentry);
 	if (!err && d_interposed)
 		return d_interposed;
-	if (dentry->d_inode && UNIONFS_I(dentry->d_inode)->stale &&
-	    first_dentry_offset >= 0)
-		unionfs_mntput(dentry->d_sb->s_root, first_dentry_offset);
 	return ERR_PTR(err);
 }
 
fs/unionfs/main.c +1 -13
index b8f84bb..a9d2cb6 100644
@@ -83,25 +83,13 @@ struct dentry *unionfs_interpose(struct dentry *dentry, struct super_block *sb,
 {
 	int err = 0;
 	struct inode *inode;
-	int is_negative_dentry = 1;
-	int bindex, bstart, bend;
 	int need_fill_inode = 1;
 	struct dentry *spliced = NULL;
 
 	verify_locked(dentry);
 
-	bstart = dbstart(dentry);
-	bend = dbend(dentry);
-
 	/* Make sure that we didn't get a negative dentry. */
-	for (bindex = bstart; bindex <= bend; bindex++) {
-		if (unionfs_lower_dentry_idx(dentry, bindex) &&
-		    unionfs_lower_dentry_idx(dentry, bindex)->d_inode) {
-			is_negative_dentry = 0;
-			break;
-		}
-	}
-	BUG_ON(is_negative_dentry);
+	BUG_ON(is_negative_lower(dentry));
 
 	/*
 	 * We allocate our new inode below by calling unionfs_iget,
fs/unionfs/union.h +1 -1
index 7ddbad1..f5cf09b 100644
@@ -99,7 +99,6 @@ struct unionfs_inode_info {
 	int bstart;
 	int bend;
 	atomic_t generation;
-	int stale;
 	/* Stuff for readdir over NFS. */
 	spinlock_t rdlock;
 	struct list_head readdircache;
@@ -377,6 +376,7 @@ extern bool __unionfs_d_revalidate_one_locked(struct dentry *dentry,
 					      bool willwrite);
 extern bool __unionfs_d_revalidate_chain(struct dentry *dentry,
 					 struct nameidata *nd, bool willwrite);
+extern bool is_negative_lower(const struct dentry *dentry);
 extern bool is_newer_lower(const struct dentry *dentry);
 extern void purge_sb_data(struct super_block *sb);
 
Signature · 1 line
1.5.2.2
author
#7 lore raw

PATCH 7/19 Unionfs: overhaul whiteout code

In reply to Erez Zadok

Move all whiteout functions and helpers into a separate file, replace all embedded whiteout code with calls to helpers. Cleanup and consolidate the code. This will make it easier to replace the whiteout code with a Linux-native whiteout implementation (once available).

---
 fs/unionfs/Makefile    |    2 +-
 fs/unionfs/dirfops.c   |   22 +-
 fs/unionfs/dirhelper.c |  124 +----------
 fs/unionfs/inode.c     |  183 ++-------------
 fs/unionfs/lookup.c    |   85 +-------
 fs/unionfs/rename.c    |  149 ++-----------
 fs/unionfs/sioq.c      |   18 --
 fs/unionfs/subr.c      |  161 --------------
 fs/unionfs/super.c     |    2 +-
 fs/unionfs/union.h     |   40 ++---
 fs/unionfs/whiteout.c  |  577 ++++++++++++++++++++++++++++++++++++++++++++++++
 11 files changed, 655 insertions(+), 708 deletions(-)
 create mode 100644 fs/unionfs/whiteout.c
fs/unionfs/Makefile +1 -1
index 17ca4a7..0dc28c1 100644
@@ -2,7 +2,7 @@ obj-$(CONFIG_UNION_FS) += unionfs.o
 
 unionfs-y := subr.o dentry.o file.o inode.o main.o super.o \
 	rdstate.o copyup.o dirhelper.o rename.o unlink.o \
-	lookup.o commonfops.o dirfops.o sioq.o mmap.o
+	lookup.o commonfops.o dirfops.o sioq.o mmap.o whiteout.o
 
 unionfs-$(CONFIG_UNION_FS_XATTR) += xattr.o
 
fs/unionfs/dirfops.c +9 -13
index 8272fb6..e35afa4 100644
@@ -36,37 +36,33 @@ struct unionfs_getdents_callback {
 };
 
 /* based on generic filldir in fs/readir.c */
-static int unionfs_filldir(void *dirent, const char *name, int namelen,
+static int unionfs_filldir(void *dirent, const char *oname, int namelen,
 			   loff_t offset, u64 ino, unsigned int d_type)
 {
 	struct unionfs_getdents_callback *buf = dirent;
 	struct filldir_node *found = NULL;
 	int err = 0;
-	int is_wh_entry = 0;
+	int is_whiteout;
+	char *name = (char *) oname;
 
 	buf->filldir_called++;
 
-	if ((namelen > UNIONFS_WHLEN) &&
-	    !strncmp(name, UNIONFS_WHPFX, UNIONFS_WHLEN)) {
-		name += UNIONFS_WHLEN;
-		namelen -= UNIONFS_WHLEN;
-		is_wh_entry = 1;
-	}
+	is_whiteout = is_whiteout_name(&name, &namelen);
 
-	found = find_filldir_node(buf->rdstate, name, namelen, is_wh_entry);
+	found = find_filldir_node(buf->rdstate, name, namelen, is_whiteout);
 
 	if (found) {
 		/*
 		 * If we had non-whiteout entry in dir cache, then mark it
 		 * as a whiteout and but leave it in the dir cache.
 		 */
-		if (is_wh_entry && !found->whiteout)
-			found->whiteout = is_wh_entry;
+		if (is_whiteout && !found->whiteout)
+			found->whiteout = is_whiteout;
 		goto out;
 	}
 
 	/* if 'name' isn't a whiteout, filldir it. */
-	if (!is_wh_entry) {
+	if (!is_whiteout) {
 		off_t pos = rdstate2offset(buf->rdstate);
 		u64 unionfs_ino = ino;
 
@@ -85,7 +81,7 @@ static int unionfs_filldir(void *dirent, const char *name, int namelen,
 	}
 	buf->entries_written++;
 	err = add_filldir_node(buf->rdstate, name, namelen,
-			       buf->rdstate->bindex, is_wh_entry);
+			       buf->rdstate->bindex, is_whiteout);
 	if (err)
 		buf->filldir_error = err;
 
fs/unionfs/dirhelper.c +7 -117

157 lines not on this page · raw message

fs/unionfs/inode.c +24 -159

228 lines not on this page · raw message

fs/unionfs/lookup.c +4 -81

118 lines not on this page · raw message

fs/unionfs/rename.c +18 -131

248 lines not on this page · raw message

fs/unionfs/sioq.c +0 -18
index 2a8c88e..0ea8436 100644
@@ -99,21 +99,3 @@ void __unionfs_unlink(struct work_struct *work)
 	args->err = vfs_unlink(u->parent, u->dentry);
 	complete(&args->comp);
 }
-
-void __delete_whiteouts(struct work_struct *work)
-{
-	struct sioq_args *args = container_of(work, struct sioq_args, work);
-	struct deletewh_args *d = &args->deletewh;
-
-	args->err = do_delete_whiteouts(d->dentry, d->bindex, d->namelist);
-	complete(&args->comp);
-}
-
-void __is_opaque_dir(struct work_struct *work)
-{
-	struct sioq_args *args = container_of(work, struct sioq_args, work);
-
-	args->ret = lookup_one_len(UNIONFS_DIR_OPAQUE, args->is_opaque.dentry,
-				   sizeof(UNIONFS_DIR_OPAQUE) - 1);
-	complete(&args->comp);
-}
fs/unionfs/subr.c +0 -161

173 lines not on this page · raw message

fs/unionfs/super.c +1 -1
index 9715529..3b6b65a 100644
@@ -173,7 +173,7 @@ static int unionfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 	 *
 	 * XXX: this restriction goes away with ODF.
 	 */
-	buf->f_namelen -= UNIONFS_WHLEN;
+	unionfs_set_max_namelen(&buf->f_namelen);
 
 	/*
 	 * reset two fields to avoid confusing user-land.
fs/unionfs/union.h +14 -26
index f5cf09b..9271b3b 100644
@@ -306,18 +306,10 @@ extern void release_lower_nd(struct nameidata *nd, int err);
 /* replicates the directory structure up to given dentry in given branch */
 extern struct dentry *create_parents(struct inode *dir, struct dentry *dentry,
 				     const char *name, int bindex);
-extern int make_dir_opaque(struct dentry *dir, int bindex);
 
 /* partial lookup */
 extern int unionfs_partial_lookup(struct dentry *dentry);
 
-/*
- * Pass an unionfs dentry and an index and it will try to create a whiteout
- * in branch 'index'.
- *
- * On error, it will proceed to a branch to the left
- */
-extern int create_whiteout(struct dentry *dentry, int start);
 /* copies a file from dbstart to newbindex branch */
 extern int copyup_file(struct inode *dir, struct file *file, int bstart,
 		       int newbindex, loff_t size);
@@ -332,18 +324,25 @@ extern int copyup_dentry(struct inode *dir, struct dentry *dentry,
 extern void unionfs_postcopyup_setmnt(struct dentry *dentry);
 extern void unionfs_postcopyup_release(struct dentry *dentry);
 
-extern int remove_whiteouts(struct dentry *dentry,
-			    struct dentry *lower_dentry, int bindex);
-
-extern int do_delete_whiteouts(struct dentry *dentry, int bindex,
-			       struct unionfs_dir_state *namelist);
-
 /* Is this directory empty: 0 if it is empty, -ENOTEMPTY if not. */
 extern int check_empty(struct dentry *dentry,
 		       struct unionfs_dir_state **namelist);
-/* Delete whiteouts from this directory in branch bindex. */
+/* whiteout and opaque directory helpers */
+extern char *alloc_whname(const char *name, int len);
+extern bool is_whiteout_name(char **namep, int *namelenp);
+extern bool is_validname(const char *name);
+extern struct dentry *lookup_whiteout(const char *name,
+				      struct dentry *lower_parent);
+extern struct dentry *find_first_whiteout(struct dentry *dentry);
+extern int unlink_whiteout(struct dentry *wh_dentry);
+extern int check_unlink_whiteout(struct dentry *dentry,
+				 struct dentry *lower_dentry, int bindex);
+extern int create_whiteout(struct dentry *dentry, int start);
 extern int delete_whiteouts(struct dentry *dentry, int bindex,
 			    struct unionfs_dir_state *namelist);
+extern int is_opaque_dir(struct dentry *dentry, int bindex);
+extern int make_dir_opaque(struct dentry *dir, int bindex);
+extern void unionfs_set_max_namelen(long *namelen);
 
 extern void unionfs_reinterpose(struct dentry *this_dentry);
 extern struct super_block *unionfs_duplicate_super(struct super_block *sb);
@@ -476,20 +475,9 @@ static inline int is_robranch(const struct dentry *dentry)
 	return is_robranch_idx(dentry, index);
 }
 
-/* What do we use for whiteouts. */
-#define UNIONFS_WHPFX ".wh."
-#define UNIONFS_WHLEN 4
-/*
- * If a directory contains this file, then it is opaque.  We start with the
- * .wh. flag so that it is blocked by lookup.
- */
-#define UNIONFS_DIR_OPAQUE_NAME "__dir_opaque"
-#define UNIONFS_DIR_OPAQUE UNIONFS_WHPFX UNIONFS_DIR_OPAQUE_NAME
-
 /*
  * EXTERNALS:
  */
-extern char *alloc_whname(const char *name, int len);
 extern int check_branch(struct nameidata *nd);
 extern int parse_branch_mode(const char *name, int *perms);
 
fs/unionfs/whiteout.c new file +577 -0

577 lines not on this page · raw message

Signature · 1 line
1.5.2.2
author
#8 lore raw

PATCH 8/19 Unionfs: lookup overhaul using vfs_path_lookup

In reply to Erez Zadok

Rework the lookup code to use vfs_path_lookup as much as possible, to ensure that we have a vfsmount at this critical stage. This is necessary for the upcoming VFS API change from vfs_* to path_* methods. This change also allows unionfs to cross bind mounts and other mounts on lower branches.

---
 fs/unionfs/commonfops.c |    3 +-
 fs/unionfs/inode.c      |   18 ++-
 fs/unionfs/lookup.c     |  348 ++++++++++++++++++++++++++++++++++++++++++++++-
 fs/unionfs/rename.c     |    1 +
 fs/unionfs/union.h      |    4 +
 5 files changed, 366 insertions(+), 8 deletions(-)
fs/unionfs/commonfops.c +2 -1
index 5816d41..df002d5 100644
@@ -422,7 +422,8 @@ reval_dentry:
 	dgen = atomic_read(&UNIONFS_D(dentry)->generation);
 
 	if (unlikely(sbgen > dgen)) {
-		pr_debug("unionfs: retry dentry revalidation\n");
+		pr_debug("unionfs: retry dentry %s revalidation\n",
+			 dentry->d_name.name);
 		schedule();
 		goto reval_dentry;
 	}
fs/unionfs/inode.c +16 -2
index bfebc0c..f81ebb6 100644
@@ -178,6 +178,7 @@ static struct dentry *unionfs_lookup(struct inode *parent,
 {
 	struct path path_save = {NULL, NULL};
 	struct dentry *ret;
+	int err = 0;
 
 	unionfs_read_lock(dentry->d_sb, UNIONFS_SMUTEX_CHILD);
 	if (dentry != dentry->d_parent)
@@ -193,7 +194,14 @@ static struct dentry *unionfs_lookup(struct inode *parent,
 	 * unionfs_lookup_backend returns a locked dentry upon success,
 	 * so we'll have to unlock it below.
 	 */
-	ret = unionfs_lookup_backend(dentry, nd, INTERPOSE_LOOKUP);
+
+	/* allocate dentry private data.  We free it in ->d_release */
+	err = new_dentry_private_data(dentry, UNIONFS_DMUTEX_CHILD);
+	if (unlikely(err)) {
+		ret = ERR_PTR(err);
+		goto out;
+	}
+	ret = unionfs_lookup_full(dentry, nd, INTERPOSE_LOOKUP);
 
 	/* restore the dentry & vfsmnt in namei */
 	if (nd) {
@@ -203,6 +211,11 @@ static struct dentry *unionfs_lookup(struct inode *parent,
 	if (!IS_ERR(ret)) {
 		if (ret)
 			dentry = ret;
+		/* lookup_full can return multiple positive dentries */
+		if (dentry->d_inode && !S_ISDIR(dentry->d_inode->i_mode)) {
+			BUG_ON(dbstart(dentry) < 0);
+			unionfs_postcopyup_release(dentry);
+		}
 		unionfs_copy_attr_times(dentry->d_inode);
 		/* parent times may have changed */
 		unionfs_copy_attr_times(dentry->d_parent->d_inode);
@@ -212,9 +225,10 @@ static struct dentry *unionfs_lookup(struct inode *parent,
 	if (!IS_ERR(ret)) {
 		unionfs_check_dentry(dentry);
 		unionfs_check_nd(nd);
-		unionfs_unlock_dentry(dentry);
 	}
+	unionfs_unlock_dentry(dentry);
 
+out:
 	if (dentry != dentry->d_parent) {
 		unionfs_check_dentry(dentry->d_parent);
 		unionfs_unlock_dentry(dentry->d_parent);
fs/unionfs/lookup.c +343 -5

387 lines not on this page · raw message

fs/unionfs/rename.c +1 -0
index 85f96ee..ecce9da 100644
@@ -195,6 +195,7 @@ static int do_unionfs_rename(struct inode *old_dir,
 		struct dentry *unlink_dentry;
 		struct dentry *unlink_dir_dentry;
 
+		BUG_ON(bindex < 0);
 		unlink_dentry = unionfs_lower_dentry_idx(new_dentry, bindex);
 		if (!unlink_dentry)
 			continue;
fs/unionfs/union.h +4 -0
index 9271b3b..81f34c4 100644
@@ -294,6 +294,7 @@ static inline void unionfs_double_lock_dentry(struct dentry *d1,
 }
 
 extern int new_dentry_private_data(struct dentry *dentry, int subclass);
+extern int realloc_dentry_private_data(struct dentry *dentry);
 extern void free_dentry_private_data(struct dentry *dentry);
 extern void update_bstart(struct dentry *dentry);
 extern int init_lower_nd(struct nameidata *nd, unsigned int flags);
@@ -309,6 +310,9 @@ extern struct dentry *create_parents(struct inode *dir, struct dentry *dentry,
 
 /* partial lookup */
 extern int unionfs_partial_lookup(struct dentry *dentry);
+extern struct dentry *unionfs_lookup_full(struct dentry *dentry,
+					  struct nameidata *nd_unused,
+					  int lookupmode);
 
 /* copies a file from dbstart to newbindex branch */
 extern int copyup_file(struct inode *dir, struct file *file, int bstart,
Signature · 1 line
1.5.2.2
author
#9 lore raw

PATCH 9/19 Unionfs: free lower paths array when destroying dentry's private data

In reply to Erez Zadok
CC Hugh Dickins <[email protected]>
---
 fs/unionfs/lookup.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
fs/unionfs/lookup.c +2 -0
index 37adf66..b5f64c9 100644
@@ -450,6 +450,8 @@ void free_dentry_private_data(struct dentry *dentry)
 {
 	if (!dentry || !dentry->d_fsdata)
 		return;
+	kfree(UNIONFS_D(dentry)->lower_paths);
+	UNIONFS_D(dentry)->lower_paths = NULL;
 	kmem_cache_free(unionfs_dentry_cachep, dentry->d_fsdata);
 	dentry->d_fsdata = NULL;
 }
Signature · 1 line
1.5.2.2
author
#10 lore raw

PATCH 10/19 Unionfs: cache coherency fixes

In reply to Erez Zadok

Handle unhashed or silly-renamed lower dentries properly.

---
 fs/unionfs/commonfops.c |    3 +-
 fs/unionfs/debug.c      |    2 +-
 fs/unionfs/dentry.c     |   49 +++++++++++++++++++++++++++++++++++++++++-----
 fs/unionfs/main.c       |    3 --
 4 files changed, 46 insertions(+), 11 deletions(-)
fs/unionfs/commonfops.c +2 -1
index df002d5..d64272b 100644
@@ -466,7 +466,8 @@ reval_dentry:
 	dgen = atomic_read(&UNIONFS_D(dentry)->generation);
 
 	if (unlikely(sbgen > dgen)) {
-		pr_debug("unionfs: retry (locked) dentry revalidation\n");
+		pr_debug("unionfs: retry (locked) dentry %s revalidation\n",
+			 dentry->d_name.name);
 		schedule();
 		goto reval_dentry;
 	}
fs/unionfs/debug.c +1 -1
index d154c32..4da4f0b 100644
@@ -313,7 +313,7 @@ check_inode:
 			}
 		}
 	/* check if lower inode is newer than upper one (it shouldn't) */
-	if (unlikely(is_newer_lower(dentry))) {
+	if (unlikely(is_newer_lower(dentry) && !is_negative_lower(dentry))) {
 		PRINT_CALLER(fname, fxn, line);
 		for (bindex = ibstart(inode); bindex <= ibend(inode);
 		     bindex++) {
fs/unionfs/dentry.c +43 -6

93 lines not on this page · raw message

fs/unionfs/main.c +0 -3
index a9d2cb6..1fd67c6 100644
@@ -88,9 +88,6 @@ struct dentry *unionfs_interpose(struct dentry *dentry, struct super_block *sb,
 
 	verify_locked(dentry);
 
-	/* Make sure that we didn't get a negative dentry. */
-	BUG_ON(is_negative_lower(dentry));
-
 	/*
 	 * We allocate our new inode below by calling unionfs_iget,
 	 * which will initialize some of the new inode's fields
Signature · 1 line
1.5.2.2
author
#11 lore raw

PATCH 11/19 Unionfs: remove old lookup code

In reply to Erez Zadok
---
 fs/unionfs/lookup.c |  337 ---------------------------------------------------
 fs/unionfs/union.h  |    3 -
 2 files changed, 0 insertions(+), 340 deletions(-)
fs/unionfs/lookup.c +0 -337
index b5f64c9..93c3a14 100644
@@ -63,343 +63,6 @@ struct dentry *__lookup_one(struct dentry *base, struct vfsmount *mnt,
 }
 
 /*
- * Main (and complex) driver function for Unionfs's lookup
- *
- * Returns: NULL (ok), ERR_PTR if an error occurred, or a non-null non-error
- * PTR if d_splice returned a different dentry.
- *
- * If lookupmode is INTERPOSE_PARTIAL/REVAL/REVAL_NEG, the passed dentry's
- * inode info must be locked.  If lookupmode is INTERPOSE_LOOKUP (i.e., a
- * newly looked-up dentry), then unionfs_lookup_backend will return a locked
- * dentry's info, which the caller must unlock.
- */
-struct dentry *unionfs_lookup_backend(struct dentry *dentry,
-				      struct nameidata *nd_unused,
-				      int lookupmode)
-{
-	int err = 0;
-	struct dentry *lower_dentry = NULL;
-	struct dentry *wh_lower_dentry = NULL;
-	struct dentry *lower_dir_dentry = NULL;
-	struct dentry *parent_dentry = NULL;
-	struct dentry *d_interposed = NULL;
-	int bindex, bstart = -1, bend, bopaque;
-	int dentry_count = 0;	/* Number of positive dentries. */
-	int first_dentry_offset = -1; /* -1 is uninitialized */
-	struct dentry *first_dentry = NULL;
-	struct dentry *first_lower_dentry = NULL;
-	struct vfsmount *first_lower_mnt = NULL;
-	int opaque;
-	const char *name;
-	int namelen;
-
-	/*
-	 * We should already have a lock on this dentry in the case of a
-	 * partial lookup, or a revalidation. Otherwise it is returned from
-	 * new_dentry_private_data already locked.
-	 */
-	if (lookupmode == INTERPOSE_PARTIAL || lookupmode == INTERPOSE_REVAL ||
-	    lookupmode == INTERPOSE_REVAL_NEG)
-		verify_locked(dentry);
-	else			/* this could only be INTERPOSE_LOOKUP */
-		BUG_ON(UNIONFS_D(dentry) != NULL);
-
-	switch (lookupmode) {
-	case INTERPOSE_PARTIAL:
-		break;
-	case INTERPOSE_LOOKUP:
-		err = new_dentry_private_data(dentry, UNIONFS_DMUTEX_CHILD);
-		if (unlikely(err))
-			goto out;
-		break;
-	default:
-		/* default: can only be INTERPOSE_REVAL/REVAL_NEG */
-		err = realloc_dentry_private_data(dentry);
-		if (unlikely(err))
-			goto out;
-		break;
-	}
-
-	/* must initialize dentry operations */
-	dentry->d_op = &unionfs_dops;
-
-	parent_dentry = dget_parent(dentry);
-	/* We never partial lookup the root directory. */
-	if (parent_dentry == dentry) {
-		dput(parent_dentry);
-		parent_dentry = NULL;
-		goto out;
-	}
-
-	name = dentry->d_name.name;
-	namelen = dentry->d_name.len;
-
-	/* No dentries should get created for possible whiteout names. */
-	if (!is_validname(name)) {
-		err = -EPERM;
-		goto out_free;
-	}
-
-	/* Now start the actual lookup procedure. */
-	bstart = dbstart(parent_dentry);
-	bend = dbend(parent_dentry);
-	bopaque = dbopaque(parent_dentry);
-	BUG_ON(bstart < 0);
-
-	/*
-	 * It would be ideal if we could convert partial lookups to only have
-	 * to do this work when they really need to.  It could probably improve
-	 * performance quite a bit, and maybe simplify the rest of the code.
-	 */
-	if (lookupmode == INTERPOSE_PARTIAL) {
-		bstart++;
-		if ((bopaque != -1) && (bopaque < bend))
-			bend = bopaque;
-	}
-
-	for (bindex = bstart; bindex <= bend; bindex++) {
-		lower_dentry = unionfs_lower_dentry_idx(dentry, bindex);
-		if (lookupmode == INTERPOSE_PARTIAL && lower_dentry)
-			continue;
-		BUG_ON(lower_dentry != NULL);
-
-		lower_dir_dentry =
-			unionfs_lower_dentry_idx(parent_dentry, bindex);
-
-		/* if the parent lower dentry does not exist skip this */
-		if (!(lower_dir_dentry && lower_dir_dentry->d_inode))
-			continue;
-
-		/* also skip it if the parent isn't a directory. */
-		if (!S_ISDIR(lower_dir_dentry->d_inode->i_mode))
-			continue;
-
-		/* check for whiteouts: stop lookup if found */
-		wh_lower_dentry = lookup_whiteout(name, lower_dir_dentry);
-		if (IS_ERR(wh_lower_dentry)) {
-			dput(first_lower_dentry);
-			unionfs_mntput(first_dentry, first_dentry_offset);
-			err = PTR_ERR(wh_lower_dentry);
-			goto out_free;
-		}
-		if (wh_lower_dentry->d_inode) {
-			dbend(dentry) = dbopaque(dentry) = bindex;
-			dput(wh_lower_dentry);
-			break;
-		}
-		dput(wh_lower_dentry);
-		wh_lower_dentry = NULL;
-
-		/* Now do regular lookup; lookup foo */
-		BUG_ON(!lower_dir_dentry);
-		lower_dentry = lookup_one_len(name, lower_dir_dentry, namelen);
-		if (IS_ERR(lower_dentry)) {
-			dput(first_lower_dentry);
-			unionfs_mntput(first_dentry, first_dentry_offset);
-			err = PTR_ERR(lower_dentry);
-			goto out_free;
-		}
-
-		/*
-		 * Store the first negative dentry specially, because if they
-		 * are all negative we need this for future creates.
-		 */
-		if (!lower_dentry->d_inode) {
-			if (!first_lower_dentry && (dbstart(dentry) == -1)) {
-				first_lower_dentry = lower_dentry;
-				/*
-				 * FIXME: following line needs to be changed
-				 * to allow mount-point crossing
-				 */
-				first_dentry = parent_dentry;
-				first_lower_mnt =
-					unionfs_mntget(parent_dentry, bindex);
-				first_dentry_offset = bindex;
-			} else {
-				dput(lower_dentry);
-			}
-
-			continue;
-		}
-
-		/*
-		 * If we already found at least one positive dentry
-		 * (dentry_count is non-zero), then we skip all remaining
-		 * positive dentries if their type is a non-dir.  This is
-		 * because only directories are allowed to stack on multiple
-		 * branches, but we have to skip non-dirs (to avoid, say,
-		 * calling readdir on a regular file).
-		 */
-		if ((lookupmode != INTERPOSE_PARTIAL) &&
-		    !S_ISDIR(lower_dentry->d_inode->i_mode) &&
-		    dentry_count) {
-			dput(lower_dentry);
-			continue;
-		}
-
-		/* number of positive dentries */
-		dentry_count++;
-
-		/* store underlying dentry */
-		if (dbstart(dentry) == -1)
-			dbstart(dentry) = bindex;
-		unionfs_set_lower_dentry_idx(dentry, bindex, lower_dentry);
-		/*
-		 * FIXME: the following line needs to get fixed to allow
-		 * mount-point crossing
-		 */
-		unionfs_set_lower_mnt_idx(dentry, bindex,
-					  unionfs_mntget(parent_dentry,
-							 bindex));
-		dbend(dentry) = bindex;
-
-		/* update parent directory's atime with the bindex */
-		fsstack_copy_attr_atime(parent_dentry->d_inode,
-					lower_dir_dentry->d_inode);
-
-		/* We terminate file lookups here. */
-		if (!S_ISDIR(lower_dentry->d_inode->i_mode)) {
-			if (lookupmode == INTERPOSE_PARTIAL)
-				continue;
-			if (dentry_count == 1)
-				goto out_positive;
-		}
-
-		opaque = is_opaque_dir(dentry, bindex);
-		if (opaque < 0) {
-			dput(first_lower_dentry);
-			unionfs_mntput(first_dentry, first_dentry_offset);
-			err = opaque;
-			goto out_free;
-		} else if (opaque) {
-			dbend(dentry) = dbopaque(dentry) = bindex;
-			break;
-		}
-	}
-
-	if (dentry_count)
-		goto out_positive;
-	else
-		goto out_negative;
-
-out_negative:
-	if (lookupmode == INTERPOSE_PARTIAL)
-		goto out;
-
-	/* If we've only got negative dentries, then use the leftmost one. */
-	if (lookupmode == INTERPOSE_REVAL)
-		goto out;
-
-	if (!lower_dir_dentry) {
-		err = -ENOENT;
-		goto out;
-	}
-	/* This should only happen if we found a whiteout. */
-	if (first_dentry_offset == -1) {
-		first_lower_dentry = lookup_one_len(name, lower_dir_dentry,
-						    namelen);
-		first_dentry_offset = bindex;
-		if (IS_ERR(first_lower_dentry)) {
-			err = PTR_ERR(first_lower_dentry);
-			goto out;
-		}
-
-		/*
-		 * FIXME: the following line needs to be changed to allow
-		 * mount-point crossing
-		 */
-		first_dentry = dentry;
-		first_lower_mnt = unionfs_mntget(dentry->d_sb->s_root,
-						 bindex);
-	}
-	unionfs_set_lower_dentry_idx(dentry, first_dentry_offset,
-				     first_lower_dentry);
-	unionfs_set_lower_mnt_idx(dentry, first_dentry_offset,
-				  first_lower_mnt);
-	dbstart(dentry) = dbend(dentry) = first_dentry_offset;
-
-	if (lookupmode == INTERPOSE_REVAL_NEG)
-		BUG_ON(dentry->d_inode != NULL);
-	else
-		d_add(dentry, NULL);
-	goto out;
-
-/* This part of the code is for positive dentries. */
-out_positive:
-	BUG_ON(dentry_count <= 0);
-
-	/*
-	 * If we're holding onto the first negative dentry & corresponding
-	 * vfsmount - throw it out.
-	 */
-	dput(first_lower_dentry);
-	unionfs_mntput(first_dentry, first_dentry_offset);
-
-	/* Partial lookups need to re-interpose, or throw away older negs. */
-	if (lookupmode == INTERPOSE_PARTIAL) {
-		if (dentry->d_inode) {
-			unionfs_reinterpose(dentry);
-			goto out;
-		}
-
-		/*
-		 * This somehow turned positive, so it is as if we had a
-		 * negative revalidation.
-		 */
-		lookupmode = INTERPOSE_REVAL_NEG;
-
-		update_bstart(dentry);
-		bstart = dbstart(dentry);
-		bend = dbend(dentry);
-	}
-
-	/*
-	 * Interpose can return a dentry if d_splice returned a different
-	 * dentry.
-	 */
-	d_interposed = unionfs_interpose(dentry, dentry->d_sb, lookupmode);
-	if (IS_ERR(d_interposed))
-		err = PTR_ERR(d_interposed);
-	else if (d_interposed)
-		dentry = d_interposed;
-
-	if (err)
-		goto out_drop;
-
-	goto out;
-
-out_drop:
-	d_drop(dentry);
-
-out_free:
-	/* should dput/mntput all the underlying dentries on error condition */
-	if (dbstart(dentry) >= 0)
-		path_put_lowers_all(dentry, false);
-	/* free lower_paths unconditionally */
-	kfree(UNIONFS_D(dentry)->lower_paths);
-	UNIONFS_D(dentry)->lower_paths = NULL;
-
-out:
-	if (!err && UNIONFS_D(dentry)) {
-		BUG_ON(dbend(dentry) > UNIONFS_D(dentry)->bcount);
-		BUG_ON(dbend(dentry) > sbmax(dentry->d_sb));
-		if (dbstart(dentry) < 0 &&
-		    dentry->d_inode && bstart >= 0 &&
-		    (!UNIONFS_I(dentry->d_inode) ||
-		     !UNIONFS_I(dentry->d_inode)->lower_inodes)) {
-			unionfs_mntput(dentry->d_sb->s_root, bstart);
-			dput(first_lower_dentry);
-		}
-	}
-	dput(parent_dentry);
-	if (err && (lookupmode == INTERPOSE_LOOKUP))
-		unionfs_unlock_dentry(dentry);
-	if (!err && d_interposed)
-		return d_interposed;
-	return ERR_PTR(err);
-}
-
-/*
  * This is a utility function that fills in a unionfs dentry.
  * Caller must lock this dentry with unionfs_lock_dentry.
  *
fs/unionfs/union.h +0 -3
index 81f34c4..356a146 100644
@@ -415,9 +415,6 @@ static inline int d_deleted(struct dentry *d)
 	return d_unhashed(d) && (d != d->d_sb->s_root);
 }
 
-struct dentry *unionfs_lookup_backend(struct dentry *dentry,
-				      struct nameidata *nd, int lookupmode);
-
 /* unionfs_permission, check if we should bypass error to facilitate copyup */
 #define IS_COPYUP_ERR(err) ((err) == -EROFS)
 
Signature · 1 line
1.5.2.2
author
#12 lore raw

PATCH 12/19 Unionfs: update maintainers

In reply to Erez Zadok
---
 MAINTAINERS |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
MAINTAINERS +1 -2
index 797e7b9..c722f8e 100644
@@ -4176,10 +4176,9 @@ S:	Maintained
 UNIONFS
 P:	Erez Zadok
 M:	[email protected]
-P:	Josef "Jeff" Sipek
-M:	[email protected]
 L:	[email protected]
 W:	http://unionfs.filesystems.org
+T:	git git.kernel.org/pub/scm/linux/kernel/git/ezk/unionfs.git
 S:	Maintained
 
 USB ACM DRIVER
Signature · 1 line
1.5.2.2
author
#13 lore raw

PATCH 13/19 Unionfs: update copyrights

In reply to Erez Zadok
---
 fs/unionfs/commonfops.c  |    6 +++---
 fs/unionfs/copyup.c      |    6 +++---
 fs/unionfs/debug.c       |    6 +++---
 fs/unionfs/dentry.c      |    6 +++---
 fs/unionfs/dirfops.c     |    6 +++---
 fs/unionfs/dirhelper.c   |    6 +++---
 fs/unionfs/fanout.h      |    6 +++---
 fs/unionfs/file.c        |    6 +++---
 fs/unionfs/inode.c       |    6 +++---
 fs/unionfs/lookup.c      |    6 +++---
 fs/unionfs/main.c        |    6 +++---
 fs/unionfs/mmap.c        |    6 +++---
 fs/unionfs/rdstate.c     |    6 +++---
 fs/unionfs/rename.c      |    6 +++---
 fs/unionfs/sioq.c        |    6 +++---
 fs/unionfs/sioq.h        |    6 +++---
 fs/unionfs/subr.c        |    6 +++---
 fs/unionfs/super.c       |    6 +++---
 fs/unionfs/union.h       |    6 +++---
 fs/unionfs/unlink.c      |    6 +++---
 fs/unionfs/whiteout.c    |    6 +++---
 fs/unionfs/xattr.c       |    6 +++---
 include/linux/union_fs.h |    6 +++---
 23 files changed, 69 insertions(+), 69 deletions(-)
fs/unionfs/commonfops.c +3 -3
index d64272b..5861970 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005-2006 Junjiro Okajima
@@ -8,8 +8,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/copyup.c +3 -3
index 55d48aa..bbd49c8 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005-2006 Junjiro Okajima
@@ -8,8 +8,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/debug.c +3 -3
index 4da4f0b..db62d22 100644
@@ -1,8 +1,8 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/dentry.c +3 -3
index dfa4755..7f0c7f7 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005-2006 Junjiro Okajima
@@ -8,8 +8,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/dirfops.c +3 -3
index e35afa4..14ca7d3 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005-2006 Junjiro Okajima
@@ -8,8 +8,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/dirhelper.c +3 -3
index 302a4a1..d936f03 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005-2006 Junjiro Okajima
@@ -8,8 +8,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/fanout.h +3 -3
index d8977bd..4f264de 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005      Arun M. Krishnakumar
@@ -7,8 +7,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/file.c +3 -3
index 9b5fc58..965d071 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005-2006 Junjiro Okajima
@@ -8,8 +8,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/inode.c +3 -3
index f81ebb6..fa3c518 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005-2006 Junjiro Okajima
@@ -8,8 +8,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/lookup.c +3 -3
index 93c3a14..0ae7f3a 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005-2006 Junjiro Okajima
@@ -8,8 +8,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/main.c +3 -3
index 1fd67c6..6484e2b 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005-2006 Junjiro Okajima
@@ -8,8 +8,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/mmap.c +3 -3
index febde7c..b7d4713 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005-2006 Junjiro Okajima
@@ -9,8 +9,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/rdstate.c +3 -3
index 7ba1e1a..06d5374 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005-2006 Junjiro Okajima
@@ -8,8 +8,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/rename.c +3 -3
index ecce9da..da7d589 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005-2006 Junjiro Okajima
@@ -8,8 +8,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/sioq.c +3 -3
index 0ea8436..e6f15a0 100644
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2006-2007 Erez Zadok
+ * Copyright (c) 2006-2008 Erez Zadok
  * Copyright (c) 2006      Charles P. Wright
  * Copyright (c) 2006-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2006      Junjiro Okajima
  * Copyright (c) 2006      David P. Quigley
- * Copyright (c) 2006-2007 Stony Brook University
- * Copyright (c) 2006-2007 The Research Foundation of SUNY
+ * Copyright (c) 2006-2008 Stony Brook University
+ * Copyright (c) 2006-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/sioq.h +3 -3
index afb71ee..e072bf7 100644
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2006-2007 Erez Zadok
+ * Copyright (c) 2006-2008 Erez Zadok
  * Copyright (c) 2006      Charles P. Wright
  * Copyright (c) 2006-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2006      Junjiro Okajima
  * Copyright (c) 2006      David P. Quigley
- * Copyright (c) 2006-2007 Stony Brook University
- * Copyright (c) 2006-2007 The Research Foundation of SUNY
+ * Copyright (c) 2006-2008 Stony Brook University
+ * Copyright (c) 2006-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/subr.c +3 -3
index dda2745..8747d20 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005-2006 Junjiro Okajima
@@ -8,8 +8,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/super.c +3 -3
index 3b6b65a..f163c08 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005-2006 Junjiro Okajima
@@ -8,8 +8,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/union.h +3 -3
index 356a146..4c7b213 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005      Arun M. Krishnakumar
@@ -7,8 +7,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/unlink.c +3 -3
index 3d6ca5f..623f68d 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005-2006 Junjiro Okajima
@@ -8,8 +8,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/whiteout.c +3 -3
index b1768ed..94b5241 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005-2006 Junjiro Okajima
@@ -8,8 +8,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
fs/unionfs/xattr.c +3 -3
index 8001c65..93a8fce 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2003-2006 Charles P. Wright
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
  * Copyright (c) 2005-2006 Junjiro Okajima
@@ -8,8 +8,8 @@
  * Copyright (c) 2003-2004 Mohammad Nayyer Zubair
  * Copyright (c) 2003      Puja Gupta
  * Copyright (c) 2003      Harikesavan Krishnan
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
include/linux/union_fs.h +3 -3
index 9d601d2..7199458 100644
@@ -1,8 +1,8 @@
 /*
- * Copyright (c) 2003-2007 Erez Zadok
+ * Copyright (c) 2003-2008 Erez Zadok
  * Copyright (c) 2005-2007 Josef 'Jeff' Sipek
- * Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of SUNY
+ * Copyright (c) 2003-2008 Stony Brook University
+ * Copyright (c) 2003-2008 The Research Foundation of SUNY
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
Signature · 1 line
1.5.2.2
author
#14 lore raw

PATCH 14/19 Unionfs: minor checkpatch fixes

In reply to Erez Zadok
---
 fs/unionfs/main.c  |   12 ------------
 fs/unionfs/super.c |    4 ++--
 2 files changed, 2 insertions(+), 14 deletions(-)
fs/unionfs/main.c +0 -12
index 6484e2b..0cdd50b 100644
@@ -459,8 +459,6 @@ static struct unionfs_dentry_info *unionfs_parse_options(
 
 	while ((optname = strsep(&options, ",")) != NULL) {
 		char *optarg;
-		char *endptr;
-		int intval;
 
 		if (!optname || !*optname)
 			continue;
@@ -493,16 +491,6 @@ static struct unionfs_dentry_info *unionfs_parse_options(
 			continue;
 		}
 
-		/* All of these options require an integer argument. */
-		intval = simple_strtoul(optarg, &endptr, 0);
-		if (*endptr) {
-			printk(KERN_ERR
-			       "unionfs: invalid %s option '%s'\n",
-			       optname, optarg);
-			err = -EINVAL;
-			goto out_error;
-		}
-
 		err = -EINVAL;
 		printk(KERN_ERR
 		       "unionfs: unrecognized option '%s'\n", optname);
fs/unionfs/super.c +2 -2
index f163c08..1f4b3f4 100644
@@ -33,8 +33,8 @@ struct inode *unionfs_iget(struct super_block *sb, unsigned long ino)
 	inode = iget_locked(sb, ino);
 	if (!inode)
 		return ERR_PTR(-ENOMEM);
- 	if (!(inode->i_state & I_NEW))
- 		return inode;
+	if (!(inode->i_state & I_NEW))
+		return inode;
 
 	info = UNIONFS_I(inode);
 	memset(info, 0, offsetof(struct unionfs_inode_info, vfs_inode));
Signature · 1 line
1.5.2.2
author
#15 lore raw

PATCH 15/19 Unionfs: properly hash newly created inodes

In reply to Erez Zadok

This fixes LTP's syscalls/rename13 test.

---
 fs/unionfs/inode.c |    2 +-
 fs/unionfs/main.c  |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)
fs/unionfs/inode.c +1 -1
index fa3c518..a05b412 100644
@@ -339,7 +339,7 @@ check_link:
 
 	/* Its a hard link, so use the same inode */
 	new_dentry->d_inode = igrab(old_dentry->d_inode);
-	d_instantiate(new_dentry, new_dentry->d_inode);
+	d_add(new_dentry, new_dentry->d_inode);
 	unionfs_copy_attr_all(dir, lower_new_dentry->d_parent->d_inode);
 	fsstack_copy_inode_size(dir, lower_new_dentry->d_parent->d_inode);
 
fs/unionfs/main.c +3 -0
index 0cdd50b..fea670b 100644
@@ -128,6 +128,9 @@ skip:
 	/* only (our) lookup wants to do a d_add */
 	switch (flag) {
 	case INTERPOSE_DEFAULT:
+		/* for operations which create new inodes */
+		d_add(dentry, inode);
+		break;
 	case INTERPOSE_REVAL_NEG:
 		d_instantiate(dentry, inode);
 		break;
Signature · 1 line
1.5.2.2
author
#16 lore raw

PATCH 16/19 Unionfs: symlink no longer takes a mode parameter

In reply to Erez Zadok
---
 fs/unionfs/copyup.c |    1 -
 fs/unionfs/inode.c  |    3 +--
 fs/unionfs/sioq.c   |    2 +-
 fs/unionfs/sioq.h   |    1 -
 4 files changed, 2 insertions(+), 5 deletions(-)
fs/unionfs/copyup.c +0 -1
index bbd49c8..ae6ea2b 100644
@@ -184,7 +184,6 @@ static int __copyup_ndentry(struct dentry *old_lower_dentry,
 		args.symlink.parent = new_lower_parent_dentry->d_inode;
 		args.symlink.dentry = new_lower_dentry;
 		args.symlink.symbuf = symbuf;
-		args.symlink.mode = old_mode;
 
 		run_sioq(__unionfs_symlink, &args);
 		err = args.err;
fs/unionfs/inode.c +1 -2
index a05b412..1a95e3b 100644
@@ -412,8 +412,7 @@ static int unionfs_symlink(struct inode *parent, struct dentry *dentry,
 	}
 
 	mode = S_IALLUGO;
-	err = vfs_symlink(lower_parent_dentry->d_inode, lower_dentry,
-			  symname, mode);
+	err = vfs_symlink(lower_parent_dentry->d_inode, lower_dentry, symname);
 	if (!err) {
 		err = PTR_ERR(unionfs_interpose(dentry, parent->i_sb, 0));
 		if (!err) {
fs/unionfs/sioq.c +1 -1
index e6f15a0..dd45e39 100644
@@ -87,7 +87,7 @@ void __unionfs_symlink(struct work_struct *work)
 	struct sioq_args *args = container_of(work, struct sioq_args, work);
 	struct symlink_args *s = &args->symlink;
 
-	args->err = vfs_symlink(s->parent, s->dentry, s->symbuf, s->mode);
+	args->err = vfs_symlink(s->parent, s->dentry, s->symbuf);
 	complete(&args->comp);
 }
 
fs/unionfs/sioq.h +0 -1
index e072bf7..679a0df 100644
@@ -49,7 +49,6 @@ struct symlink_args {
 	struct inode *parent;
 	struct dentry *dentry;
 	char *symbuf;
-	umode_t mode;
 };
 
 struct unlink_args {
Signature · 1 line
1.5.2.2
author
#17 lore raw

PATCH 17/19 Unionfs: permission no longer takes a nameidata parameter

In reply to Erez Zadok
---
 fs/unionfs/inode.c    |   11 ++---------
 fs/unionfs/whiteout.c |    4 ++--
 2 files changed, 4 insertions(+), 11 deletions(-)
fs/unionfs/inode.c +2 -9
index 1a95e3b..0bd9fab 100644
@@ -750,8 +750,7 @@ static void unionfs_put_link(struct dentry *dentry, struct nameidata *nd,
  * unionfs_permission, or anything it calls, will use stale branch
  * information.
  */
-static int unionfs_permission(struct inode *inode, int mask,
-			      struct nameidata *nd)
+static int unionfs_permission(struct inode *inode, int mask)
 {
 	struct inode *lower_inode = NULL;
 	int err = 0;
@@ -759,9 +758,6 @@ static int unionfs_permission(struct inode *inode, int mask,
 	const int is_file = !S_ISDIR(inode->i_mode);
 	const int write_mask = (mask & MAY_WRITE) && !(mask & MAY_READ);
 
-	if (nd)
-		unionfs_lock_dentry(nd->path.dentry, UNIONFS_DMUTEX_CHILD);
-
 	if (!UNIONFS_I(inode)->lower_inodes) {
 		if (is_file)	/* dirs can be unlinked but chdir'ed to */
 			err = -ESTALE;	/* force revalidate */
@@ -801,7 +797,7 @@ static int unionfs_permission(struct inode *inode, int mask,
 		 * readonly, because those conditions should lead to a
 		 * copyup taking place later on.
 		 */
-		err = permission(lower_inode, mask, nd);
+		err = inode_permission(lower_inode, mask);
 		if (err && bindex > 0) {
 			umode_t mode = lower_inode->i_mode;
 			if (is_robranch_super(inode->i_sb, bindex) &&
@@ -833,9 +829,6 @@ static int unionfs_permission(struct inode *inode, int mask,
 
 out:
 	unionfs_check_inode(inode);
-	unionfs_check_nd(nd);
-	if (nd)
-		unionfs_unlock_dentry(nd->path.dentry);
 	return err;
 }
 
fs/unionfs/whiteout.c +2 -2
index 94b5241..db7a21e 100644
@@ -455,7 +455,7 @@ int delete_whiteouts(struct dentry *dentry, int bindex,
 	lower_dir = lower_dir_dentry->d_inode;
 	BUG_ON(!S_ISDIR(lower_dir->i_mode));
 
-	if (!permission(lower_dir, MAY_WRITE | MAY_EXEC, NULL)) {
+	if (!inode_permission(lower_dir, MAY_WRITE | MAY_EXEC)) {
 		err = do_delete_whiteouts(dentry, bindex, namelist);
 	} else {
 		args.deletewh.namelist = namelist;
@@ -492,7 +492,7 @@ int is_opaque_dir(struct dentry *dentry, int bindex)
 
 	mutex_lock(&lower_inode->i_mutex);
 
-	if (!permission(lower_inode, MAY_EXEC, NULL)) {
+	if (!inode_permission(lower_inode, MAY_EXEC)) {
 		wh_lower_dentry =
 			lookup_one_len(UNIONFS_DIR_OPAQUE, lower_dentry,
 				       sizeof(UNIONFS_DIR_OPAQUE) - 1);
Signature · 1 line
1.5.2.2
author
#18 lore raw

PATCH 18/19 Unionfs: LOOKUP_ACCESS intent no longer exists

In reply to Erez Zadok
---
 fs/unionfs/lookup.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
fs/unionfs/lookup.c +0 -3
index 0ae7f3a..0a9602a 100644
@@ -252,9 +252,6 @@ int init_lower_nd(struct nameidata *nd, unsigned int flags)
 		nd->intent.open.file = file;
 #endif /* ALLOC_LOWER_ND_FILE */
 		break;
-	case LOOKUP_ACCESS:
-		nd->flags = flags;
-		break;
 	default:
 		/*
 		 * We should never get here, for now.
Signature · 1 line
1.5.2.2
author
#19 lore raw

PATCH 19/19 Unionfs: use new kmem_cache_create constructor prototype

In reply to Erez Zadok
---
 fs/unionfs/super.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/unionfs/super.c +1 -1
index 1f4b3f4..e774ef3 100644
@@ -900,7 +900,7 @@ static void unionfs_destroy_inode(struct inode *inode)
 }
 
 /* unionfs inode cache constructor */
-static void init_once(struct kmem_cache *cachep, void *obj)
+static void init_once(void *obj)
 {
 	struct unionfs_inode_info *i = obj;
 
Signature · 1 line
1.5.2.2