diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-21 11:46:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-21 11:46:08 -0400 |
commit | 7e5cb5e151c5474b4a468f437f5038ba9f67ef4d (patch) | |
tree | 899f42e88f926fb4501402cf4ee4aa0903421ef5 /fs/stat.c | |
parent | 8c12fec90c54cfabdd57b2726a1defbc07c19a55 (diff) | |
parent | e994defb7b6813ba6fa7a2a36e86d2455ad1dc35 (diff) |
Merge branch 'vfs-cleanups' (random vfs cleanups)
This teaches vfs_fstat() to use the appropriate f[get|put]_light
functions, allowing it to avoid some unnecessary locking for the common
case.
More noticeably, it also cleans up and simplifies the "getname_flags()"
function, which now relies on the architecture strncpy_from_user() doing
all the user access checks properly, instead of hacking around the fact
that on x86 it didn't use to do it right (see commit 92ae03f2ef99: "x86:
merge 32/64-bit versions of 'strncpy_from_user()' and speed it up").
* vfs-cleanups:
VFS: make vfs_fstat() use f[get|put]_light()
VFS: clean up and simplify getname_flags()
x86: make word-at-a-time strncpy_from_user clear bytes at the end
Diffstat (limited to 'fs/stat.c')
-rw-r--r-- | fs/stat.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -57,12 +57,13 @@ EXPORT_SYMBOL(vfs_getattr); | |||
57 | 57 | ||
58 | int vfs_fstat(unsigned int fd, struct kstat *stat) | 58 | int vfs_fstat(unsigned int fd, struct kstat *stat) |
59 | { | 59 | { |
60 | struct file *f = fget(fd); | 60 | int fput_needed; |
61 | struct file *f = fget_light(fd, &fput_needed); | ||
61 | int error = -EBADF; | 62 | int error = -EBADF; |
62 | 63 | ||
63 | if (f) { | 64 | if (f) { |
64 | error = vfs_getattr(f->f_path.mnt, f->f_path.dentry, stat); | 65 | error = vfs_getattr(f->f_path.mnt, f->f_path.dentry, stat); |
65 | fput(f); | 66 | fput_light(f, fput_needed); |
66 | } | 67 | } |
67 | return error; | 68 | return error; |
68 | } | 69 | } |