Skip to content

Commit 399af66

Browse files
committed
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
2 parents d874ca0 + 362c490 commit 399af66

8 files changed

Lines changed: 23 additions & 19 deletions

File tree

fs/xfs/libxfs/xfs_da_btree.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2716,12 +2716,8 @@ xfs_dabuf_map(
27162716
* larger one that needs to be free by the caller.
27172717
*/
27182718
if (nirecs > 1) {
2719-
map = kzalloc(nirecs * sizeof(struct xfs_buf_map),
2720-
GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
2721-
if (!map) {
2722-
error = -ENOMEM;
2723-
goto out_free_irecs;
2724-
}
2719+
map = kcalloc(nirecs, sizeof(struct xfs_buf_map),
2720+
GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
27252721
*mapp = map;
27262722
}
27272723

fs/xfs/libxfs/xfs_defer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ xfs_defer_can_append(
809809

810810
/* Paused items cannot absorb more work */
811811
if (dfp->dfp_flags & XFS_DEFER_PAUSED)
812-
return NULL;
812+
return false;
813813

814814
/* Already full? */
815815
if (ops->max_items && dfp->dfp_count >= ops->max_items)

fs/xfs/xfs_bmap_item.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ xfs_bmap_update_diff_items(
245245
struct xfs_bmap_intent *ba = bi_entry(a);
246246
struct xfs_bmap_intent *bb = bi_entry(b);
247247

248-
return ba->bi_owner->i_ino - bb->bi_owner->i_ino;
248+
return cmp_int(ba->bi_owner->i_ino, bb->bi_owner->i_ino);
249249
}
250250

251251
/* Log bmap updates in the intent item. */

fs/xfs/xfs_dquot.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1439,9 +1439,15 @@ xfs_qm_dqflush(
14391439
return 0;
14401440

14411441
out_abort:
1442+
/*
1443+
* Shut down the log before removing the dquot item from the AIL.
1444+
* Otherwise, the log tail may advance past this item's LSN while
1445+
* log writes are still in progress, making these unflushed changes
1446+
* unrecoverable on the next mount.
1447+
*/
1448+
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
14421449
dqp->q_flags &= ~XFS_DQFLAG_DIRTY;
14431450
xfs_trans_ail_delete(lip, 0);
1444-
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
14451451
xfs_dqfunlock(dqp);
14461452
return error;
14471453
}

fs/xfs/xfs_healthmon.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@ xfs_healthmon_detach(
141141
hm->mount_cookie = DETACHED_MOUNT_COOKIE;
142142
spin_unlock(&xfs_healthmon_lock);
143143

144+
/*
145+
* Wake up any readers that might remain. This can happen if unmount
146+
* races with the healthmon fd owner entering ->read_iter, having
147+
* already emptied the event queue.
148+
*
149+
* In the ->release case there shouldn't be any readers because the
150+
* only users of the waiter are read and poll.
151+
*/
152+
wake_up_all(&hm->wait);
153+
144154
trace_xfs_healthmon_detach(hm);
145155
xfs_healthmon_put(hm);
146156
}
@@ -1027,13 +1037,6 @@ xfs_healthmon_release(
10271037
* process can create another health monitor file.
10281038
*/
10291039
xfs_healthmon_detach(hm);
1030-
1031-
/*
1032-
* Wake up any readers that might be left. There shouldn't be any
1033-
* because the only users of the waiter are read and poll.
1034-
*/
1035-
wake_up_all(&hm->wait);
1036-
10371040
xfs_healthmon_put(hm);
10381041
return 0;
10391042
}

fs/xfs/xfs_icache.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ xfs_inode_free_callback(
159159
ASSERT(!test_bit(XFS_LI_IN_AIL,
160160
&ip->i_itemp->ili_item.li_flags));
161161
xfs_inode_item_destroy(ip);
162-
ip->i_itemp = NULL;
163162
}
164163

165164
kmem_cache_free(xfs_inode_cache, ip);

fs/xfs/xfs_log.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,6 +1357,8 @@ xlog_alloc_log(
13571357

13581358
if (xfs_has_logv2(mp) && mp->m_sb.sb_logsunit > 1)
13591359
log->l_iclog_roundoff = mp->m_sb.sb_logsunit;
1360+
else if (mp->m_sb.sb_logsectsize > 0)
1361+
log->l_iclog_roundoff = mp->m_sb.sb_logsectsize;
13601362
else
13611363
log->l_iclog_roundoff = BBSIZE;
13621364

fs/xfs/xfs_zone_gc.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ struct xfs_gc_bio {
9696
*/
9797
xfs_fsblock_t old_startblock;
9898
xfs_daddr_t new_daddr;
99-
struct xfs_zone_scratch *scratch;
10099

101100
/* Are we writing to a sequential write required zone? */
102101
bool is_seq;
@@ -779,7 +778,6 @@ xfs_zone_gc_split_write(
779778
ihold(VFS_I(chunk->ip));
780779
split_chunk->ip = chunk->ip;
781780
split_chunk->is_seq = chunk->is_seq;
782-
split_chunk->scratch = chunk->scratch;
783781
split_chunk->offset = chunk->offset;
784782
split_chunk->len = split_len;
785783
split_chunk->old_startblock = chunk->old_startblock;

0 commit comments

Comments
 (0)