diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-17 17:56:45 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-17 17:56:45 -0500 |
commit | 50652963eae6afe13678dc84d789a174306a4df7 (patch) | |
tree | 44d6bc6c2cd938cf59db7ba2b7e514d9b3665f40 /fs/proc/generic.c | |
parent | e2b74f232e84dfccd0047eb47545b1d028df8ff1 (diff) | |
parent | 87b95ce0964c016ede92763be9c164e49f1019e9 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc VFS updates from Al Viro:
"This cycle a lot of stuff sits on topical branches, so I'll be sending
more or less one pull request per branch.
This is the first pile; more to follow in a few. In this one are
several misc commits from early in the cycle (before I went for
separate branches), plus the rework of mntput/dput ordering on umount,
switching to use of fs_pin instead of convoluted games in
namespace_unlock()"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
switch the IO-triggering parts of umount to fs_pin
new fs_pin killing logics
allow attaching fs_pin to a group not associated with some superblock
get rid of the second argument of acct_kill()
take count and rcu_head out of fs_pin
dcache: let the dentry count go down to zero without taking d_lock
pull bumping refcount into ->kill()
kill pin_put()
mode_t whack-a-mole: chelsio
file->f_path.dentry is pinned down for as long as the file is open...
get rid of lustre_dump_dentry()
gut proc_register() a bit
kill d_validate()
ncpfs: get rid of d_validate() nonsense
selinuxfs: don't open-code d_genocide()
Diffstat (limited to 'fs/proc/generic.c')
-rw-r--r-- | fs/proc/generic.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index de14e46fd807..3309f59d421b 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -350,29 +350,12 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp | |||
350 | if (ret) | 350 | if (ret) |
351 | return ret; | 351 | return ret; |
352 | 352 | ||
353 | if (S_ISDIR(dp->mode)) { | ||
354 | dp->proc_fops = &proc_dir_operations; | ||
355 | dp->proc_iops = &proc_dir_inode_operations; | ||
356 | dir->nlink++; | ||
357 | } else if (S_ISLNK(dp->mode)) { | ||
358 | dp->proc_iops = &proc_link_inode_operations; | ||
359 | } else if (S_ISREG(dp->mode)) { | ||
360 | BUG_ON(dp->proc_fops == NULL); | ||
361 | dp->proc_iops = &proc_file_inode_operations; | ||
362 | } else { | ||
363 | WARN_ON(1); | ||
364 | proc_free_inum(dp->low_ino); | ||
365 | return -EINVAL; | ||
366 | } | ||
367 | |||
368 | spin_lock(&proc_subdir_lock); | 353 | spin_lock(&proc_subdir_lock); |
369 | dp->parent = dir; | 354 | dp->parent = dir; |
370 | if (pde_subdir_insert(dir, dp) == false) { | 355 | if (pde_subdir_insert(dir, dp) == false) { |
371 | WARN(1, "proc_dir_entry '%s/%s' already registered\n", | 356 | WARN(1, "proc_dir_entry '%s/%s' already registered\n", |
372 | dir->name, dp->name); | 357 | dir->name, dp->name); |
373 | spin_unlock(&proc_subdir_lock); | 358 | spin_unlock(&proc_subdir_lock); |
374 | if (S_ISDIR(dp->mode)) | ||
375 | dir->nlink--; | ||
376 | proc_free_inum(dp->low_ino); | 359 | proc_free_inum(dp->low_ino); |
377 | return -EEXIST; | 360 | return -EEXIST; |
378 | } | 361 | } |
@@ -431,6 +414,7 @@ struct proc_dir_entry *proc_symlink(const char *name, | |||
431 | ent->data = kmalloc((ent->size=strlen(dest))+1, GFP_KERNEL); | 414 | ent->data = kmalloc((ent->size=strlen(dest))+1, GFP_KERNEL); |
432 | if (ent->data) { | 415 | if (ent->data) { |
433 | strcpy((char*)ent->data,dest); | 416 | strcpy((char*)ent->data,dest); |
417 | ent->proc_iops = &proc_link_inode_operations; | ||
434 | if (proc_register(parent, ent) < 0) { | 418 | if (proc_register(parent, ent) < 0) { |
435 | kfree(ent->data); | 419 | kfree(ent->data); |
436 | kfree(ent); | 420 | kfree(ent); |
@@ -456,8 +440,12 @@ struct proc_dir_entry *proc_mkdir_data(const char *name, umode_t mode, | |||
456 | ent = __proc_create(&parent, name, S_IFDIR | mode, 2); | 440 | ent = __proc_create(&parent, name, S_IFDIR | mode, 2); |
457 | if (ent) { | 441 | if (ent) { |
458 | ent->data = data; | 442 | ent->data = data; |
443 | ent->proc_fops = &proc_dir_operations; | ||
444 | ent->proc_iops = &proc_dir_inode_operations; | ||
445 | parent->nlink++; | ||
459 | if (proc_register(parent, ent) < 0) { | 446 | if (proc_register(parent, ent) < 0) { |
460 | kfree(ent); | 447 | kfree(ent); |
448 | parent->nlink--; | ||
461 | ent = NULL; | 449 | ent = NULL; |
462 | } | 450 | } |
463 | } | 451 | } |
@@ -493,6 +481,8 @@ struct proc_dir_entry *proc_create_data(const char *name, umode_t mode, | |||
493 | return NULL; | 481 | return NULL; |
494 | } | 482 | } |
495 | 483 | ||
484 | BUG_ON(proc_fops == NULL); | ||
485 | |||
496 | if ((mode & S_IALLUGO) == 0) | 486 | if ((mode & S_IALLUGO) == 0) |
497 | mode |= S_IRUGO; | 487 | mode |= S_IRUGO; |
498 | pde = __proc_create(&parent, name, mode, 1); | 488 | pde = __proc_create(&parent, name, mode, 1); |
@@ -500,6 +490,7 @@ struct proc_dir_entry *proc_create_data(const char *name, umode_t mode, | |||
500 | goto out; | 490 | goto out; |
501 | pde->proc_fops = proc_fops; | 491 | pde->proc_fops = proc_fops; |
502 | pde->data = data; | 492 | pde->data = data; |
493 | pde->proc_iops = &proc_file_inode_operations; | ||
503 | if (proc_register(parent, pde) < 0) | 494 | if (proc_register(parent, pde) < 0) |
504 | goto out_free; | 495 | goto out_free; |
505 | return pde; | 496 | return pde; |