Skip to content

Commit

Permalink
VFS: make vfs_fstat() use f[get|put]_light()
Browse files Browse the repository at this point in the history
commit e994defb7b6813ba6fa7a2a36e86d2455ad1dc35 upstream.

Use the *_light() versions that properly avoid doing the file user count
updates when they are unnecessary.

Signed-off-by: Linus Torvalds <[email protected]>
[xr: Backported to 3.4: adjust function name]
Signed-off-by: Rui Xiang <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
torvalds authored and arnaullv committed Oct 27, 2017
1 parent 2ffd416 commit dde8633
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit dde8633

Please sign in to comment.