mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
iomap: Set all uptodate bits for an Uptodate page
[ Upstream commit4595a298d5
] 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:9dc55f1389
("iomap: add support for sub-pagesize buffered I/O without buffer heads") Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reported-by: Qian Cai <cai@redhat.com> Cc: Brian Foster <bfoster@redhat.com> Reviewed-by: Gao Xiang <hsiangkao@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
45227ae32f
commit
f691ab24cf
1 changed files with 3 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue