ia64: use non-racy method for proc entries creation

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

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Denis V. Lunev
2008-04-29 01:02:25 -07:00
committed by Linus Torvalds
parent c293819a3c
commit e23637681b
5 changed files with 20 additions and 36 deletions

View File

@@ -6695,16 +6695,12 @@ pfm_init(void)
/*
* create /proc/perfmon (mostly for debugging purposes)
*/
perfmon_dir = create_proc_entry("perfmon", S_IRUGO, NULL);
perfmon_dir = proc_create("perfmon", S_IRUGO, NULL, &pfm_proc_fops);
if (perfmon_dir == NULL) {
printk(KERN_ERR "perfmon: cannot create /proc entry, perfmon disabled\n");
pmu_conf = NULL;
return -1;
}
/*
* install customized file operations for /proc/perfmon entry
*/
perfmon_dir->proc_fops = &pfm_proc_fops;
/*
* create /proc/sys/kernel/perfmon (for debugging purposes)

View File

@@ -648,18 +648,16 @@ salinfo_init(void)
if (!dir)
continue;
entry = create_proc_entry("event", S_IRUSR, dir);
entry = proc_create_data("event", S_IRUSR, dir,
&salinfo_event_fops, data);
if (!entry)
continue;
entry->data = data;
entry->proc_fops = &salinfo_event_fops;
*sdir++ = entry;
entry = create_proc_entry("data", S_IRUSR | S_IWUSR, dir);
entry = proc_create_data("data", S_IRUSR | S_IWUSR, dir,
&salinfo_data_fops, data);
if (!entry)
continue;
entry->data = data;
entry->proc_fops = &salinfo_data_fops;
*sdir++ = entry;
/* we missed any events before now */