mirror of
https://github.com/torvalds/linux.git
synced 2026-09-13 15:40:03 +02:00
xfs: actually recover intended file sizes in xfs_xmi_item_recover_intent
LOLLM points out that xfs_xmi_item_recover_intent doesn't actually
restore the isize1 and isize2 fields that were recovered from an
unfinished exchmaps log intent item. Instead, xfs_exchmaps_init_intent
sets the wrong isize values from the recovered inodes, with the result
that the file sizes are not set correctly when item recovery finishes.
Fix this by restoring isize[12] from the log item.
Cc: stable@vger.kernel.org # v6.10
Fixes: 966ceafc7a ("xfs: create deferred log items for file mapping exchanges")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
parent
f1930bc578
commit
b71ae66863
|
|
@ -344,7 +344,17 @@ xfs_xmi_validate(
|
|||
if (!xfs_verify_fileext(mp, xlf->xmi_startoff1, xlf->xmi_blockcount))
|
||||
return false;
|
||||
|
||||
return xfs_verify_fileext(mp, xlf->xmi_startoff2, xlf->xmi_blockcount);
|
||||
if (!xfs_verify_fileext(mp, xlf->xmi_startoff2, xlf->xmi_blockcount))
|
||||
return false;
|
||||
|
||||
if (xlf->xmi_flags & XFS_EXCHMAPS_SET_SIZES) {
|
||||
if ((int64_t)xlf->xmi_isize1 < 0)
|
||||
return false;
|
||||
if ((int64_t)xlf->xmi_isize2 < 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -403,6 +413,13 @@ xfs_xmi_item_recover_intent(
|
|||
*ipp1 = ip1;
|
||||
*ipp2 = ip2;
|
||||
xmi = xfs_exchmaps_init_intent(req);
|
||||
|
||||
/* Restore intended file sizes from recovered logged item */
|
||||
if (req->flags & XFS_EXCHMAPS_SET_SIZES) {
|
||||
xmi->xmi_isize1 = xlf->xmi_isize1;
|
||||
xmi->xmi_isize2 = xlf->xmi_isize2;
|
||||
}
|
||||
|
||||
xfs_defer_add_item(dfp, &xmi->xmi_list);
|
||||
return xmi;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user