Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3bdbfb10 authored by David Chinner's avatar David Chinner Committed by Nathan Scott
Browse files

[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: default avatarDavid Chinner <dgc@sgi.com>
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent bcec2b7f
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -4754,10 +4754,20 @@ xfs_bmapi(
					error = xfs_mod_incore_sb(mp,
							XFS_SBS_FDBLOCKS,
							-(alen), rsvd);
				if (!error)
				if (!error) {
					error = xfs_mod_incore_sb(mp,
							XFS_SBS_FDBLOCKS,
							-(indlen), rsvd);
					if (error && rt) {
						xfs_mod_incore_sb(ip->i_mount,
							XFS_SBS_FREXTENTS,
							extsz, rsvd);
					} else if (error) {
						xfs_mod_incore_sb(ip->i_mount,
							XFS_SBS_FDBLOCKS,
							alen, rsvd);
					}
				}

				if (error) {
					if (XFS_IS_QUOTA_ON(ip->i_mount))