Commit 3bdbfb104e53b367892cc9510e6722346dfb656b

Authored by David Chinner
Committed by Nathan Scott
1 parent bcec2b7f2b

[XFS] Prevent the incore superblock sb_fdblocks count from leaking when we

are getting ENOSPC errors on writes. When we fail to allocate space for
indirect blocks in xfs_bmapi() make sure we release the direct block
allocation before returning.

SGI-PV: 938502
SGI-Modid: xfs-linux:xfs-kern:22986a

Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>

Showing 1 changed file with 11 additions and 1 deletions Side-by-side Diff

... ... @@ -4754,10 +4754,20 @@
4754 4754 error = xfs_mod_incore_sb(mp,
4755 4755 XFS_SBS_FDBLOCKS,
4756 4756 -(alen), rsvd);
4757   - if (!error)
  4757 + if (!error) {
4758 4758 error = xfs_mod_incore_sb(mp,
4759 4759 XFS_SBS_FDBLOCKS,
4760 4760 -(indlen), rsvd);
  4761 + if (error && rt) {
  4762 + xfs_mod_incore_sb(ip->i_mount,
  4763 + XFS_SBS_FREXTENTS,
  4764 + extsz, rsvd);
  4765 + } else if (error) {
  4766 + xfs_mod_incore_sb(ip->i_mount,
  4767 + XFS_SBS_FDBLOCKS,
  4768 + alen, rsvd);
  4769 + }
  4770 + }
4761 4771  
4762 4772 if (error) {
4763 4773 if (XFS_IS_QUOTA_ON(ip->i_mount))