head	1.1;
access;
symbols
	LKML-branch:1.1.0.2;
locks; strict;
comment	@# @;


1.1
date	2006.10.04.23.03.46;	author jsipek;	state dead;
branches
	1.1.2.1;
next	;

1.1.2.1
date	2006.10.04.23.03.46;	author jsipek;	state Exp;
branches;
next	1.1.2.2;

1.1.2.2
date	2006.10.05.00.07.41;	author jsipek;	state Exp;
branches;
next	1.1.2.3;

1.1.2.3
date	2006.10.05.00.14.18;	author jsipek;	state Exp;
branches;
next	1.1.2.4;

1.1.2.4
date	2006.10.05.17.30.46;	author jsipek;	state Exp;
branches;
next	1.1.2.5;

1.1.2.5
date	2006.10.09.20.26.10;	author jsipek;	state Exp;
branches;
next	1.1.2.6;

1.1.2.6
date	2006.10.24.06.14.16;	author jsipek;	state dead;
branches;
next	;


desc
@@


1.1
log
@file lookup-one-len-changes was initially added on branch LKML-branch.
@
text
@@


1.1.2.1
log
@lookup_one_len{,_nd} code
@
text
@a0 49
diff -r 7b299f3efe1b fs/namei.c
--- a/fs/namei.c	Mon Oct 02 19:55:38 2006 -0400
+++ b/fs/namei.c	Wed Oct 04 18:51:53 2006 -0400
@@@@ -1295,8 +1295,7 @@@@ static struct dentry *lookup_hash(struct
 	return __lookup_hash(&nd->last, nd->dentry, nd);
 }
 
-/* SMP-safe */
-struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
+struct dentry * lookup_one_len_nd(const char *name, struct dentry * base, int len, struct nameidata *nd)
 {
 	unsigned long hash;
 	struct qstr this;
@@@@ -1316,7 +1315,7 @@@@ struct dentry * lookup_one_len(const cha
 	}
 	this.hash = end_name_hash(hash);
 
-	return __lookup_hash(&this, base, NULL);
+	return __lookup_hash(&this, base, nd);
 access:
 	return ERR_PTR(-EACCES);
 }
@@@@ -2761,7 +2760,7 @@@@ EXPORT_SYMBOL(get_write_access); /* binf
 EXPORT_SYMBOL(get_write_access); /* binfmt_aout */
 EXPORT_SYMBOL(getname);
 EXPORT_SYMBOL(lock_rename);
-EXPORT_SYMBOL(lookup_one_len);
+EXPORT_SYMBOL(lookup_one_len_nd);
 EXPORT_SYMBOL(page_follow_link_light);
 EXPORT_SYMBOL(page_put_link);
 EXPORT_SYMBOL(page_readlink);
diff -r 7b299f3efe1b include/linux/namei.h
--- a/include/linux/namei.h	Mon Oct 02 19:55:38 2006 -0400
+++ b/include/linux/namei.h	Wed Oct 04 18:50:48 2006 -0400
@@@@ -76,7 +76,13 @@@@ extern struct file *nameidata_to_filp(st
 extern struct file *nameidata_to_filp(struct nameidata *nd, int flags);
 extern void release_open_intent(struct nameidata *);
 
-extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
+extern struct dentry * lookup_one_len_nd(const char *, struct dentry *, int, struct nameidata *);
+
+/* SMP-safe */
+static inline struct dentry *lookup_one_len(const char *name, struct dentry *dir, int len)
+{
+	return lookup_one_len_nd(name, dir, len, NULL);
+}
 
 extern int follow_down(struct vfsmount **, struct dentry **);
 extern int follow_up(struct vfsmount **, struct dentry **);
@


1.1.2.2
log
@Alright, this passes the intents down to lower fs...let the testing ensue
@
text
@d3 1
a3 1
+++ b/fs/namei.c	Wed Oct 04 18:59:06 2006 -0400
d34 1
a34 1
+++ b/include/linux/namei.h	Wed Oct 04 18:59:06 2006 -0400
a49 140
diff -r 7b299f3efe1b fs/unionfs/commonfops.c
--- a/fs/unionfs/commonfops.c	Mon Oct 02 19:55:38 2006 -0400
+++ b/fs/unionfs/commonfops.c	Wed Oct 04 19:40:55 2006 -0400
@@@@ -36,7 +36,13 @@@@ static int copyup_deleted_file(struct fi
 	struct dentry *hidden_dentry = NULL;
 	struct dentry *hidden_dir_dentry = NULL;
 
+	struct nameidata nd;
+
 	hidden_dentry = dtohd_index(dentry, bstart);
+
+	nd.dentry = hidden_dentry;
+	nd.mnt = dtohm_index(dentry, bstart);
+	nd.flags = LOOKUP_OPEN | LOOKUP_CREATE;
 
 	sprintf(name, ".unionfs%*.*lx",
 			i_inosize, i_inosize, hidden_dentry->d_inode->i_ino);
@@@@ -52,8 +58,8 @@@@ static int copyup_deleted_file(struct fi
 		printk(KERN_DEBUG "unionfs: trying to rename %s to %s\n",
 				dentry->d_name.name, name);
 
-		tmp_dentry = lookup_one_len(name, hidden_dentry->d_parent,
-					    UNIONFS_TMPNAM_LEN);
+		tmp_dentry = lookup_one_len_nd(name, hidden_dentry->d_parent,
+					    UNIONFS_TMPNAM_LEN, &nd);
 		if (IS_ERR(tmp_dentry)) {
 			err = PTR_ERR(tmp_dentry);
 			goto out;
diff -r 7b299f3efe1b fs/unionfs/dentry.c
--- a/fs/unionfs/dentry.c	Mon Oct 02 19:55:38 2006 -0400
+++ b/fs/unionfs/dentry.c	Wed Oct 04 19:59:15 2006 -0400
@@@@ -38,6 +38,13 @@@@ int unionfs_d_revalidate(struct dentry *
 	int restart = 0;
 	int interpose_flag;
 
+	struct nameidata lowernd;
+
+	if (nd)
+		memcpy(&lowernd, nd, sizeof(struct nameidata));
+	else
+		memset(&lowernd, 0, sizeof(struct nameidata));
+
 restart:
 	verify_locked(dentry);
 
@@@@ -124,7 +131,7 @@@@ restart:
 			mutex_unlock(&dentry->d_inode->i_mutex);
 		}
 
-		result = unionfs_lookup_backend(dentry, interpose_flag);
+		result = unionfs_lookup_backend(dentry, &lowernd, interpose_flag);
 		if (result) {
 			if (IS_ERR(result)) {
 				valid = 0;
diff -r 7b299f3efe1b fs/unionfs/inode.c
--- a/fs/unionfs/inode.c	Mon Oct 02 19:55:38 2006 -0400
+++ b/fs/unionfs/inode.c	Wed Oct 04 19:58:00 2006 -0400
@@@@ -195,8 +195,15 @@@@ struct dentry *unionfs_lookup(struct ino
 struct dentry *unionfs_lookup(struct inode *parent, struct dentry *dentry,
 			      struct nameidata *nd)
 {
+	struct nameidata lowernd;
+
+	if (nd)
+		memcpy(&lowernd, nd, sizeof(struct nameidata));
+	else
+		memset(&lowernd, 0, sizeof(struct nameidata));
+
 	/* The locking is done by unionfs_lookup_backend. */
-	return unionfs_lookup_backend(dentry, INTERPOSE_LOOKUP);
+	return unionfs_lookup_backend(dentry, &lowernd, INTERPOSE_LOOKUP);
 }
 
 static int unionfs_link(struct dentry *old_dentry, struct inode *dir,
diff -r 7b299f3efe1b fs/unionfs/lookup.c
--- a/fs/unionfs/lookup.c	Mon Oct 02 19:55:38 2006 -0400
+++ b/fs/unionfs/lookup.c	Wed Oct 04 19:52:16 2006 -0400
@@@@ -21,7 +21,7 @@@@ static int is_opaque_dir(struct dentry *
 static int is_opaque_dir(struct dentry *dentry, int bindex);
 static int is_validname(const char *name);
 
-struct dentry *unionfs_lookup_backend(struct dentry *dentry, int lookupmode)
+struct dentry *unionfs_lookup_backend(struct dentry *dentry, struct nameidata *nd, int lookupmode)
 {
 	int err = 0;
 	struct dentry *hidden_dentry = NULL;
@@@@ -148,8 +148,12 @@@@ struct dentry *unionfs_lookup_backend(st
 		wh_hidden_dentry = NULL;
 
 		/* Now do regular lookup; lookup foo */
-		hidden_dentry = lookup_one_len(name, hidden_dir_dentry,
-					       namelen);
+		nd->dentry = dtohd_index(dentry, bindex);
+		/* FIXME: fix following line for mount point crossing */
+		nd->mnt = dtohm_index(parent_dentry, bindex);
+
+		hidden_dentry = lookup_one_len_nd(name, hidden_dir_dentry,
+					       namelen, nd);
 		if (IS_ERR(hidden_dentry)) {
 			dput(first_hidden_dentry);
 			mntput(first_hidden_mnt);
@@@@ -231,8 +235,12 @@@@ out_negative:
 	}
 	/* This should only happen if we found a whiteout. */
 	if (first_dentry_offset == -1) {
-		first_hidden_dentry = lookup_one_len(name, hidden_dir_dentry,
-						     namelen);
+		nd->dentry = dentry;
+		/* FIXME: fix following line for mount point crossing */
+		nd->mnt = dtohm_index(parent_dentry, bindex);
+
+		first_hidden_dentry = lookup_one_len_nd(name, hidden_dir_dentry,
+						     namelen, nd);
 		first_dentry_offset = bindex;
 		if (IS_ERR(first_hidden_dentry)) {
 			err = PTR_ERR(first_hidden_dentry);
@@@@ -324,8 +332,9 @@@@ int unionfs_partial_lookup(struct dentry
 int unionfs_partial_lookup(struct dentry *dentry)
 {
 	struct dentry *tmp;
-
-	tmp = unionfs_lookup_backend(dentry, INTERPOSE_PARTIAL);
+	struct nameidata nd = { .flags = 0 };
+
+	tmp = unionfs_lookup_backend(dentry, &nd, INTERPOSE_PARTIAL);
 	if (!tmp)
 		return 0;
 	if (IS_ERR(tmp))
diff -r 7b299f3efe1b fs/unionfs/union.h
--- a/fs/unionfs/union.h	Mon Oct 02 19:55:38 2006 -0400
+++ b/fs/unionfs/union.h	Wed Oct 04 19:42:45 2006 -0400
@@@@ -399,7 +399,7 @@@@ static inline void fist_copy_attr_all(st
 	dest->i_flags = src->i_flags;
 }
 
-struct dentry *unionfs_lookup_backend(struct dentry *dentry, int lookupmode);
+struct dentry *unionfs_lookup_backend(struct dentry *dentry, struct nameidata *nd, int lookupmode);
 int is_stale_inode(struct inode *inode);
 void make_stale_inode(struct inode *inode);
 
@


1.1.2.3
log
@Split into 2 patches - one for intent passing, other for lookup_one_len
changes
@
text
@d3 1
a3 1
+++ b/fs/namei.c	Wed Oct 04 20:09:26 2006 -0400
d34 1
a34 1
+++ b/include/linux/namei.h	Wed Oct 04 20:09:26 2006 -0400
d50 140
@


1.1.2.4
log
@More intent passing - the intent is wrong, but that should be easy to fix
Moved lookup_one_len_nd to be the second patch in the series
Make the patches little bit uniform
@
text
@a0 12
lookup_one_len_nd - lookup_one_len with nameidata argument

From: Josef "Jeff" Sipek <jsipek@@cs.sunysb.edu>

This patch renames lookup_one_len to lookup_one_len_nd, and adds a nameidata
argument. An inline function, lookup_one_len (which calls lookup_one_len_nd
with nd == NULL) preserves original behavior.

The following Unionfs patches depend on this one.

Signed-off-by: Josef "Jeff" Sipek <jsipek@@cs.sunysb.edu>

@


1.1.2.5
log
@Line wrapping
@
text
@d13 4
a16 4
diff -r 06b12f84284e fs/namei.c
--- a/fs/namei.c	Sat Oct 07 19:08:19 2006 -0400
+++ b/fs/namei.c	Mon Oct 09 16:22:59 2006 -0400
@@@@ -1295,8 +1295,8 @@@@ static struct dentry *lookup_hash(struct
d22 1
a22 2
+struct dentry * lookup_one_len_nd(const char *name, struct dentry * base,
+				  int len, struct nameidata *nd)
d26 1
a26 1
@@@@ -1316,7 +1316,7 @@@@ struct dentry * lookup_one_len(const cha
d35 1
a35 1
@@@@ -2761,7 +2761,7 @@@@ EXPORT_SYMBOL(get_write_access); /* binf
d44 4
a47 4
diff -r 06b12f84284e include/linux/namei.h
--- a/include/linux/namei.h	Sat Oct 07 19:08:19 2006 -0400
+++ b/include/linux/namei.h	Mon Oct 09 16:16:08 2006 -0400
@@@@ -76,7 +76,15 @@@@ extern struct file *nameidata_to_filp(st
d52 1
a52 2
+extern struct dentry * lookup_one_len_nd(const char *,
+			struct dentry *, int, struct nameidata *);
d55 1
a55 2
+static inline struct dentry *lookup_one_len(const char *name,
+			struct dentry *dir, int len)
@


1.1.2.6
log
@Move unionfs specific bits into a subdir
@
text
@@


