Commit a3e18a54 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull xfs fix from Chandan Babu:
 "Ensure xfs incore superblock's allocated inode counter, free inode
  counter, and free data block counter are all zero or positive when
  they are copied over from xfs_mount->m_[icount,ifree,fdblocks]
  respectively"

* tag 'xfs-6.10-fixes-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: make sure sb_fdblocks is non-negative
parents 62e1f3b3 58f88071
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1038,11 +1038,12 @@ xfs_log_sb(
	 * and hence we don't need have to update it here.
	 */
	if (xfs_has_lazysbcount(mp)) {
		mp->m_sb.sb_icount = percpu_counter_sum(&mp->m_icount);
		mp->m_sb.sb_icount = percpu_counter_sum_positive(&mp->m_icount);
		mp->m_sb.sb_ifree = min_t(uint64_t,
				percpu_counter_sum(&mp->m_ifree),
				percpu_counter_sum_positive(&mp->m_ifree),
				mp->m_sb.sb_icount);
		mp->m_sb.sb_fdblocks = percpu_counter_sum(&mp->m_fdblocks);
		mp->m_sb.sb_fdblocks =
				percpu_counter_sum_positive(&mp->m_fdblocks);
	}

	xfs_sb_to_disk(bp->b_addr, &mp->m_sb);