Commit 5e9d9fc4 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'xfs-for-linus-3.15-rc6' of git://oss.sgi.com/xfs/xfs

Pull xfs fixes from Dave Chinner:
 "Code inspection of the XFS error number sign translations found a
  bunch of issues, including returning incorrectly signed errors for
  some data integrity operations.

  These leak to userspace and result in applications not getting the
  errors correctly reported.  Hence they need fixing sooner rather than
  later.

  A couple of the bugs are in data integrity operations, a couple more
  are in the new COLLAPSE_RANGE code.  One of these came in through a
  recent ext4 merge and so I had to update the base tree to 3.15-rc5
  before fixing the issues"

* tag 'xfs-for-linus-3.15-rc6' of git://oss.sgi.com/xfs/xfs:
  xfs: list_lru_init returns a negative error
  xfs: negate xfs_icsb_init_counters error value
  xfs: negate mount workqueue init error value
  xfs: fix wrong err sign on xfs_set_acl()
  xfs: fix wrong errno from xfs_initxattrs
  xfs: correct error sign on COLLAPSE_RANGE errors
  xfs: xfs_commit_metadata returns wrong errno
  xfs: fix incorrect error sign in xfs_file_aio_read
  xfs: xfs_dir_fsync() returns positive errno
parents 80932ec1 ee4eec47
...@@ -237,7 +237,7 @@ xfs_fs_nfs_commit_metadata( ...@@ -237,7 +237,7 @@ xfs_fs_nfs_commit_metadata(
if (!lsn) if (!lsn)
return 0; return 0;
return _xfs_log_force_lsn(mp, lsn, XFS_LOG_SYNC, NULL); return -_xfs_log_force_lsn(mp, lsn, XFS_LOG_SYNC, NULL);
} }
const struct export_operations xfs_export_operations = { const struct export_operations xfs_export_operations = {
......
...@@ -155,7 +155,7 @@ xfs_dir_fsync( ...@@ -155,7 +155,7 @@ xfs_dir_fsync(
if (!lsn) if (!lsn)
return 0; return 0;
return _xfs_log_force_lsn(mp, lsn, XFS_LOG_SYNC, NULL); return -_xfs_log_force_lsn(mp, lsn, XFS_LOG_SYNC, NULL);
} }
STATIC int STATIC int
...@@ -295,7 +295,7 @@ xfs_file_aio_read( ...@@ -295,7 +295,7 @@ xfs_file_aio_read(
xfs_rw_ilock(ip, XFS_IOLOCK_EXCL); xfs_rw_ilock(ip, XFS_IOLOCK_EXCL);
if (inode->i_mapping->nrpages) { if (inode->i_mapping->nrpages) {
ret = -filemap_write_and_wait_range( ret = filemap_write_and_wait_range(
VFS_I(ip)->i_mapping, VFS_I(ip)->i_mapping,
pos, -1); pos, -1);
if (ret) { if (ret) {
...@@ -837,7 +837,7 @@ xfs_file_fallocate( ...@@ -837,7 +837,7 @@ xfs_file_fallocate(
unsigned blksize_mask = (1 << inode->i_blkbits) - 1; unsigned blksize_mask = (1 << inode->i_blkbits) - 1;
if (offset & blksize_mask || len & blksize_mask) { if (offset & blksize_mask || len & blksize_mask) {
error = -EINVAL; error = EINVAL;
goto out_unlock; goto out_unlock;
} }
...@@ -846,7 +846,7 @@ xfs_file_fallocate( ...@@ -846,7 +846,7 @@ xfs_file_fallocate(
* in which case it is effectively a truncate operation * in which case it is effectively a truncate operation
*/ */
if (offset + len >= i_size_read(inode)) { if (offset + len >= i_size_read(inode)) {
error = -EINVAL; error = EINVAL;
goto out_unlock; goto out_unlock;
} }
......
...@@ -72,7 +72,7 @@ xfs_initxattrs( ...@@ -72,7 +72,7 @@ xfs_initxattrs(
int error = 0; int error = 0;
for (xattr = xattr_array; xattr->name != NULL; xattr++) { for (xattr = xattr_array; xattr->name != NULL; xattr++) {
error = xfs_attr_set(ip, xattr->name, xattr->value, error = -xfs_attr_set(ip, xattr->name, xattr->value,
xattr->value_len, ATTR_SECURE); xattr->value_len, ATTR_SECURE);
if (error < 0) if (error < 0)
break; break;
...@@ -93,7 +93,7 @@ xfs_init_security( ...@@ -93,7 +93,7 @@ xfs_init_security(
struct inode *dir, struct inode *dir,
const struct qstr *qstr) const struct qstr *qstr)
{ {
return security_inode_init_security(inode, dir, qstr, return -security_inode_init_security(inode, dir, qstr,
&xfs_initxattrs, NULL); &xfs_initxattrs, NULL);
} }
...@@ -173,12 +173,12 @@ xfs_generic_create( ...@@ -173,12 +173,12 @@ xfs_generic_create(
#ifdef CONFIG_XFS_POSIX_ACL #ifdef CONFIG_XFS_POSIX_ACL
if (default_acl) { if (default_acl) {
error = xfs_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); error = -xfs_set_acl(inode, default_acl, ACL_TYPE_DEFAULT);
if (error) if (error)
goto out_cleanup_inode; goto out_cleanup_inode;
} }
if (acl) { if (acl) {
error = xfs_set_acl(inode, acl, ACL_TYPE_ACCESS); error = -xfs_set_acl(inode, acl, ACL_TYPE_ACCESS);
if (error) if (error)
goto out_cleanup_inode; goto out_cleanup_inode;
} }
......
...@@ -843,22 +843,17 @@ xfs_qm_init_quotainfo( ...@@ -843,22 +843,17 @@ xfs_qm_init_quotainfo(
qinf = mp->m_quotainfo = kmem_zalloc(sizeof(xfs_quotainfo_t), KM_SLEEP); qinf = mp->m_quotainfo = kmem_zalloc(sizeof(xfs_quotainfo_t), KM_SLEEP);
if ((error = list_lru_init(&qinf->qi_lru))) { error = -list_lru_init(&qinf->qi_lru);
kmem_free(qinf); if (error)
mp->m_quotainfo = NULL; goto out_free_qinf;
return error;
}
/* /*
* See if quotainodes are setup, and if not, allocate them, * See if quotainodes are setup, and if not, allocate them,
* and change the superblock accordingly. * and change the superblock accordingly.
*/ */
if ((error = xfs_qm_init_quotainos(mp))) { error = xfs_qm_init_quotainos(mp);
list_lru_destroy(&qinf->qi_lru); if (error)
kmem_free(qinf); goto out_free_lru;
mp->m_quotainfo = NULL;
return error;
}
INIT_RADIX_TREE(&qinf->qi_uquota_tree, GFP_NOFS); INIT_RADIX_TREE(&qinf->qi_uquota_tree, GFP_NOFS);
INIT_RADIX_TREE(&qinf->qi_gquota_tree, GFP_NOFS); INIT_RADIX_TREE(&qinf->qi_gquota_tree, GFP_NOFS);
...@@ -935,6 +930,13 @@ xfs_qm_init_quotainfo( ...@@ -935,6 +930,13 @@ xfs_qm_init_quotainfo(
qinf->qi_shrinker.flags = SHRINKER_NUMA_AWARE; qinf->qi_shrinker.flags = SHRINKER_NUMA_AWARE;
register_shrinker(&qinf->qi_shrinker); register_shrinker(&qinf->qi_shrinker);
return 0; return 0;
out_free_lru:
list_lru_destroy(&qinf->qi_lru);
out_free_qinf:
kmem_free(qinf);
mp->m_quotainfo = NULL;
return error;
} }
......
...@@ -1433,11 +1433,11 @@ xfs_fs_fill_super( ...@@ -1433,11 +1433,11 @@ xfs_fs_fill_super(
if (error) if (error)
goto out_free_fsname; goto out_free_fsname;
error = xfs_init_mount_workqueues(mp); error = -xfs_init_mount_workqueues(mp);
if (error) if (error)
goto out_close_devices; goto out_close_devices;
error = xfs_icsb_init_counters(mp); error = -xfs_icsb_init_counters(mp);
if (error) if (error)
goto out_destroy_workqueues; goto out_destroy_workqueues;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment