summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2025-11-12 13:14:18 +0100
committerCarlos Maiolino <cem@kernel.org>2026-01-21 12:57:16 +0100
commitc53fbeedbe9098ba2e355fe646f3fe93e57f3f0e (patch)
treeea6ba8be97348c3133c0d3346eacb796932e9ed2
parent2d4521e4c00cafcd195f5e6fe5ee75b5c0680b8e (diff)
xfs: set lv_bytes in xlog_write_one_vec
lv_bytes is mostly just use by the CIL code, but has crept into the low-level log writing code to decide on a full or partial iclog write. Ensure it is valid even for the special log writes that don't go through the CIL by initializing it in xlog_write_one_vec. Note that even without this fix, the checkpoint commits would never trigger a partial iclog write, as they have no payload beyond the opheader. The unmount record on the other hand could in theory trigger a an overflow of the iclog, but given that is has never been seen in the wild this has probably been masked by the small size of it and the fact that the unmount process does multiple log forces before writing the unmount record and we thus usually operate on an empty or almost empty iclog. Fixes: 110dc24ad2ae ("xfs: log vector rounding leaks log space") Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
-rw-r--r--fs/xfs/xfs_log.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index c6fa258df844..4869eacfde24 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -858,14 +858,15 @@ xlog_write_one_vec(
struct xfs_log_vec lv = {
.lv_niovecs = 1,
.lv_iovecp = reg,
+ .lv_bytes = reg->i_len,
};
LIST_HEAD (lv_chain);
/* account for space used by record data */
- ticket->t_curr_res -= reg->i_len;
+ ticket->t_curr_res -= lv.lv_bytes;
list_add(&lv.lv_list, &lv_chain);
- return xlog_write(log, ctx, &lv_chain, ticket, reg->i_len);
+ return xlog_write(log, ctx, &lv_chain, ticket, lv.lv_bytes);
}
/*