[XFS] remove permission check from xfs_change_file_space
authorChristoph Hellwig <hch@infradead.org>
Tue, 5 Feb 2008 01:12:58 +0000 (12:12 +1100)
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>
Thu, 7 Feb 2008 07:21:14 +0000 (18:21 +1100)
Both callers of xfs_change_file_space alreaedy do the file->f_mode &
FMODE_WRITE check to ensure we have a file descriptor that has been opened
for write mode, so there is no need to re-check that with xfs_iaccess.
Especially as the later might wrongly deny it for corner cases like file
descriptor passing through unix domain sockets.

SGI-PV: 971186
SGI-Modid: xfs-linux-melb:xfs-kern:30365a

Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
fs/xfs/xfs_vnodeops.c

index 6b71d9f763c79014acb3956269be095cc14a2e62..076555e8763f52188b3262d8667cf72bb5c5fde1 100644 (file)
@@ -4317,21 +4317,9 @@ xfs_change_file_space(
 
        xfs_itrace_entry(ip);
 
-       /*
-        * must be a regular file and have write permission
-        */
        if (!S_ISREG(ip->i_d.di_mode))
                return XFS_ERROR(EINVAL);
 
-       xfs_ilock(ip, XFS_ILOCK_SHARED);
-
-       if ((error = xfs_iaccess(ip, S_IWUSR, credp))) {
-               xfs_iunlock(ip, XFS_ILOCK_SHARED);
-               return error;
-       }
-
-       xfs_iunlock(ip, XFS_ILOCK_SHARED);
-
        switch (bf->l_whence) {
        case 0: /*SEEK_SET*/
                break;