Skip to content

Commit 9141c5d

Browse files
committed
Merge tag 'xfs-fixes-6.13-rc2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull xfs fixes from Carlos Maiolino: - Use xchg() in xlog_cil_insert_pcp_aggregate() - Fix ABBA deadlock on a race between mount and log shutdown - Fix quota softlimit incoherency on delalloc - Fix sparse inode limits on runt AG - remove unknown compat feature checks in SB write valdation - Eliminate a lockdep false positive * tag 'xfs-fixes-6.13-rc2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: xfs: don't call xfs_bmap_same_rtgroup in xfs_bmap_add_extent_hole_delay xfs: Use xchg() in xlog_cil_insert_pcp_aggregate() xfs: prevent mount and log shutdown race xfs: delalloc and quota softlimit timers are incoherent xfs: fix sparse inode limits on runt AG xfs: remove unknown compat feature check in superblock write validation xfs: eliminate lockdep false positives in xfs_attr_shortform_list
2 parents ceb8bf2 + cc2dba0 commit 9141c5d

File tree

8 files changed

+26
-36
lines changed

8 files changed

+26
-36
lines changed

fs/xfs/libxfs/xfs_bmap.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2620,17 +2620,15 @@ xfs_bmap_add_extent_hole_delay(
26202620
*/
26212621
if ((state & BMAP_LEFT_VALID) && (state & BMAP_LEFT_DELAY) &&
26222622
left.br_startoff + left.br_blockcount == new->br_startoff &&
2623-
left.br_blockcount + new->br_blockcount <= XFS_MAX_BMBT_EXTLEN &&
2624-
xfs_bmap_same_rtgroup(ip, whichfork, &left, new))
2623+
left.br_blockcount + new->br_blockcount <= XFS_MAX_BMBT_EXTLEN)
26252624
state |= BMAP_LEFT_CONTIG;
26262625

26272626
if ((state & BMAP_RIGHT_VALID) && (state & BMAP_RIGHT_DELAY) &&
26282627
new->br_startoff + new->br_blockcount == right.br_startoff &&
26292628
new->br_blockcount + right.br_blockcount <= XFS_MAX_BMBT_EXTLEN &&
26302629
(!(state & BMAP_LEFT_CONTIG) ||
26312630
(left.br_blockcount + new->br_blockcount +
2632-
right.br_blockcount <= XFS_MAX_BMBT_EXTLEN)) &&
2633-
xfs_bmap_same_rtgroup(ip, whichfork, new, &right))
2631+
right.br_blockcount <= XFS_MAX_BMBT_EXTLEN)))
26342632
state |= BMAP_RIGHT_CONTIG;
26352633

26362634
/*

fs/xfs/libxfs/xfs_ialloc.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,8 @@ xfs_ialloc_ag_alloc(
853853
* the end of the AG.
854854
*/
855855
args.min_agbno = args.mp->m_sb.sb_inoalignmt;
856-
args.max_agbno = round_down(args.mp->m_sb.sb_agblocks,
856+
args.max_agbno = round_down(xfs_ag_block_count(args.mp,
857+
pag_agno(pag)),
857858
args.mp->m_sb.sb_inoalignmt) -
858859
igeo->ialloc_blks;
859860

@@ -2349,9 +2350,9 @@ xfs_difree(
23492350
return -EINVAL;
23502351
}
23512352
agbno = XFS_AGINO_TO_AGBNO(mp, agino);
2352-
if (agbno >= mp->m_sb.sb_agblocks) {
2353-
xfs_warn(mp, "%s: agbno >= mp->m_sb.sb_agblocks (%d >= %d).",
2354-
__func__, agbno, mp->m_sb.sb_agblocks);
2353+
if (agbno >= xfs_ag_block_count(mp, pag_agno(pag))) {
2354+
xfs_warn(mp, "%s: agbno >= xfs_ag_block_count (%d >= %d).",
2355+
__func__, agbno, xfs_ag_block_count(mp, pag_agno(pag)));
23552356
ASSERT(0);
23562357
return -EINVAL;
23572358
}
@@ -2474,7 +2475,7 @@ xfs_imap(
24742475
*/
24752476
agino = XFS_INO_TO_AGINO(mp, ino);
24762477
agbno = XFS_AGINO_TO_AGBNO(mp, agino);
2477-
if (agbno >= mp->m_sb.sb_agblocks ||
2478+
if (agbno >= xfs_ag_block_count(mp, pag_agno(pag)) ||
24782479
ino != xfs_agino_to_ino(pag, agino)) {
24792480
error = -EINVAL;
24802481
#ifdef DEBUG
@@ -2484,11 +2485,12 @@ xfs_imap(
24842485
*/
24852486
if (flags & XFS_IGET_UNTRUSTED)
24862487
return error;
2487-
if (agbno >= mp->m_sb.sb_agblocks) {
2488+
if (agbno >= xfs_ag_block_count(mp, pag_agno(pag))) {
24882489
xfs_alert(mp,
24892490
"%s: agbno (0x%llx) >= mp->m_sb.sb_agblocks (0x%lx)",
24902491
__func__, (unsigned long long)agbno,
2491-
(unsigned long)mp->m_sb.sb_agblocks);
2492+
(unsigned long)xfs_ag_block_count(mp,
2493+
pag_agno(pag)));
24922494
}
24932495
if (ino != xfs_agino_to_ino(pag, agino)) {
24942496
xfs_alert(mp,

fs/xfs/libxfs/xfs_sb.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,6 @@ xfs_validate_sb_write(
326326
* the kernel cannot support since we checked for unsupported bits in
327327
* the read verifier, which means that memory is corrupt.
328328
*/
329-
if (xfs_sb_has_compat_feature(sbp, XFS_SB_FEAT_COMPAT_UNKNOWN)) {
330-
xfs_warn(mp,
331-
"Corruption detected in superblock compatible features (0x%x)!",
332-
(sbp->sb_features_compat & XFS_SB_FEAT_COMPAT_UNKNOWN));
333-
return -EFSCORRUPTED;
334-
}
335-
336329
if (!xfs_is_readonly(mp) &&
337330
xfs_sb_has_ro_compat_feature(sbp, XFS_SB_FEAT_RO_COMPAT_UNKNOWN)) {
338331
xfs_alert(mp,

fs/xfs/xfs_attr_list.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ xfs_attr_shortform_list(
114114
* It didn't all fit, so we have to sort everything on hashval.
115115
*/
116116
sbsize = sf->count * sizeof(*sbuf);
117-
sbp = sbuf = kmalloc(sbsize, GFP_KERNEL | __GFP_NOFAIL);
117+
sbp = sbuf = kmalloc(sbsize,
118+
GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
118119

119120
/*
120121
* Scan the attribute list for the rest of the entries, storing

fs/xfs/xfs_log.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3455,6 +3455,16 @@ xlog_force_shutdown(
34553455
if (!log)
34563456
return false;
34573457

3458+
/*
3459+
* Ensure that there is only ever one log shutdown being processed.
3460+
* If we allow the log force below on a second pass after shutting
3461+
* down the log, we risk deadlocking the CIL push as it may require
3462+
* locks on objects the current shutdown context holds (e.g. taking
3463+
* buffer locks to abort buffers on last unpin of buf log items).
3464+
*/
3465+
if (test_and_set_bit(XLOG_SHUTDOWN_STARTED, &log->l_opstate))
3466+
return false;
3467+
34583468
/*
34593469
* Flush all the completed transactions to disk before marking the log
34603470
* being shut down. We need to do this first as shutting down the log
@@ -3487,6 +3497,7 @@ xlog_force_shutdown(
34873497
spin_lock(&log->l_icloglock);
34883498
if (test_and_set_bit(XLOG_IO_ERROR, &log->l_opstate)) {
34893499
spin_unlock(&log->l_icloglock);
3500+
ASSERT(0);
34903501
return false;
34913502
}
34923503
spin_unlock(&log->l_icloglock);

fs/xfs/xfs_log_cil.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,8 @@ xlog_cil_insert_pcp_aggregate(
171171
*/
172172
for_each_cpu(cpu, &ctx->cil_pcpmask) {
173173
struct xlog_cil_pcp *cilpcp = per_cpu_ptr(cil->xc_pcp, cpu);
174-
int old = READ_ONCE(cilpcp->space_used);
175174

176-
while (!try_cmpxchg(&cilpcp->space_used, &old, 0))
177-
;
178-
count += old;
175+
count += xchg(&cilpcp->space_used, 0);
179176
}
180177
atomic_add(count, &ctx->space_used);
181178
}

fs/xfs/xfs_log_priv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ struct xlog {
458458
#define XLOG_IO_ERROR 2 /* log hit an I/O error, and being
459459
shutdown */
460460
#define XLOG_TAIL_WARN 3 /* log tail verify warning issued */
461+
#define XLOG_SHUTDOWN_STARTED 4 /* xlog_force_shutdown() exclusion */
461462

462463
static inline bool
463464
xlog_recovery_needed(struct xlog *log)

fs/xfs/xfs_qm_syscalls.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -427,19 +427,6 @@ xfs_qm_scall_getquota_fill_qc(
427427
dst->d_ino_timer = 0;
428428
dst->d_rt_spc_timer = 0;
429429
}
430-
431-
#ifdef DEBUG
432-
if (xfs_dquot_is_enforced(dqp) && dqp->q_id != 0) {
433-
if ((dst->d_space > dst->d_spc_softlimit) &&
434-
(dst->d_spc_softlimit > 0)) {
435-
ASSERT(dst->d_spc_timer != 0);
436-
}
437-
if ((dst->d_ino_count > dqp->q_ino.softlimit) &&
438-
(dqp->q_ino.softlimit > 0)) {
439-
ASSERT(dst->d_ino_timer != 0);
440-
}
441-
}
442-
#endif
443430
}
444431

445432
/* Return the quota information for the dquot matching id. */

0 commit comments

Comments
 (0)