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

Pull xfs fixes from Carlos Maiolino:
 "A couple race fixes found on the new healthmon mechanism, and another
  flushing dquots during filesystem shutdown"

* tag 'xfs-fixes-7.0-rc4' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: fix integer overflow in bmap intent sort comparator
  xfs: fix undersized l_iclog_roundoff values
  xfs: ensure dquot item is deleted from AIL only after log shutdown
  xfs: remove redundant set null for ip->i_itemp
  xfs: fix returned valued from xfs_defer_can_append
  xfs: Remove redundant NULL check after __GFP_NOFAIL
  xfs: fix race between healthmon unmount and read_iter
  xfs: remove scratch field from struct xfs_gc_bio
This commit is contained in:
Linus Torvalds
2026-03-13 10:49:15 -07:00
8 changed files with 23 additions and 19 deletions

View File

@@ -2716,12 +2716,8 @@ xfs_dabuf_map(
* larger one that needs to be free by the caller.
*/
if (nirecs > 1) {
map = kzalloc(nirecs * sizeof(struct xfs_buf_map),
GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
if (!map) {
error = -ENOMEM;
goto out_free_irecs;
}
map = kcalloc(nirecs, sizeof(struct xfs_buf_map),
GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
*mapp = map;
}

View File

@@ -809,7 +809,7 @@ xfs_defer_can_append(
/* Paused items cannot absorb more work */
if (dfp->dfp_flags & XFS_DEFER_PAUSED)
return NULL;
return false;
/* Already full? */
if (ops->max_items && dfp->dfp_count >= ops->max_items)

View File

@@ -245,7 +245,7 @@ xfs_bmap_update_diff_items(
struct xfs_bmap_intent *ba = bi_entry(a);
struct xfs_bmap_intent *bb = bi_entry(b);
return ba->bi_owner->i_ino - bb->bi_owner->i_ino;
return cmp_int(ba->bi_owner->i_ino, bb->bi_owner->i_ino);
}
/* Log bmap updates in the intent item. */

View File

@@ -1439,9 +1439,15 @@ xfs_qm_dqflush(
return 0;
out_abort:
/*
* Shut down the log before removing the dquot item from the AIL.
* Otherwise, the log tail may advance past this item's LSN while
* log writes are still in progress, making these unflushed changes
* unrecoverable on the next mount.
*/
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
dqp->q_flags &= ~XFS_DQFLAG_DIRTY;
xfs_trans_ail_delete(lip, 0);
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
xfs_dqfunlock(dqp);
return error;
}

View File

@@ -141,6 +141,16 @@ xfs_healthmon_detach(
hm->mount_cookie = DETACHED_MOUNT_COOKIE;
spin_unlock(&xfs_healthmon_lock);
/*
* Wake up any readers that might remain. This can happen if unmount
* races with the healthmon fd owner entering ->read_iter, having
* already emptied the event queue.
*
* In the ->release case there shouldn't be any readers because the
* only users of the waiter are read and poll.
*/
wake_up_all(&hm->wait);
trace_xfs_healthmon_detach(hm);
xfs_healthmon_put(hm);
}
@@ -1027,13 +1037,6 @@ xfs_healthmon_release(
* process can create another health monitor file.
*/
xfs_healthmon_detach(hm);
/*
* Wake up any readers that might be left. There shouldn't be any
* because the only users of the waiter are read and poll.
*/
wake_up_all(&hm->wait);
xfs_healthmon_put(hm);
return 0;
}

View File

@@ -159,7 +159,6 @@ xfs_inode_free_callback(
ASSERT(!test_bit(XFS_LI_IN_AIL,
&ip->i_itemp->ili_item.li_flags));
xfs_inode_item_destroy(ip);
ip->i_itemp = NULL;
}
kmem_cache_free(xfs_inode_cache, ip);

View File

@@ -1357,6 +1357,8 @@ xlog_alloc_log(
if (xfs_has_logv2(mp) && mp->m_sb.sb_logsunit > 1)
log->l_iclog_roundoff = mp->m_sb.sb_logsunit;
else if (mp->m_sb.sb_logsectsize > 0)
log->l_iclog_roundoff = mp->m_sb.sb_logsectsize;
else
log->l_iclog_roundoff = BBSIZE;

View File

@@ -96,7 +96,6 @@ struct xfs_gc_bio {
*/
xfs_fsblock_t old_startblock;
xfs_daddr_t new_daddr;
struct xfs_zone_scratch *scratch;
/* Are we writing to a sequential write required zone? */
bool is_seq;
@@ -779,7 +778,6 @@ xfs_zone_gc_split_write(
ihold(VFS_I(chunk->ip));
split_chunk->ip = chunk->ip;
split_chunk->is_seq = chunk->is_seq;
split_chunk->scratch = chunk->scratch;
split_chunk->offset = chunk->offset;
split_chunk->len = split_len;
split_chunk->old_startblock = chunk->old_startblock;