[PATCH 6/29] reiserfs: use non-racy method for proc entries creation

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Denis V. Lunev
Date: Tuesday, April 8, 2008 - 4:19 am

Use proc_create()/proc_create_data() to make sure that ->proc_fops and
->data be setup before gluing PDE to main tree.

/proc entry owner is also added.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: reiserfs-dev@namesys.com
CC: reiserfs-devel@vger.kernel.org
---
 fs/reiserfs/procfs.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c
index 8f86c52..b9dbeec 100644
--- a/fs/reiserfs/procfs.c
+++ b/fs/reiserfs/procfs.c
@@ -467,6 +467,7 @@ static const struct file_operations r_file_operations = {
 	.read = seq_read,
 	.llseek = seq_lseek,
 	.release = seq_release,
+	.owner = THIS_MODULE,
 };
 
 static struct proc_dir_entry *proc_info_root = NULL;
@@ -475,12 +476,8 @@ static const char proc_info_root_name[] = "fs/reiserfs";
 static void add_file(struct super_block *sb, char *name,
 		     int (*func) (struct seq_file *, struct super_block *))
 {
-	struct proc_dir_entry *de;
-	de = create_proc_entry(name, 0, REISERFS_SB(sb)->procdir);
-	if (de) {
-		de->data = func;
-		de->proc_fops = &r_file_operations;
-	}
+	proc_create_data(name, 0, REISERFS_SB(sb)->procdir,
+			 &r_file_operations, func);
 }
 
 int reiserfs_proc_info_init(struct super_block *sb)
-- 
1.5.3.rc5

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/29] proc entries creation race, Denis V. Lunev, (Tue Apr 8, 4:18 am)
[PATCH 6/29] reiserfs: use non-racy method for proc entrie ..., Denis V. Lunev, (Tue Apr 8, 4:19 am)
[patch, -git] isdn: hysdn_procconf.c build fix, Ingo Molnar, (Wed Apr 30, 10:57 am)
Re: [patch, -git] isdn: hysdn_procconf.c build fix, Andrew Morton, (Wed Apr 30, 11:10 am)
Re: [patch, -git] isdn: hysdn_procconf.c build fix, Ingo Molnar, (Wed Apr 30, 11:30 am)
Re: [patch, -git] isdn: hysdn_procconf.c build fix, Andrew Morton, (Wed Apr 30, 11:47 am)
Re: [patch, -git] isdn: hysdn_procconf.c build fix, Denis V. Lunev, (Wed Apr 30, 12:03 pm)
Re: [patch, -git] isdn: hysdn_procconf.c build fix, Andrew Morton, (Wed Apr 30, 12:14 pm)
Re: [patch, -git] isdn: hysdn_procconf.c build fix, Harvey Harrison, (Wed Apr 30, 12:24 pm)
Re: [patch, -git] isdn: hysdn_procconf.c build fix, Alexey Dobriyan, (Wed Apr 30, 2:21 pm)