Fix error return for fallocate() on XFS
PATCH 1/1 Fix error return for fallocate() on XFS
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.
--- fs/xfs/linux-2.6/xfs_iops.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
fs/xfs/linux-2.6/xfs_iops.c +3 -3
@@ -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;
@@ -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 );
Signature · 6 lines
1.5.4.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 4 lines · Jason Gunthorpe
Noticed that through glibc fallocate would return 28 rather than -1 and errno = 28 for ENOSPC. The xfs routines uses
XFS_ERRORformat positive return error codes while the syscalls use negative return codes. Fixup the two cases inxfs_vn_fallocatesyscall to convert to negative.
grumblegrumble xfs error signs grumble...
Quoted 1 line
Signed-off-by Jason Gunthorpe <[email protected]>
Thanks,
Quoted 20 lines
--- fs/xfs/linux-2.6/xfs_iops.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)fs/xfs/linux-2.6/xfs_iops.c +2
-2@@ -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;
fs/xfs/linux-2.6/xfs_iops.c xfs_vn_fallocate( · line 591
Quoted 8 lines
fs/xfs/linux-2.6/xfs_iops.c +1
-1@@ -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 );
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs