Commit a3e18a54 authored by Linus Torvalds's avatar Linus Torvalds

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
...@@ -1038,11 +1038,12 @@ xfs_log_sb( ...@@ -1038,11 +1038,12 @@ xfs_log_sb(
* and hence we don't need have to update it here. * and hence we don't need have to update it here.
*/ */
if (xfs_has_lazysbcount(mp)) { 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, 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_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); xfs_sb_to_disk(bp->b_addr, &mp->m_sb);
......
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