]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.32.12/xfs-fix-error-return-for-fallocate-on-xfs.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.12 / xfs-fix-error-return-for-fallocate-on-xfs.patch
CommitLineData
cc67517a
GKH
1From david@fromorbit.com Fri Apr 2 11:06:34 2010
2From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
3Date: Fri, 12 Mar 2010 09:42:03 +1100
4Subject: xfs: Fix error return for fallocate() on XFS
5To: stable@kernel.org
6Cc: xfs@oss.sgi.com
7Message-ID: <1268347337-7160-6-git-send-email-david@fromorbit.com>
8
9
10From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
11
12commit 44a743f68705c681439f264deb05f8f38e9048d3 upstream
13
14Noticed that through glibc fallocate would return 28 rather than -1
15and errno = 28 for ENOSPC. The xfs routines uses XFS_ERROR format
16positive return error codes while the syscalls use negative return
17codes. Fixup the two cases in xfs_vn_fallocate syscall to convert to
18negative.
19
20Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
21Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
22Signed-off-by: Alex Elder <aelder@sgi.com>
23Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
24---
25 fs/xfs/linux-2.6/xfs_iops.c | 6 +++---
26 1 file changed, 3 insertions(+), 3 deletions(-)
27
28--- a/fs/xfs/linux-2.6/xfs_iops.c
29+++ b/fs/xfs/linux-2.6/xfs_iops.c
30@@ -573,8 +573,8 @@ xfs_vn_fallocate(
31 bf.l_len = len;
32
33 xfs_ilock(ip, XFS_IOLOCK_EXCL);
34- error = xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf,
35- 0, XFS_ATTR_NOLOCK);
36+ error = -xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf,
37+ 0, XFS_ATTR_NOLOCK);
38 if (!error && !(mode & FALLOC_FL_KEEP_SIZE) &&
39 offset + len > i_size_read(inode))
40 new_size = offset + len;
41@@ -585,7 +585,7 @@ xfs_vn_fallocate(
42
43 iattr.ia_valid = ATTR_SIZE;
44 iattr.ia_size = new_size;
45- error = xfs_setattr(ip, &iattr, XFS_ATTR_NOLOCK);
46+ error = -xfs_setattr(ip, &iattr, XFS_ATTR_NOLOCK);
47 }
48
49 xfs_iunlock(ip, XFS_IOLOCK_EXCL);