VFS: make vfs_fstat() use f[get|put]_light()
commit e994defb7b upstream.
Use the *_light() versions that properly avoid doing the file user count
updates when they are unnecessary.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[xr: Backported to 3.4: adjust function name]
Signed-off-by: Rui Xiang <rui.xiang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
4652951d12
commit
9b67aeff92
@ -57,12 +57,13 @@ EXPORT_SYMBOL(vfs_getattr);
|
||||
|
||||
int vfs_fstat(unsigned int fd, struct kstat *stat)
|
||||
{
|
||||
struct file *f = fget_raw(fd);
|
||||
int fput_needed;
|
||||
struct file *f = fget_light(fd, &fput_needed);
|
||||
int error = -EBADF;
|
||||
|
||||
if (f) {
|
||||
error = vfs_getattr(f->f_path.mnt, f->f_path.dentry, stat);
|
||||
fput(f);
|
||||
fput_light(f, fput_needed);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user