diff options
Diffstat (limited to 'fs/proc/generic.c')
-rw-r--r-- | fs/proc/generic.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 43c127490606..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, |
@@ -343,21 +349,6 @@ static DEFINE_SPINLOCK(proc_inum_lock); /* protects the above */ | |||
343 | /* | 349 | /* |
344 | * Return an inode number between PROC_DYNAMIC_FIRST and | 350 | * Return an inode number between PROC_DYNAMIC_FIRST and |
345 | * 0xffffffff, or zero on failure. | 351 | * 0xffffffff, or zero on failure. |
346 | * | ||
347 | * Current inode allocations in the proc-fs (hex-numbers): | ||
348 | * | ||
349 | * 00000000 reserved | ||
350 | * 00000001-00000fff static entries (goners) | ||
351 | * 001 root-ino | ||
352 | * | ||
353 | * 00001000-00001fff unused | ||
354 | * 0001xxxx-7fffxxxx pid-dir entries for pid 1-7fff | ||
355 | * 80000000-efffffff unused | ||
356 | * f0000000-ffffffff dynamic entries | ||
357 | * | ||
358 | * Goal: | ||
359 | * Once we split the thing into several virtual filesystems, | ||
360 | * we will get rid of magical ranges (and this comment, BTW). | ||
361 | */ | 352 | */ |
362 | static unsigned int get_inode_number(void) | 353 | static unsigned int get_inode_number(void) |
363 | { | 354 | { |