Commit e1d0126c authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'xfs-5.9-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux

Pull xfs fixes from Darrick Wong:
 "Various small corruption fixes that have come in during the past
  month:

   - Avoid a log recovery failure for an insert range operation by
     rolling deferred ops incrementally instead of at the end.

   - Fix an off-by-one error when calculating log space reservations for
     anything involving an inode allocation or free.

   - Fix a broken shortform xattr verifier.

   - Ensure that the shortform xattr header padding is always
     initialized to zero"

* tag 'xfs-5.9-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: initialize the shortform attr header padding entry
  xfs: fix boundary test in xfs_attr_shortform_verify
  xfs: fix off-by-one in inode alloc block reservation calculation
  xfs: finish dfops on every insert range shift iteration
parents 54e54d58 125eac24
...@@ -653,8 +653,8 @@ xfs_attr_shortform_create( ...@@ -653,8 +653,8 @@ xfs_attr_shortform_create(
ASSERT(ifp->if_flags & XFS_IFINLINE); ASSERT(ifp->if_flags & XFS_IFINLINE);
} }
xfs_idata_realloc(dp, sizeof(*hdr), XFS_ATTR_FORK); xfs_idata_realloc(dp, sizeof(*hdr), XFS_ATTR_FORK);
hdr = (xfs_attr_sf_hdr_t *)ifp->if_u1.if_data; hdr = (struct xfs_attr_sf_hdr *)ifp->if_u1.if_data;
hdr->count = 0; memset(hdr, 0, sizeof(*hdr));
hdr->totsize = cpu_to_be16(sizeof(*hdr)); hdr->totsize = cpu_to_be16(sizeof(*hdr));
xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA); xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA);
} }
...@@ -1036,8 +1036,10 @@ xfs_attr_shortform_verify( ...@@ -1036,8 +1036,10 @@ xfs_attr_shortform_verify(
* struct xfs_attr_sf_entry has a variable length. * struct xfs_attr_sf_entry has a variable length.
* Check the fixed-offset parts of the structure are * Check the fixed-offset parts of the structure are
* within the data buffer. * within the data buffer.
* xfs_attr_sf_entry is defined with a 1-byte variable
* array at the end, so we must subtract that off.
*/ */
if (((char *)sfep + sizeof(*sfep)) >= endp) if (((char *)sfep + sizeof(*sfep) - 1) >= endp)
return __this_address; return __this_address;
/* Don't allow names with known bad length. */ /* Don't allow names with known bad length. */
......
...@@ -688,7 +688,7 @@ xfs_ialloc_ag_alloc( ...@@ -688,7 +688,7 @@ xfs_ialloc_ag_alloc(
args.minalignslop = igeo->cluster_align - 1; args.minalignslop = igeo->cluster_align - 1;
/* Allow space for the inode btree to split. */ /* Allow space for the inode btree to split. */
args.minleft = igeo->inobt_maxlevels - 1; args.minleft = igeo->inobt_maxlevels;
if ((error = xfs_alloc_vextent(&args))) if ((error = xfs_alloc_vextent(&args)))
return error; return error;
...@@ -736,7 +736,7 @@ xfs_ialloc_ag_alloc( ...@@ -736,7 +736,7 @@ xfs_ialloc_ag_alloc(
/* /*
* Allow space for the inode btree to split. * Allow space for the inode btree to split.
*/ */
args.minleft = igeo->inobt_maxlevels - 1; args.minleft = igeo->inobt_maxlevels;
if ((error = xfs_alloc_vextent(&args))) if ((error = xfs_alloc_vextent(&args)))
return error; return error;
} }
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
#define XFS_IALLOC_SPACE_RES(mp) \ #define XFS_IALLOC_SPACE_RES(mp) \
(M_IGEO(mp)->ialloc_blks + \ (M_IGEO(mp)->ialloc_blks + \
((xfs_sb_version_hasfinobt(&mp->m_sb) ? 2 : 1) * \ ((xfs_sb_version_hasfinobt(&mp->m_sb) ? 2 : 1) * \
(M_IGEO(mp)->inobt_maxlevels - 1))) M_IGEO(mp)->inobt_maxlevels))
/* /*
* Space reservation values for various transactions. * Space reservation values for various transactions.
......
...@@ -1165,7 +1165,7 @@ xfs_insert_file_space( ...@@ -1165,7 +1165,7 @@ xfs_insert_file_space(
goto out_trans_cancel; goto out_trans_cancel;
do { do {
error = xfs_trans_roll_inode(&tp, ip); error = xfs_defer_finish(&tp);
if (error) if (error)
goto out_trans_cancel; goto out_trans_cancel;
......
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