Patch "iomap: Set all uptodate bits for an Uptodate page" has been added to the 5.4-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

    iomap: Set all uptodate bits for an Uptodate page

to the 5.4-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:
     iomap-set-all-uptodate-bits-for-an-uptodate-page.patch
and it can be found in the queue-5.4 subdirectory.

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



commit fbe35689c5acb3f4be7bcfe68e179efd4334a4aa
Author: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
Date:   Fri Sep 25 11:16:53 2020 -0700

    iomap: Set all uptodate bits for an Uptodate page
    
    [ Upstream commit 4595a298d5563cf76c1d852970f162051fd1a7a6 ]
    
    For filesystems with block size < page size, we need to set all the
    per-block uptodate bits if the page was already uptodate at the time
    we create the per-block metadata.  This can happen if the page is
    invalidated (eg by a write to drop_caches) but ultimately not removed
    from the page cache.
    
    This is a data corruption issue as page writeback skips blocks which
    are marked !uptodate.
    
    Fixes: 9dc55f1389f9 ("iomap: add support for sub-pagesize buffered I/O without buffer heads")
    Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
    Reported-by: Qian Cai <cai@xxxxxxxxxx>
    Cc: Brian Foster <bfoster@xxxxxxxxxx>
    Reviewed-by: Gao Xiang <hsiangkao@xxxxxxxxxx>
    Reviewed-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
    Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
    Reviewed-by: Christoph Hellwig <hch@xxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 53cd7b2bb580b..c28ba474a25e7 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -23,6 +23,7 @@ static struct iomap_page *
 iomap_page_create(struct inode *inode, struct page *page)
 {
 	struct iomap_page *iop = to_iomap_page(page);
+	unsigned int nr_blocks = PAGE_SIZE / i_blocksize(inode);
 
 	if (iop || i_blocksize(inode) == PAGE_SIZE)
 		return iop;
@@ -32,6 +33,8 @@ iomap_page_create(struct inode *inode, struct page *page)
 	atomic_set(&iop->write_count, 0);
 	spin_lock_init(&iop->uptodate_lock);
 	bitmap_zero(iop->uptodate, PAGE_SIZE / SECTOR_SIZE);
+	if (PageUptodate(page))
+		bitmap_fill(iop->uptodate, nr_blocks);
 
 	/*
 	 * migrate_page_move_mapping() assumes that pages with private data have




[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