Patch "xfs: only remap the written blocks in xfs_reflink_end_cow_extent" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    xfs: only remap the written blocks in xfs_reflink_end_cow_extent

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     xfs-only-remap-the-written-blocks-in-xfs_reflink_end.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 88759c80d3e673e75ed46cd283b090db16d0564a
Author: Christoph Hellwig <hch@xxxxxx>
Date:   Thu Feb 8 15:20:46 2024 -0800

    xfs: only remap the written blocks in xfs_reflink_end_cow_extent
    
    commit 55f669f34184ecb25b8353f29c7f6f1ae5b313d1 upstream.
    
    xfs_reflink_end_cow_extent looks up the COW extent and the data fork
    extent at offset_fsb, and then proceeds to remap the common subset
    between the two.
    
    It does however not limit the remapped extent to the passed in
    [*offset_fsbm end_fsb] range and thus potentially remaps more blocks than
    the one handled by the current I/O completion.  This means that with
    sufficiently large data and COW extents we could be remapping COW fork
    mappings that have not been written to, leading to a stale data exposure
    on a powerfail event.
    
    We use to have a xfs_trim_range to make the remap fit the I/O completion
    range, but that got (apparently accidentally) removed in commit
    df2fd88f8ac7 ("xfs: rewrite xfs_reflink_end_cow to use intents").
    
    Note that I've only found this by code inspection, and a test case would
    probably require very specific delay and error injection.
    
    Fixes: df2fd88f8ac7 ("xfs: rewrite xfs_reflink_end_cow to use intents")
    Signed-off-by: Christoph Hellwig <hch@xxxxxx>
    Reviewed-by: "Darrick J. Wong" <djwong@xxxxxxxxxx>
    Signed-off-by: Chandan Babu R <chandanbabu@xxxxxxxxxx>
    Signed-off-by: Catherine Hoang <catherine.hoang@xxxxxxxxxx>
    Acked-by: Chandan Babu R <chandanbabu@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 658edee8381d..e5b62dc28466 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -784,6 +784,7 @@ xfs_reflink_end_cow_extent(
 		}
 	}
 	del = got;
+	xfs_trim_extent(&del, *offset_fsb, end_fsb - *offset_fsb);
 
 	/* Grab the corresponding mapping in the data fork. */
 	nmaps = 1;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux