lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-Id: <20240127015825.1608160-23-yi.zhang@huaweicloud.com> Date: Sat, 27 Jan 2024 09:58:21 +0800 From: Zhang Yi <yi.zhang@...weicloud.com> To: linux-ext4@...r.kernel.org Cc: linux-fsdevel@...r.kernel.org, linux-mm@...ck.org, linux-kernel@...r.kernel.org, tytso@....edu, adilger.kernel@...ger.ca, jack@...e.cz, ritesh.list@...il.com, hch@...radead.org, djwong@...nel.org, willy@...radead.org, zokeefe@...gle.com, yi.zhang@...wei.com, yi.zhang@...weicloud.com, chengzhihao1@...wei.com, yukuai3@...wei.com, wangkefeng.wang@...wei.com Subject: [RFC PATCH v3 22/26] ext4: writeback partial blocks before zero range From: Zhang Yi <yi.zhang@...wei.com> If we zero partial blocks, iomap_zero_iter() will skip zeroing out if the srcmap is IOMAP_UNWRITTEN, it works fine in xfs because this type means the block is pure unwritten, doesn't contain any delayed data, but in ext4, IOMAP_UNWRITTEN may contain delayed data. For now we cannot simply change the meaning of this flag in ext4, so just writeback partial blocks from the beginning, make sure it becomes IOMAP_MAPPED before zeroing out. Signed-off-by: Zhang Yi <yi.zhang@...wei.com> --- fs/ext4/extents.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 46805b8e7bdc..cb80c57ccc3d 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -4616,6 +4616,15 @@ static long ext4_zero_range(struct file *file, loff_t offset, if (ret) goto out_mutex; + ret = filemap_write_and_wait_range(mapping, + round_down(offset, 1 << blkbits), offset); + if (ret) + goto out_mutex; + + ret = filemap_write_and_wait_range(mapping, offset + len, + round_up((offset + len), 1 << blkbits)); + if (ret) + goto out_mutex; } /* Zero range excluding the unaligned edges */ -- 2.39.2
Powered by blists - more mailing lists