aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-04-05 18:30:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-04-05 18:30:34 -0400
commit5d32c88f0b94061b3af2e3ade92422407282eb12 (patch)
tree2e1f81aa47b2cf59625c8fba17199617e33802e6 /fs
parent43f63c8711ce02226b7bbdafeba7b8031faf3fb4 (diff)
parentdac23b0d0513916498d40412818bd2c581b365f7 (diff)
Merge branch 'akpm' (Andrew's patch-bomb)
Merge batch of fixes from Andrew Morton: "The simple_open() cleanup was held back while I wanted for laggards to merge things. I still need to send a few checkpoint/restore patches. I've been wobbly about merging them because I'm wobbly about the overall prospects for success of the project. But after speaking with Pavel at the LSF conference, it sounds like they're further toward completion than I feared - apparently davem is at the "has stopped complaining" stage regarding the net changes. So I need to go back and re-review those patchs and their (lengthy) discussion." * emailed from Andrew Morton <akpm@linux-foundation.org>: (16 patches) memcg swap: use mem_cgroup_uncharge_swap fix backlight: add driver for DA9052/53 PMIC v1 C6X: use set_current_blocked() and block_sigmask() MAINTAINERS: add entry for sparse checker MAINTAINERS: fix REMOTEPROC F: typo alpha: use set_current_blocked() and block_sigmask() simple_open: automatically convert to simple_open() scripts/coccinelle/api/simple_open.cocci: semantic patch for simple_open() libfs: add simple_open() hugetlbfs: remove unregister_filesystem() when initializing module drivers/rtc/rtc-88pm860x.c: fix rtc irq enable callback fs/xattr.c:setxattr(): improve handling of allocation failures fs/xattr.c:listxattr(): fall back to vmalloc() if kmalloc() failed fs/xattr.c: suppress page allocation failure warnings from sys_listxattr() sysrq: use SEND_SIG_FORCED instead of force_sig() proc: fix mount -t proc -o AAA
Diffstat (limited to 'fs')
-rw-r--r--fs/debugfs/file.c14
-rw-r--r--fs/dlm/debug_fs.c9
-rw-r--r--fs/hugetlbfs/inode.c1
-rw-r--r--fs/libfs.c8
-rw-r--r--fs/proc/root.c9
-rw-r--r--fs/pstore/inode.c8
-rw-r--r--fs/xattr.c40
7 files changed, 49 insertions, 40 deletions
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 21e93605161c..5dfafdd1dbd3 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -33,18 +33,10 @@ static ssize_t default_write_file(struct file *file, const char __user *buf,
33 return count; 33 return count;
34} 34}
35 35
36static int default_open(struct inode *inode, struct file *file)
37{
38 if (inode->i_private)
39 file->private_data = inode->i_private;
40
41 return 0;
42}
43
44const struct file_operations debugfs_file_operations = { 36const struct file_operations debugfs_file_operations = {
45 .read = default_read_file, 37 .read = default_read_file,
46 .write = default_write_file, 38 .write = default_write_file,
47 .open = default_open, 39 .open = simple_open,
48 .llseek = noop_llseek, 40 .llseek = noop_llseek,
49}; 41};
50 42
@@ -447,7 +439,7 @@ static ssize_t write_file_bool(struct file *file, const char __user *user_buf,
447static const struct file_operations fops_bool = { 439static const struct file_operations fops_bool = {
448 .read = read_file_bool, 440 .read = read_file_bool,
449 .write = write_file_bool, 441 .write = write_file_bool,
450 .open = default_open, 442 .open = simple_open,
451 .llseek = default_llseek, 443 .llseek = default_llseek,
452}; 444};
453 445
@@ -492,7 +484,7 @@ static ssize_t read_file_blob(struct file *file, char __user *user_buf,
492 484
493static const struct file_operations fops_blob = { 485static const struct file_operations fops_blob = {
494 .read = read_file_blob, 486 .read = read_file_blob,
495 .open = default_open, 487 .open = simple_open,
496 .llseek = default_llseek, 488 .llseek = default_llseek,
497}; 489};
498 490
diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c
index 3dca2b39e83f..1c9b08095f98 100644
--- a/fs/dlm/debug_fs.c
+++ b/fs/dlm/debug_fs.c
@@ -609,13 +609,6 @@ static const struct file_operations format3_fops = {
609/* 609/*
610 * dump lkb's on the ls_waiters list 610 * dump lkb's on the ls_waiters list
611 */ 611 */
612
613static int waiters_open(struct inode *inode, struct file *file)
614{
615 file->private_data = inode->i_private;
616 return 0;
617}
618
619static ssize_t waiters_read(struct file *file, char __user *userbuf, 612static ssize_t waiters_read(struct file *file, char __user *userbuf,
620 size_t count, loff_t *ppos) 613 size_t count, loff_t *ppos)
621{ 614{
@@ -644,7 +637,7 @@ static ssize_t waiters_read(struct file *file, char __user *userbuf,
644 637
645static const struct file_operations waiters_fops = { 638static const struct file_operations waiters_fops = {
646 .owner = THIS_MODULE, 639 .owner = THIS_MODULE,
647 .open = waiters_open, 640 .open = simple_open,
648 .read = waiters_read, 641 .read = waiters_read,
649 .llseek = default_llseek, 642 .llseek = default_llseek,
650}; 643};
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index ea251749d9d5..28cf06e4ec84 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -1031,7 +1031,6 @@ static int __init init_hugetlbfs_fs(void)
1031 } 1031 }
1032 1032
1033 error = PTR_ERR(vfsmount); 1033 error = PTR_ERR(vfsmount);
1034 unregister_filesystem(&hugetlbfs_fs_type);
1035 1034
1036 out: 1035 out:
1037 kmem_cache_destroy(hugetlbfs_inode_cachep); 1036 kmem_cache_destroy(hugetlbfs_inode_cachep);
diff --git a/fs/libfs.c b/fs/libfs.c
index 4a0d1f06da57..358094f0433d 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -264,6 +264,13 @@ Enomem:
264 return ERR_PTR(-ENOMEM); 264 return ERR_PTR(-ENOMEM);
265} 265}
266 266
267int simple_open(struct inode *inode, struct file *file)
268{
269 if (inode->i_private)
270 file->private_data = inode->i_private;
271 return 0;
272}
273
267int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) 274int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
268{ 275{
269 struct inode *inode = old_dentry->d_inode; 276 struct inode *inode = old_dentry->d_inode;
@@ -984,6 +991,7 @@ EXPORT_SYMBOL(simple_dir_operations);
984EXPORT_SYMBOL(simple_empty); 991EXPORT_SYMBOL(simple_empty);
985EXPORT_SYMBOL(simple_fill_super); 992EXPORT_SYMBOL(simple_fill_super);
986EXPORT_SYMBOL(simple_getattr); 993EXPORT_SYMBOL(simple_getattr);
994EXPORT_SYMBOL(simple_open);
987EXPORT_SYMBOL(simple_link); 995EXPORT_SYMBOL(simple_link);
988EXPORT_SYMBOL(simple_lookup); 996EXPORT_SYMBOL(simple_lookup);
989EXPORT_SYMBOL(simple_pin_fs); 997EXPORT_SYMBOL(simple_pin_fs);
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 46a15d8a29ca..eed44bfc85db 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -115,12 +115,13 @@ static struct dentry *proc_mount(struct file_system_type *fs_type,
115 if (IS_ERR(sb)) 115 if (IS_ERR(sb))
116 return ERR_CAST(sb); 116 return ERR_CAST(sb);
117 117
118 if (!proc_parse_options(options, ns)) {
119 deactivate_locked_super(sb);
120 return ERR_PTR(-EINVAL);
121 }
122
118 if (!sb->s_root) { 123 if (!sb->s_root) {
119 sb->s_flags = flags; 124 sb->s_flags = flags;
120 if (!proc_parse_options(options, ns)) {
121 deactivate_locked_super(sb);
122 return ERR_PTR(-EINVAL);
123 }
124 err = proc_fill_super(sb); 125 err = proc_fill_super(sb);
125 if (err) { 126 if (err) {
126 deactivate_locked_super(sb); 127 deactivate_locked_super(sb);
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index 50952c9bd06c..19507889bb7f 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -52,12 +52,6 @@ struct pstore_private {
52 char data[]; 52 char data[];
53}; 53};
54 54
55static int pstore_file_open(struct inode *inode, struct file *file)
56{
57 file->private_data = inode->i_private;
58 return 0;
59}
60
61static ssize_t pstore_file_read(struct file *file, char __user *userbuf, 55static ssize_t pstore_file_read(struct file *file, char __user *userbuf,
62 size_t count, loff_t *ppos) 56 size_t count, loff_t *ppos)
63{ 57{
@@ -67,7 +61,7 @@ static ssize_t pstore_file_read(struct file *file, char __user *userbuf,
67} 61}
68 62
69static const struct file_operations pstore_file_operations = { 63static const struct file_operations pstore_file_operations = {
70 .open = pstore_file_open, 64 .open = simple_open,
71 .read = pstore_file_read, 65 .read = pstore_file_read,
72 .llseek = default_llseek, 66 .llseek = default_llseek,
73}; 67};
diff --git a/fs/xattr.c b/fs/xattr.c
index d6dfd247bb2f..3c8c1cc333c7 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -19,8 +19,9 @@
19#include <linux/export.h> 19#include <linux/export.h>
20#include <linux/fsnotify.h> 20#include <linux/fsnotify.h>
21#include <linux/audit.h> 21#include <linux/audit.h>
22#include <asm/uaccess.h> 22#include <linux/vmalloc.h>
23 23
24#include <asm/uaccess.h>
24 25
25/* 26/*
26 * Check permissions for extended attribute access. This is a bit complicated 27 * Check permissions for extended attribute access. This is a bit complicated
@@ -320,6 +321,7 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value,
320{ 321{
321 int error; 322 int error;
322 void *kvalue = NULL; 323 void *kvalue = NULL;
324 void *vvalue = NULL; /* If non-NULL, we used vmalloc() */
323 char kname[XATTR_NAME_MAX + 1]; 325 char kname[XATTR_NAME_MAX + 1];
324 326
325 if (flags & ~(XATTR_CREATE|XATTR_REPLACE)) 327 if (flags & ~(XATTR_CREATE|XATTR_REPLACE))
@@ -334,13 +336,25 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value,
334 if (size) { 336 if (size) {
335 if (size > XATTR_SIZE_MAX) 337 if (size > XATTR_SIZE_MAX)
336 return -E2BIG; 338 return -E2BIG;
337 kvalue = memdup_user(value, size); 339 kvalue = kmalloc(size, GFP_KERNEL | __GFP_NOWARN);
338 if (IS_ERR(kvalue)) 340 if (!kvalue) {
339 return PTR_ERR(kvalue); 341 vvalue = vmalloc(size);
342 if (!vvalue)
343 return -ENOMEM;
344 kvalue = vvalue;
345 }
346 if (copy_from_user(kvalue, value, size)) {
347 error = -EFAULT;
348 goto out;
349 }
340 } 350 }
341 351
342 error = vfs_setxattr(d, kname, kvalue, size, flags); 352 error = vfs_setxattr(d, kname, kvalue, size, flags);
343 kfree(kvalue); 353out:
354 if (vvalue)
355 vfree(vvalue);
356 else
357 kfree(kvalue);
344 return error; 358 return error;
345} 359}
346 360
@@ -492,13 +506,18 @@ listxattr(struct dentry *d, char __user *list, size_t size)
492{ 506{
493 ssize_t error; 507 ssize_t error;
494 char *klist = NULL; 508 char *klist = NULL;
509 char *vlist = NULL; /* If non-NULL, we used vmalloc() */
495 510
496 if (size) { 511 if (size) {
497 if (size > XATTR_LIST_MAX) 512 if (size > XATTR_LIST_MAX)
498 size = XATTR_LIST_MAX; 513 size = XATTR_LIST_MAX;
499 klist = kmalloc(size, GFP_KERNEL); 514 klist = kmalloc(size, __GFP_NOWARN | GFP_KERNEL);
500 if (!klist) 515 if (!klist) {
501 return -ENOMEM; 516 vlist = vmalloc(size);
517 if (!vlist)
518 return -ENOMEM;
519 klist = vlist;
520 }
502 } 521 }
503 522
504 error = vfs_listxattr(d, klist, size); 523 error = vfs_listxattr(d, klist, size);
@@ -510,7 +529,10 @@ listxattr(struct dentry *d, char __user *list, size_t size)
510 than XATTR_LIST_MAX bytes. Not possible. */ 529 than XATTR_LIST_MAX bytes. Not possible. */
511 error = -E2BIG; 530 error = -E2BIG;
512 } 531 }
513 kfree(klist); 532 if (vlist)
533 vfree(vlist);
534 else
535 kfree(klist);
514 return error; 536 return error;
515} 537}
516 538