Skip to content

Commit 46fe74f

Browse files
dlunevtorvalds
authored andcommitted
ext4: 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: <linux-ext4@vger.kernel.org> 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>
1 parent 21ac295 commit 46fe74f

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

‎fs/ext4/mballoc.c‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,17 +2449,10 @@ static void ext4_mb_history_init(struct super_block *sb)
24492449
int i;
24502450

24512451
if (sbi->s_mb_proc != NULL) {
2452-
struct proc_dir_entry *p;
2453-
p = create_proc_entry("mb_history", S_IRUGO, sbi->s_mb_proc);
2454-
if (p) {
2455-
p->proc_fops = &ext4_mb_seq_history_fops;
2456-
p->data = sb;
2457-
}
2458-
p = create_proc_entry("mb_groups", S_IRUGO, sbi->s_mb_proc);
2459-
if (p) {
2460-
p->proc_fops = &ext4_mb_seq_groups_fops;
2461-
p->data = sb;
2462-
}
2452+
proc_create_data("mb_history", S_IRUGO, sbi->s_mb_proc,
2453+
&ext4_mb_seq_history_fops, sb);
2454+
proc_create_data("mb_groups", S_IRUGO, sbi->s_mb_proc,
2455+
&ext4_mb_seq_groups_fops, sb);
24632456
}
24642457

24652458
sbi->s_mb_history_max = 1000;

0 commit comments

Comments
 (0)