Commit 8b594007 authored by Denis V. Lunev's avatar Denis V. Lunev Committed by Linus Torvalds

s390: use non-racy method for proc entries creation

Use proc_create() to make sure that ->proc_fops be setup before gluing PDE to
main tree.
Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent cdefa185
...@@ -157,6 +157,7 @@ static int dasd_devices_open(struct inode *inode, struct file *file) ...@@ -157,6 +157,7 @@ static int dasd_devices_open(struct inode *inode, struct file *file)
} }
static const struct file_operations dasd_devices_file_ops = { static const struct file_operations dasd_devices_file_ops = {
.owner = THIS_MODULE,
.open = dasd_devices_open, .open = dasd_devices_open,
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = seq_lseek,
...@@ -315,13 +316,12 @@ dasd_proc_init(void) ...@@ -315,13 +316,12 @@ dasd_proc_init(void)
if (!dasd_proc_root_entry) if (!dasd_proc_root_entry)
goto out_nodasd; goto out_nodasd;
dasd_proc_root_entry->owner = THIS_MODULE; dasd_proc_root_entry->owner = THIS_MODULE;
dasd_devices_entry = create_proc_entry("devices", dasd_devices_entry = proc_create("devices",
S_IFREG | S_IRUGO | S_IWUSR, S_IFREG | S_IRUGO | S_IWUSR,
dasd_proc_root_entry); dasd_proc_root_entry,
&dasd_devices_file_ops);
if (!dasd_devices_entry) if (!dasd_devices_entry)
goto out_nodevices; goto out_nodevices;
dasd_devices_entry->proc_fops = &dasd_devices_file_ops;
dasd_devices_entry->owner = THIS_MODULE;
dasd_statistics_entry = create_proc_entry("statistics", dasd_statistics_entry = create_proc_entry("statistics",
S_IFREG | S_IRUGO | S_IWUSR, S_IFREG | S_IRUGO | S_IWUSR,
dasd_proc_root_entry); dasd_proc_root_entry);
......
...@@ -111,6 +111,7 @@ static int tape_proc_open(struct inode *inode, struct file *file) ...@@ -111,6 +111,7 @@ static int tape_proc_open(struct inode *inode, struct file *file)
static const struct file_operations tape_proc_ops = static const struct file_operations tape_proc_ops =
{ {
.owner = THIS_MODULE,
.open = tape_proc_open, .open = tape_proc_open,
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = seq_lseek,
...@@ -124,14 +125,12 @@ void ...@@ -124,14 +125,12 @@ void
tape_proc_init(void) tape_proc_init(void)
{ {
tape_proc_devices = tape_proc_devices =
create_proc_entry ("tapedevices", S_IFREG | S_IRUGO | S_IWUSR, proc_create("tapedevices", S_IFREG | S_IRUGO | S_IWUSR, NULL,
NULL); &tape_proc_ops);
if (tape_proc_devices == NULL) { if (tape_proc_devices == NULL) {
PRINT_WARN("tape: Cannot register procfs entry tapedevices\n"); PRINT_WARN("tape: Cannot register procfs entry tapedevices\n");
return; return;
} }
tape_proc_devices->proc_fops = &tape_proc_ops;
tape_proc_devices->owner = THIS_MODULE;
} }
/* /*
......
...@@ -374,13 +374,10 @@ cio_ignore_proc_init (void) ...@@ -374,13 +374,10 @@ cio_ignore_proc_init (void)
{ {
struct proc_dir_entry *entry; struct proc_dir_entry *entry;
entry = create_proc_entry ("cio_ignore", S_IFREG | S_IRUGO | S_IWUSR, entry = proc_create("cio_ignore", S_IFREG | S_IRUGO | S_IWUSR, NULL,
NULL); &cio_ignore_proc_fops);
if (!entry) if (!entry)
return -ENOENT; return -ENOENT;
entry->proc_fops = &cio_ignore_proc_fops;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment