Merge tag 'xfs-6.13-fixes_2024-12-23' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into for-next

xfs: bug fixes for 6.13 [01/14]

Bug fixes for 6.13.

This has been running on the djcloud for months with no problems.  Enjoy!

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
This commit is contained in:
Carlos Maiolino
2025-01-13 14:54:14 +01:00
2 changed files with 25 additions and 14 deletions

View File

@@ -1316,7 +1316,8 @@ xfs_dquot_read_buf(
/*
* Attach a dquot buffer to this dquot to avoid allocating a buffer during a
* dqflush, since dqflush can be called from reclaim context.
* dqflush, since dqflush can be called from reclaim context. Caller must hold
* the dqlock.
*/
int
xfs_dquot_attach_buf(
@@ -1337,13 +1338,16 @@ xfs_dquot_attach_buf(
return error;
/*
* Attach the dquot to the buffer so that the AIL does not have
* to read the dquot buffer to push this item.
* Hold the dquot buffer so that we retain our ref to it after
* detaching it from the transaction, then give that ref to the
* dquot log item so that the AIL does not have to read the
* dquot buffer to push this item.
*/
xfs_buf_hold(bp);
xfs_trans_brelse(tp, bp);
spin_lock(&qlip->qli_lock);
lip->li_buf = bp;
xfs_trans_brelse(tp, bp);
}
qlip->qli_dirty = true;
spin_unlock(&qlip->qli_lock);

View File

@@ -32,21 +32,28 @@ xfs_fill_statvfs_from_dquot(
limit = blkres->softlimit ?
blkres->softlimit :
blkres->hardlimit;
if (limit && statp->f_blocks > limit) {
statp->f_blocks = limit;
statp->f_bfree = statp->f_bavail =
(statp->f_blocks > blkres->reserved) ?
(statp->f_blocks - blkres->reserved) : 0;
if (limit) {
uint64_t remaining = 0;
if (limit > blkres->reserved)
remaining = limit - blkres->reserved;
statp->f_blocks = min(statp->f_blocks, limit);
statp->f_bfree = min(statp->f_bfree, remaining);
statp->f_bavail = min(statp->f_bavail, remaining);
}
limit = dqp->q_ino.softlimit ?
dqp->q_ino.softlimit :
dqp->q_ino.hardlimit;
if (limit && statp->f_files > limit) {
statp->f_files = limit;
statp->f_ffree =
(statp->f_files > dqp->q_ino.reserved) ?
(statp->f_files - dqp->q_ino.reserved) : 0;
if (limit) {
uint64_t remaining = 0;
if (limit > dqp->q_ino.reserved)
remaining = limit - dqp->q_ino.reserved;
statp->f_files = min(statp->f_files, limit);
statp->f_ffree = min(statp->f_ffree, remaining);
}
}