Skip to content

Commit

Permalink
xfs: Fix error return for fallocate() on XFS
Browse files Browse the repository at this point in the history
Noticed that through glibc fallocate would return 28 rather than -1
and errno = 28 for ENOSPC. The xfs routines uses XFS_ERROR format
positive return error codes while the syscalls use negative return
codes.  Fixup the two cases in xfs_vn_fallocate syscall to convert to
negative.

Signed-off-by: Jason Gunthorpe <[email protected]>
Reviewed-by: Eric Sandeen <[email protected]>
Signed-off-by: Alex Elder <[email protected]>
  • Loading branch information
jgunthorpe authored and Alex Elder committed Dec 11, 2009
1 parent 30ac068 commit 44a743f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/xfs/linux-2.6/xfs_iops.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,8 @@ xfs_vn_fallocate(
bf.l_len = len;

xfs_ilock(ip, XFS_IOLOCK_EXCL);
error = xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf,
0, XFS_ATTR_NOLOCK);
error = -xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf,
0, XFS_ATTR_NOLOCK);
if (!error && !(mode & FALLOC_FL_KEEP_SIZE) &&
offset + len > i_size_read(inode))
new_size = offset + len;
Expand All @@ -585,7 +585,7 @@ xfs_vn_fallocate(

iattr.ia_valid = ATTR_SIZE;
iattr.ia_size = new_size;
error = xfs_setattr(ip, &iattr, XFS_ATTR_NOLOCK);
error = -xfs_setattr(ip, &iattr, XFS_ATTR_NOLOCK);
}

xfs_iunlock(ip, XFS_IOLOCK_EXCL);
Expand Down

0 comments on commit 44a743f

Please sign in to comment.