From c53fbeedbe9098ba2e355fe646f3fe93e57f3f0e Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 12 Nov 2025 13:14:18 +0100 Subject: [PATCH] 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 Reviewed-by: Darrick J. Wong Signed-off-by: Carlos Maiolino --- fs/xfs/xfs_log.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index c6fa258df8440..4869eacfde241 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); } /* -- 2.47.3