summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2023-03-25 13:12:36 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2023-03-25 13:12:36 -0700
commit5b9ff397a26aeb94180e0d459fda9731c3c617ba (patch)
tree5d7247fcaa7cc32d38e8e71c5602b983e26b4d77
parentf768b35a2371ccf85255f608444d234062a1b5c9 (diff)
parent4dfb02d5cae80289384c4d3c6ddfbd92d30aced9 (diff)
downloadlinux-stable-5b9ff397a26aeb94180e0d459fda9731c3c617ba.tar.gz
linux-stable-5b9ff397a26aeb94180e0d459fda9731c3c617ba.tar.bz2
linux-stable-5b9ff397a26aeb94180e0d459fda9731c3c617ba.zip
Merge tag 'xfs-6.3-fixes-7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull yet more xfs bug fixes from Darrick Wong: "The first bugfix addresses a longstanding problem where we use the wrong file mapping cursors when trying to compute the speculative preallocation quantity. This has been causing sporadic crashes when alwayscow mode is engaged. The other two fixes correct minor problems in more recent changes. - Fix the new allocator tracepoints because git am mismerged the changes such that the trace_XXX got rebased to be in function YYY instead of XXX - Ensure that the perag AGFL_RESET state is consistent with whatever we've just read off the disk - Fix a bug where we used the wrong iext cursor during a write begin" * tag 'xfs-6.3-fixes-7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: xfs: fix mismerged tracepoints xfs: clear incore AGFL_RESET state if it's not needed xfs: pass the correct cursor to xfs_iomap_prealloc_size
-rw-r--r--fs/xfs/libxfs/xfs_alloc.c10
-rw-r--r--fs/xfs/xfs_iomap.c5
2 files changed, 10 insertions, 5 deletions
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
index 55ae08a6144c..203f16c48c19 100644
--- a/fs/xfs/libxfs/xfs_alloc.c
+++ b/fs/xfs/libxfs/xfs_alloc.c
@@ -3045,6 +3045,8 @@ xfs_alloc_read_agf(
pag->pagf_refcount_level = be32_to_cpu(agf->agf_refcount_level);
if (xfs_agfl_needs_reset(pag->pag_mount, agf))
set_bit(XFS_AGSTATE_AGFL_NEEDS_RESET, &pag->pag_opstate);
+ else
+ clear_bit(XFS_AGSTATE_AGFL_NEEDS_RESET, &pag->pag_opstate);
/*
* Update the in-core allocbt counter. Filter out the rmapbt
@@ -3411,7 +3413,7 @@ xfs_alloc_vextent_start_ag(
args->agno = NULLAGNUMBER;
args->agbno = NULLAGBLOCK;
- trace_xfs_alloc_vextent_first_ag(args);
+ trace_xfs_alloc_vextent_start_ag(args);
error = xfs_alloc_vextent_check_args(args, target, &minimum_agno);
if (error) {
@@ -3464,7 +3466,7 @@ xfs_alloc_vextent_first_ag(
args->agno = NULLAGNUMBER;
args->agbno = NULLAGBLOCK;
- trace_xfs_alloc_vextent_start_ag(args);
+ trace_xfs_alloc_vextent_first_ag(args);
error = xfs_alloc_vextent_check_args(args, target, &minimum_agno);
if (error) {
@@ -3498,7 +3500,7 @@ xfs_alloc_vextent_exact_bno(
args->agno = XFS_FSB_TO_AGNO(mp, target);
args->agbno = XFS_FSB_TO_AGBNO(mp, target);
- trace_xfs_alloc_vextent_near_bno(args);
+ trace_xfs_alloc_vextent_exact_bno(args);
error = xfs_alloc_vextent_check_args(args, target, &minimum_agno);
if (error) {
@@ -3536,7 +3538,7 @@ xfs_alloc_vextent_near_bno(
args->agno = XFS_FSB_TO_AGNO(mp, target);
args->agbno = XFS_FSB_TO_AGBNO(mp, target);
- trace_xfs_alloc_vextent_exact_bno(args);
+ trace_xfs_alloc_vextent_near_bno(args);
error = xfs_alloc_vextent_check_args(args, target, &minimum_agno);
if (error) {
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 69dbe7814128..285885c308bd 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -1090,9 +1090,12 @@ xfs_buffered_write_iomap_begin(
*/
if (xfs_has_allocsize(mp))
prealloc_blocks = mp->m_allocsize_blocks;
- else
+ else if (allocfork == XFS_DATA_FORK)
prealloc_blocks = xfs_iomap_prealloc_size(ip, allocfork,
offset, count, &icur);
+ else
+ prealloc_blocks = xfs_iomap_prealloc_size(ip, allocfork,
+ offset, count, &ccur);
if (prealloc_blocks) {
xfs_extlen_t align;
xfs_off_t end_offset;