switch ftruncate(2) to fget_light
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 27 Aug 2012 00:13:36 +0000 (20:13 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 27 Sep 2012 01:10:02 +0000 (21:10 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/open.c

index 03028d0e74873e4ac2dca61dac0263f4df348e89..9f61d7269d39ff6e5bf67450aea4940405ef0aad 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -132,16 +132,16 @@ SYSCALL_DEFINE2(truncate, const char __user *, path, long, length)
 
 static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
 {
-       struct inode * inode;
+       struct inode *inode;
        struct dentry *dentry;
-       struct file * file;
-       int error;
+       struct file *file;
+       int error, fput_needed;
 
        error = -EINVAL;
        if (length < 0)
                goto out;
        error = -EBADF;
-       file = fget(fd);
+       file = fget_light(fd, &fput_needed);
        if (!file)
                goto out;
 
@@ -172,7 +172,7 @@ static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
                error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file);
        sb_end_write(inode->i_sb);
 out_putf:
-       fput(file);
+       fput_light(file, fput_needed);
 out:
        return error;
 }