]>
Commit | Line | Data |
---|---|---|
cc67517a GKH |
1 | From david@fromorbit.com Fri Apr 2 11:06:34 2010 |
2 | From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> | |
3 | Date: Fri, 12 Mar 2010 09:42:03 +1100 | |
4 | Subject: xfs: Fix error return for fallocate() on XFS | |
5 | To: stable@kernel.org | |
6 | Cc: xfs@oss.sgi.com | |
7 | Message-ID: <1268347337-7160-6-git-send-email-david@fromorbit.com> | |
8 | ||
9 | ||
10 | From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> | |
11 | ||
12 | commit 44a743f68705c681439f264deb05f8f38e9048d3 upstream | |
13 | ||
14 | Noticed that through glibc fallocate would return 28 rather than -1 | |
15 | and errno = 28 for ENOSPC. The xfs routines uses XFS_ERROR format | |
16 | positive return error codes while the syscalls use negative return | |
17 | codes. Fixup the two cases in xfs_vn_fallocate syscall to convert to | |
18 | negative. | |
19 | ||
20 | Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> | |
21 | Reviewed-by: Eric Sandeen <sandeen@sandeen.net> | |
22 | Signed-off-by: Alex Elder <aelder@sgi.com> | |
23 | Signed-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); |