diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-10 14:26:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-10 14:26:52 -0400 |
commit | 5f248c9c251c60af3403902b26e08de43964ea0b (patch) | |
tree | 6d3328e72a7e4015a64017eb30be18095c6a3c64 /fs/proc | |
parent | f6cec0ae58c17522a7bc4e2f39dae19f199ab534 (diff) | |
parent | dca332528bc69e05f67161e1ed59929633d5e63d (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (96 commits)
no need for list_for_each_entry_safe()/resetting with superblock list
Fix sget() race with failing mount
vfs: don't hold s_umount over close_bdev_exclusive() call
sysv: do not mark superblock dirty on remount
sysv: do not mark superblock dirty on mount
btrfs: remove junk sb_dirt change
BFS: clean up the superblock usage
AFFS: wait for sb synchronization when needed
AFFS: clean up dirty flag usage
cifs: truncate fallout
mbcache: fix shrinker function return value
mbcache: Remove unused features
add f_flags to struct statfs(64)
pass a struct path to vfs_statfs
update VFS documentation for method changes.
All filesystems that need invalidate_inode_buffers() are doing that explicitly
convert remaining ->clear_inode() to ->evict_inode()
Make ->drop_inode() just return whether inode needs to be dropped
fs/inode.c:clear_inode() is gone
fs/inode.c:evict() doesn't care about delete vs. non-delete paths now
...
Fix up trivial conflicts in fs/nilfs2/super.c
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/base.c | 16 | ||||
-rw-r--r-- | fs/proc/generic.c | 18 | ||||
-rw-r--r-- | fs/proc/inode.c | 6 | ||||
-rw-r--r-- | fs/proc/proc_sysctl.c | 15 |
4 files changed, 40 insertions, 15 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 69254a365ce2..c806dfb24e08 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -559,9 +559,19 @@ static int proc_setattr(struct dentry *dentry, struct iattr *attr) | |||
559 | return -EPERM; | 559 | return -EPERM; |
560 | 560 | ||
561 | error = inode_change_ok(inode, attr); | 561 | error = inode_change_ok(inode, attr); |
562 | if (!error) | 562 | if (error) |
563 | error = inode_setattr(inode, attr); | 563 | return error; |
564 | return error; | 564 | |
565 | if ((attr->ia_valid & ATTR_SIZE) && | ||
566 | attr->ia_size != i_size_read(inode)) { | ||
567 | error = vmtruncate(inode, attr->ia_size); | ||
568 | if (error) | ||
569 | return error; | ||
570 | } | ||
571 | |||
572 | setattr_copy(inode, attr); | ||
573 | mark_inode_dirty(inode); | ||
574 | return 0; | ||
565 | } | 575 | } |
566 | 576 | ||
567 | static const struct inode_operations proc_def_inode_operations = { | 577 | static const struct inode_operations proc_def_inode_operations = { |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 2791907744ed..dd29f0337661 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/time.h> | 12 | #include <linux/time.h> |
13 | #include <linux/proc_fs.h> | 13 | #include <linux/proc_fs.h> |
14 | #include <linux/stat.h> | 14 | #include <linux/stat.h> |
15 | #include <linux/mm.h> | ||
15 | #include <linux/module.h> | 16 | #include <linux/module.h> |
16 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
17 | #include <linux/mount.h> | 18 | #include <linux/mount.h> |
@@ -258,17 +259,22 @@ static int proc_notify_change(struct dentry *dentry, struct iattr *iattr) | |||
258 | 259 | ||
259 | error = inode_change_ok(inode, iattr); | 260 | error = inode_change_ok(inode, iattr); |
260 | if (error) | 261 | if (error) |
261 | goto out; | 262 | return error; |
262 | 263 | ||
263 | error = inode_setattr(inode, iattr); | 264 | if ((iattr->ia_valid & ATTR_SIZE) && |
264 | if (error) | 265 | iattr->ia_size != i_size_read(inode)) { |
265 | goto out; | 266 | error = vmtruncate(inode, iattr->ia_size); |
267 | if (error) | ||
268 | return error; | ||
269 | } | ||
270 | |||
271 | setattr_copy(inode, iattr); | ||
272 | mark_inode_dirty(inode); | ||
266 | 273 | ||
267 | de->uid = inode->i_uid; | 274 | de->uid = inode->i_uid; |
268 | de->gid = inode->i_gid; | 275 | de->gid = inode->i_gid; |
269 | de->mode = inode->i_mode; | 276 | de->mode = inode->i_mode; |
270 | out: | 277 | return 0; |
271 | return error; | ||
272 | } | 278 | } |
273 | 279 | ||
274 | static int proc_getattr(struct vfsmount *mnt, struct dentry *dentry, | 280 | static int proc_getattr(struct vfsmount *mnt, struct dentry *dentry, |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index aea8502e58a3..23561cda7245 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -25,11 +25,12 @@ | |||
25 | 25 | ||
26 | #include "internal.h" | 26 | #include "internal.h" |
27 | 27 | ||
28 | static void proc_delete_inode(struct inode *inode) | 28 | static void proc_evict_inode(struct inode *inode) |
29 | { | 29 | { |
30 | struct proc_dir_entry *de; | 30 | struct proc_dir_entry *de; |
31 | 31 | ||
32 | truncate_inode_pages(&inode->i_data, 0); | 32 | truncate_inode_pages(&inode->i_data, 0); |
33 | end_writeback(inode); | ||
33 | 34 | ||
34 | /* Stop tracking associated processes */ | 35 | /* Stop tracking associated processes */ |
35 | put_pid(PROC_I(inode)->pid); | 36 | put_pid(PROC_I(inode)->pid); |
@@ -40,7 +41,6 @@ static void proc_delete_inode(struct inode *inode) | |||
40 | pde_put(de); | 41 | pde_put(de); |
41 | if (PROC_I(inode)->sysctl) | 42 | if (PROC_I(inode)->sysctl) |
42 | sysctl_head_put(PROC_I(inode)->sysctl); | 43 | sysctl_head_put(PROC_I(inode)->sysctl); |
43 | clear_inode(inode); | ||
44 | } | 44 | } |
45 | 45 | ||
46 | struct vfsmount *proc_mnt; | 46 | struct vfsmount *proc_mnt; |
@@ -91,7 +91,7 @@ static const struct super_operations proc_sops = { | |||
91 | .alloc_inode = proc_alloc_inode, | 91 | .alloc_inode = proc_alloc_inode, |
92 | .destroy_inode = proc_destroy_inode, | 92 | .destroy_inode = proc_destroy_inode, |
93 | .drop_inode = generic_delete_inode, | 93 | .drop_inode = generic_delete_inode, |
94 | .delete_inode = proc_delete_inode, | 94 | .evict_inode = proc_evict_inode, |
95 | .statfs = simple_statfs, | 95 | .statfs = simple_statfs, |
96 | }; | 96 | }; |
97 | 97 | ||
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 6ff9981f0a18..5be436ea088e 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c | |||
@@ -329,10 +329,19 @@ static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr) | |||
329 | return -EPERM; | 329 | return -EPERM; |
330 | 330 | ||
331 | error = inode_change_ok(inode, attr); | 331 | error = inode_change_ok(inode, attr); |
332 | if (!error) | 332 | if (error) |
333 | error = inode_setattr(inode, attr); | 333 | return error; |
334 | |||
335 | if ((attr->ia_valid & ATTR_SIZE) && | ||
336 | attr->ia_size != i_size_read(inode)) { | ||
337 | error = vmtruncate(inode, attr->ia_size); | ||
338 | if (error) | ||
339 | return error; | ||
340 | } | ||
334 | 341 | ||
335 | return error; | 342 | setattr_copy(inode, attr); |
343 | mark_inode_dirty(inode); | ||
344 | return 0; | ||
336 | } | 345 | } |
337 | 346 | ||
338 | static int proc_sys_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | 347 | static int proc_sys_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) |