linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Erez Zadok <ezk@cs.sunysb.edu>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	viro@ftp.linux.org.uk, hch@infradead.org,
	Erez Zadok <ezk@cs.sunysb.edu>
Subject: [PATCH 07/25] Unionfs: add lower nameidata debugging support
Date: Tue, 25 Sep 2007 23:09:46 -0400	[thread overview]
Message-ID: <11907762071646-git-send-email-ezk@cs.sunysb.edu> (raw)
In-Reply-To: <11907762042481-git-send-email-ezk@cs.sunysb.edu>

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/debug.c  |   20 ++++++++++++++++++++
 fs/unionfs/dentry.c |    4 +++-
 fs/unionfs/inode.c  |    8 +++++++-
 fs/unionfs/union.h  |    4 ++++
 4 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/fs/unionfs/debug.c b/fs/unionfs/debug.c
index 2d15fb0..9546a41 100644
--- a/fs/unionfs/debug.c
+++ b/fs/unionfs/debug.c
@@ -415,6 +415,26 @@ void __unionfs_check_file(const struct file *file,
 	__unionfs_check_dentry(dentry,fname,fxn,line);
 }
 
+void __unionfs_check_nd(const struct nameidata *nd,
+			const char *fname, const char *fxn, int line)
+{
+	struct file *file;
+	int printed_caller = 0;
+
+	if (!nd)
+		return;
+	if (nd->flags & LOOKUP_OPEN) {
+		file = nd->intent.open.file;
+		if (file->f_path.dentry &&
+		    strcmp(file->f_dentry->d_sb->s_type->name, "unionfs")) {
+			PRINT_CALLER(fname, fxn, line);
+			printk(" CND1: lower_file of type %s\n",
+			       file->f_path.dentry->d_sb->s_type->name);
+			BUG();
+		}
+	}
+}
+
 /* useful to track vfsmount leaks that could cause EBUSY on unmount */
 void __show_branch_counts(const struct super_block *sb,
 			  const char *file, const char *fxn, int line)
diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c
index d9bb199..b21f1e3 100644
--- a/fs/unionfs/dentry.c
+++ b/fs/unionfs/dentry.c
@@ -418,8 +418,10 @@ static int unionfs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
 	unionfs_lock_dentry(dentry);
 	err = __unionfs_d_revalidate_chain(dentry, nd, false);
 	unionfs_unlock_dentry(dentry);
-	if (err > 0) /* true==1: dentry is valid */
+	if (err > 0) { /* true==1: dentry is valid */
 		unionfs_check_dentry(dentry);
+		unionfs_check_nd(nd);
+	}
 
 	unionfs_read_unlock(dentry->d_sb);
 
diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index de78e26..f8b2c88 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -138,8 +138,10 @@ out:
 	unionfs_read_unlock(dentry->d_sb);
 
 	unionfs_check_inode(parent);
-	if (!err)
+	if (!err) {
 		unionfs_check_dentry(dentry->d_parent);
+		unionfs_check_nd(nd);
+	}
 	unionfs_check_dentry(dentry);
 	return err;
 }
@@ -186,6 +188,7 @@ static struct dentry *unionfs_lookup(struct inode *parent,
 	unionfs_check_inode(parent);
 	unionfs_check_dentry(dentry);
 	unionfs_check_dentry(dentry->d_parent);
+	unionfs_check_nd(nd);
 	unionfs_read_unlock(dentry->d_sb);
 
 	return ret;
@@ -856,6 +859,7 @@ static void *unionfs_follow_link(struct dentry *dentry, struct nameidata *nd)
 
 out:
 	unionfs_check_dentry(dentry);
+	unionfs_check_nd(nd);
 	unionfs_read_unlock(dentry->d_sb);
 	return ERR_PTR(err);
 }
@@ -872,6 +876,7 @@ static void unionfs_put_link(struct dentry *dentry, struct nameidata *nd,
 	unionfs_unlock_dentry(dentry);
 
 	unionfs_check_dentry(dentry);
+	unionfs_check_nd(nd);
 	kfree(nd_get_link(nd));
 	unionfs_read_unlock(dentry->d_sb);
 }
@@ -1002,6 +1007,7 @@ static int unionfs_permission(struct inode *inode, int mask,
 
 out:
 	unionfs_check_inode(inode);
+	unionfs_check_nd(nd);
 	return err;
 }
 
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 755bc25..d27844d 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -518,6 +518,8 @@ static inline void unionfs_mntput(struct dentry *dentry, int bindex)
 	__FILE__,__FUNCTION__,__LINE__)
 #define unionfs_check_file(f)	__unionfs_check_file((f),	\
 	__FILE__,__FUNCTION__,__LINE__)
+#define unionfs_check_nd(n)	__unionfs_check_nd((n),		\
+	__FILE__,__FUNCTION__,__LINE__)
 #define show_branch_counts(sb)	__show_branch_counts((sb),	\
 	__FILE__,__FUNCTION__,__LINE__)
 #define show_inode_times(i)	__show_inode_times((i),		\
@@ -534,6 +536,8 @@ extern void __unionfs_check_dentry(const struct dentry *dentry,
 				   int line);
 extern void __unionfs_check_file(const struct file *file,
 				 const char *fname, const char *fxn, int line);
+extern void __unionfs_check_nd(const struct nameidata *nd,
+			       const char *fname, const char *fxn, int line);
 extern void __show_branch_counts(const struct super_block *sb,
 				 const char *file, const char *fxn, int line);
 extern void __show_inode_times(const struct inode *inode,
-- 
1.5.2.2


  parent reply	other threads:[~2007-09-26  3:30 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-26  3:09 [GIT PULL -mm] 00/25 Unionfs updates/cleanups/fixes Erez Zadok
2007-09-26  3:09 ` [PATCH 01/25] Unionfs: Simplify unionfs_get_nlinks Erez Zadok
2007-09-26  3:09 ` [PATCH 02/25] Unionfs: Remove unused #defines Erez Zadok
2007-09-26  3:09 ` [PATCH 03/25] Unionfs: display informational messages only if debug is on Erez Zadok
2007-09-26  8:36   ` Jan Engelhardt
2007-09-26 14:01     ` Erez Zadok
2007-09-26 15:24       ` Jan Engelhardt
2007-09-26 15:28         ` Erez Zadok
2007-09-26  3:09 ` [PATCH 04/25] Unionfs: cache-coherency fixes Erez Zadok
2007-09-26  3:09 ` [PATCH 05/25] Unionfs: cast page->index loff_t before shifting Erez Zadok
2007-09-26  8:31   ` Christoph Hellwig
2007-09-26 13:44     ` Erez Zadok
2007-09-26  3:09 ` [PATCH 06/25] Unionfs: minor coding style updates Erez Zadok
2007-09-26  3:09 ` Erez Zadok [this message]
2007-09-26  3:09 ` [PATCH 08/25] Unionfs: lower nameidata support for nfsv4 Erez Zadok
2007-09-26  3:09 ` [PATCH 09/25] Unionfs: add un/likely conditionals on common fileops Erez Zadok
2007-09-26  3:09 ` [PATCH 10/25] Unionfs: add un/likely conditionals on copyup ops Erez Zadok
2007-09-26  4:32   ` Kok, Auke
2007-09-26 13:40     ` Erez Zadok
2007-09-26 15:23       ` Kyle Moffett
2007-09-26 15:43         ` Erez Zadok
2007-09-26 16:47           ` Jan Engelhardt
2007-09-26 16:51             ` Erez Zadok
2007-09-26 18:34       ` Adrian Bunk
2007-09-26  3:09 ` [PATCH 11/25] Unionfs: add un/likely conditionals on debug ops Erez Zadok
2007-09-26 21:34   ` roel
2007-09-26  3:09 ` [PATCH 12/25] Unionfs: add un/likely conditionals on dentry ops Erez Zadok
2007-09-26  3:09 ` [PATCH 13/25] Unionfs: add un/likely conditionals on dir ops Erez Zadok
2007-09-26 21:40   ` roel
2007-09-27 14:28     ` Erez Zadok
2007-09-26  3:09 ` [PATCH 14/25] Unionfs: add un/likely conditionals on headers Erez Zadok
2007-09-26  3:09 ` [PATCH 15/25] Unionfs: add un/likely conditionals on fileops Erez Zadok
2007-09-26  3:09 ` [PATCH 16/25] Unionfs: add un/likely conditionals on inode ops Erez Zadok
2007-09-26  3:09 ` [PATCH 17/25] Unionfs: add un/likely conditionals on lookup ops Erez Zadok
2007-09-26  3:09 ` [PATCH 18/25] Unionfs: add un/likely conditionals on super ops Erez Zadok
2007-09-26  3:09 ` [PATCH 19/25] Unionfs: add un/likely conditionals on mmap ops Erez Zadok
2007-09-26  3:09 ` [PATCH 20/25] Unionfs: add un/likely conditionals on rename ops Erez Zadok
2007-09-26  3:10 ` [PATCH 21/25] Unionfs: add un/likely conditionals on readdir ops Erez Zadok
2007-09-26  3:10 ` [PATCH 22/25] Unionfs: add un/likely conditionals on common subr Erez Zadok
2007-09-26  3:10 ` [PATCH 23/25] Unionfs: add un/likely conditionals on unlink ops Erez Zadok
2007-09-26  3:10 ` [PATCH 24/25] Unionfs: add un/likely conditionals on xattr ops Erez Zadok
2007-09-26  3:10 ` [PATCH 25/25] Unionfs: use poison.h for safe poison pointers Erez Zadok

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11907762071646-git-send-email-ezk@cs.sunysb.edu \
    --to=ezk@cs.sunysb.edu \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).