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 e994def 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>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
  • Loading branch information
Linus Torvalds authored and Ben Hutchings committed Sep 19, 2012
1 parent 62ae7bb commit 7c6430b
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(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 7c6430b

Please sign in to comment.