Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2215719/?format=api
{ "id": 2215719, "url": "http://patchwork.ozlabs.org/api/patches/2215719/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260325072850.3997161-7-yi.zhang@huaweicloud.com/", "project": { "id": 8, "url": "http://patchwork.ozlabs.org/api/projects/8/?format=api", "name": "Linux ext4 filesystem development", "link_name": "linux-ext4", "list_id": "linux-ext4.vger.kernel.org", "list_email": "linux-ext4@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260325072850.3997161-7-yi.zhang@huaweicloud.com>", "list_archive_url": null, "date": "2026-03-25T07:28:45", "name": "[v2,06/10] ext4: move ordered data handling out of ext4_block_do_zero_range()", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "feae85f4b4e7d4f4b9ff5a2390a488706ff6cae2", "submitter": { "id": 85428, "url": "http://patchwork.ozlabs.org/api/people/85428/?format=api", "name": "Zhang Yi", "email": "yi.zhang@huaweicloud.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260325072850.3997161-7-yi.zhang@huaweicloud.com/mbox/", "series": [ { "id": 497391, "url": "http://patchwork.ozlabs.org/api/series/497391/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=497391", "date": "2026-03-25T07:28:44", "name": "ext4: refactor partial block zero-out for iomap conversion", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/497391/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2215719/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2215719/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <SRS0=zdrv=BZ=vger.kernel.org=linux-ext4+bounces-15328-patchwork-incoming=ozlabs.org@ozlabs.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-ext4@vger.kernel.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "patchwork-incoming@ozlabs.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=zdrv=bz=vger.kernel.org=linux-ext4+bounces-15328-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)", "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c0a:e001:db::12fc:5321\"\n arc.chain=subspace.kernel.org", "gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com", "gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15328-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=45.249.212.51", "smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=huaweicloud.com" ], "Received": [ "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fgdvz3wtQz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 18:34:39 +1100 (AEDT)", "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4fgdvz3T4Gz4wCB\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 18:34:39 +1100 (AEDT)", "by gandalf.ozlabs.org (Postfix)\n\tid 4fgdvz3PBJz4wCG; Wed, 25 Mar 2026 18:34:39 +1100 (AEDT)", "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4fgdvw0zdZz4wCB\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 25 Mar 2026 18:34:36 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 6B1F430467F2\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 25 Mar 2026 07:33:47 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 6413C366565;\n\tWed, 25 Mar 2026 07:33:45 +0000 (UTC)", "from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com\n [45.249.212.51])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id E51AA29DB9A;\n\tWed, 25 Mar 2026 07:33:41 +0000 (UTC)", "from mail.maildlp.com (unknown [172.19.163.198])\n\tby dggsgout11.his.huawei.com (SkyGuard) with ESMTPS id 4fgdtd4xx2zYQtyD;\n\tWed, 25 Mar 2026 15:33:29 +0800 (CST)", "from mail02.huawei.com (unknown [10.116.40.112])\n\tby mail.maildlp.com (Postfix) with ESMTP id A855C40575;\n\tWed, 25 Mar 2026 15:33:39 +0800 (CST)", "from huaweicloud.com (unknown [10.50.85.155])\n\tby APP1 (Coremail) with SMTP id cCh0CgAHC9vFj8NpuR6cCA--.49898S10;\n\tWed, 25 Mar 2026 15:33:39 +0800 (CST)" ], "ARC-Seal": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1774424079; cv=pass;\n\tb=km1O8UQ0Vz1NuMVNECWldym81jTT31C+fU3h7xeLTKWIBMQBIl6oZfAa8OqYOjqiD6Y18Mf9Lo+Fg9OsB/+pPSXGJFVt3mVKJYdFKz+Vhm6JnjmpbGFbn5Y6eWyyEOxHtV9h24W5KKvX1OqUtJ52Rb/NVpK4D/zF8lvfRpwWHjNuzkAS/OKcOXhsYCb1F9LxMGzKpS6myM3l5ibhGhCJ6x0PT4SfGaoIcCDDZAOI8hYNrN4IovocPuJyE75H9l8C/RL/eWns1pumT9QJqvt78uYjo7ZzcEVR/BKi+PLT/7QkPPZVvHsGc+yQSKjIoNhajGYTtg75VtnkdShUeZJx1g==", "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774424025; cv=none;\n b=ouY/biHFgBb+wJxwe9WFIVBP7hW/jtbHxjVsDLxFSZNpDncsUYuLlu+jXcZKgtlJo9kCci6QD6aA3jE1dlcFCrnj8AT5pEejFN6vl9YaSugciOdRSLXkui2+mmZCv2UjHugyNEE6CHkG/Hw9b1QbeokNBlaFRiD5paL7m77hMdU=" ], "ARC-Message-Signature": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1774424079; c=relaxed/relaxed;\n\tbh=eFlvx3AtFcAGCn7Oj+aT4tGOTefbuzLHhcGElp3Z9S8=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=LF4rhWH2hrEORzSu5bXpfkE6Pl8k9WrwFKV6Y7vzUxRRfvJZvNqbd+IR8an5yu+VDHbTPGKrRJUGAvJS3GwgNbcEFsHZbLX84/DrYX+85tzJSH0nARyA6omqf+Y/eZJYmMXuUG5bsDGjne9Tbjnpp0aOsRT0DhyaUX0O6uFl9gqi16l127B/sn9l0pHU/CDLEMkbhN0QRCkVB+IRKgiOrplTf58iYImV3EE1dGowuIJQn+BNP3g/LB5FiZaaIm+5lwjZvwXXUJZIy6d5Z1KYhbXW5orK+SAgqWAFmnnVEcrvOtuElzL+C22NSBYYmqnm6y570HLulHfe9OsG9//rYg==", "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774424025; c=relaxed/simple;\n\tbh=qhFN2bCOzBgZ9v8bC8E3wmoJrGkmrk/3g2zXJggQBsg=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=h1fti3g/mDPTsx6D7L5WxHpOFwaYr1aIsTfrvJvlMSPICG+E3NANXQeoXxtXx7mgTRqTh4rdmhHuIBpfCdRdV+4HqpVZeYbLt3wuRTAlpLW4f/NdOws0a+jqRXBrUVOvBDxvBuudRAlekn+S3LwWoy/lPD6J8q/gZBj8KDifGqo=" ], "ARC-Authentication-Results": [ "i=2; gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com;\n spf=pass (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15328-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org", "i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com;\n spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51" ], "From": "Zhang Yi <yi.zhang@huaweicloud.com>", "To": "linux-ext4@vger.kernel.org", "Cc": "linux-fsdevel@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\ttytso@mit.edu,\n\tadilger.kernel@dilger.ca,\n\tjack@suse.cz,\n\tojaswin@linux.ibm.com,\n\tritesh.list@gmail.com,\n\tlibaokun@linux.alibaba.com,\n\tyi.zhang@huawei.com,\n\tyi.zhang@huaweicloud.com,\n\tyizhang089@gmail.com,\n\tyangerkun@huawei.com,\n\tyukuai@fnnas.com", "Subject": "[PATCH v2 06/10] ext4: move ordered data handling out of\n ext4_block_do_zero_range()", "Date": "Wed, 25 Mar 2026 15:28:45 +0800", "Message-ID": "<20260325072850.3997161-7-yi.zhang@huaweicloud.com>", "X-Mailer": "git-send-email 2.52.0", "In-Reply-To": "<20260325072850.3997161-1-yi.zhang@huaweicloud.com>", "References": "<20260325072850.3997161-1-yi.zhang@huaweicloud.com>", "Precedence": "bulk", "X-Mailing-List": "linux-ext4@vger.kernel.org", "List-Id": "<linux-ext4.vger.kernel.org>", "List-Subscribe": "<mailto:linux-ext4+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-ext4+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-CM-TRANSID": "cCh0CgAHC9vFj8NpuR6cCA--.49898S10", "X-Coremail-Antispam": "1UD129KBjvJXoW3JF1UCFy8ZrW5Cr1ktr1UKFg_yoW7tF1xpF\n\ty5K345Cr47Wr9F9Fs7AF17XF1ak3WfGFW8WFW7Gr9Yv3yaqwn7KFyUKryFvF4Yq3y3W3W0\n\tqF4Ut34jg3W7AaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n\t9KBjDU0xBIdaVrnRJUUUmI14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0\n\trVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI\n\tkIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2\n\tz4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F\n\t4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq\n\t3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7\n\tIYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U\n\tM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2\n\tkIc2xKxwCY1x0262kKe7AKxVWUtVW8ZwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkE\n\tbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67\n\tAF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUCVW8JwCI\n\t42IY6xIIjxv20xvEc7CjxVAFwI0_Cr0_Gr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCw\n\tCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnI\n\tWIevJa73UjIFyTuYvjfUriihUUUUU", "X-CM-SenderInfo": "d1lo6xhdqjqx5xdzvxpfor3voofrz/", "X-Spam-Status": "No, score=-1.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDMARC_MISSING,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,\n\tSPF_HELO_NONE,SPF_PASS autolearn=disabled version=4.0.1", "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org" }, "content": "From: Zhang Yi <yi.zhang@huawei.com>\n\nRemove the handle parameter from ext4_block_do_zero_range() and move the\nordered data handling to ext4_block_zero_eof().\n\nThis is necessary for truncate up and append writes across a range\nextending beyond EOF. The ordered data must be committed before updating\ni_disksize to prevent exposing stale on-disk data from concurrent\npost-EOF mmap writes during previous folio writeback or in case of\nsystem crash during append writes.\n\nThis is unnecessary for partial block hole punching because the entire\npunch operation does not provide atomicity guarantees and can already\nexpose intermediate results in case of crash.\n\nHole punching can only ever expose data that was there before the punch\nbut missed zeroing during append / truncate could expose data that was\nnot visible in the file before the operation.\n\nSince ordered data handling is no longer performed inside\next4_zero_partial_blocks(), ext4_punch_hole() no longer needs to attach\njinode.\n\nThis is prepared for the conversion to the iomap infrastructure, which\ndoes not use ordered data mode while zeroing post-EOF partial blocks.\n\nSigned-off-by: Zhang Yi <yi.zhang@huawei.com>\nReviewed-by: Jan Kara <jack@suse.cz>\n---\n fs/ext4/inode.c | 58 ++++++++++++++++++++++++-------------------------\n 1 file changed, 29 insertions(+), 29 deletions(-)", "diff": "diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c\nindex 3c3c07fd00ba..84dd3140793d 100644\n--- a/fs/ext4/inode.c\n+++ b/fs/ext4/inode.c\n@@ -4075,12 +4075,12 @@ static struct buffer_head *ext4_load_tail_bh(struct inode *inode, loff_t from)\n \treturn err ? ERR_PTR(err) : NULL;\n }\n \n-static int ext4_block_do_zero_range(handle_t *handle, struct inode *inode,\n-\t\t\t\t loff_t from, loff_t length, bool *did_zero)\n+static int ext4_block_do_zero_range(struct inode *inode, loff_t from,\n+\t\t\t\t loff_t length, bool *did_zero,\n+\t\t\t\t bool *zero_written)\n {\n \tstruct buffer_head *bh;\n \tstruct folio *folio;\n-\tint err = 0;\n \n \tbh = ext4_load_tail_bh(inode, from);\n \tif (IS_ERR_OR_NULL(bh))\n@@ -4091,19 +4091,14 @@ static int ext4_block_do_zero_range(handle_t *handle, struct inode *inode,\n \tBUFFER_TRACE(bh, \"zeroed end of block\");\n \n \tmark_buffer_dirty(bh);\n-\t/*\n-\t * Only the written block requires ordered data to prevent exposing\n-\t * stale data.\n-\t */\n-\tif (ext4_should_order_data(inode) &&\n-\t !buffer_unwritten(bh) && !buffer_delay(bh))\n-\t\terr = ext4_jbd2_inode_add_write(handle, inode, from, length);\n-\tif (!err && did_zero)\n+\tif (did_zero)\n \t\t*did_zero = true;\n+\tif (zero_written && !buffer_unwritten(bh) && !buffer_delay(bh))\n+\t\t*zero_written = true;\n \n \tfolio_unlock(folio);\n \tfolio_put(folio);\n-\treturn err;\n+\treturn 0;\n }\n \n static int ext4_block_journalled_zero_range(handle_t *handle,\n@@ -4147,7 +4142,8 @@ static int ext4_block_journalled_zero_range(handle_t *handle,\n * that corresponds to 'from'\n */\n static int ext4_block_zero_range(handle_t *handle, struct inode *inode,\n-\t\t\t\t loff_t from, loff_t length, bool *did_zero)\n+\t\t\t\t loff_t from, loff_t length, bool *did_zero,\n+\t\t\t\t bool *zero_written)\n {\n \tunsigned blocksize = inode->i_sb->s_blocksize;\n \tunsigned int max = blocksize - (from & (blocksize - 1));\n@@ -4166,7 +4162,8 @@ static int ext4_block_zero_range(handle_t *handle, struct inode *inode,\n \t\treturn ext4_block_journalled_zero_range(handle, inode, from,\n \t\t\t\t\t\t\tlength, did_zero);\n \t}\n-\treturn ext4_block_do_zero_range(handle, inode, from, length, did_zero);\n+\treturn ext4_block_do_zero_range(inode, from, length, did_zero,\n+\t\t\t\t\tzero_written);\n }\n \n /*\n@@ -4183,6 +4180,7 @@ int ext4_block_zero_eof(handle_t *handle, struct inode *inode,\n \tunsigned int offset;\n \tloff_t length = end - from;\n \tbool did_zero = false;\n+\tbool zero_written = false;\n \tint err;\n \n \toffset = from & (blocksize - 1);\n@@ -4195,9 +4193,22 @@ int ext4_block_zero_eof(handle_t *handle, struct inode *inode,\n \tif (length > blocksize - offset)\n \t\tlength = blocksize - offset;\n \n-\terr = ext4_block_zero_range(handle, inode, from, length, &did_zero);\n+\terr = ext4_block_zero_range(handle, inode, from, length,\n+\t\t\t\t &did_zero, &zero_written);\n \tif (err)\n \t\treturn err;\n+\t/*\n+\t * It's necessary to order zeroed data before update i_disksize when\n+\t * truncating up or performing an append write, because there might be\n+\t * exposing stale on-disk data which may caused by concurrent post-EOF\n+\t * mmap write during folio writeback.\n+\t */\n+\tif (ext4_should_order_data(inode) &&\n+\t did_zero && zero_written && !IS_DAX(inode)) {\n+\t\terr = ext4_jbd2_inode_add_write(handle, inode, from, length);\n+\t\tif (err)\n+\t\t\treturn err;\n+\t}\n \n \treturn did_zero ? length : 0;\n }\n@@ -4221,13 +4232,13 @@ int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode,\n \tif (start == end &&\n \t (partial_start || (partial_end != sb->s_blocksize - 1))) {\n \t\terr = ext4_block_zero_range(handle, inode, lstart,\n-\t\t\t\t\t length, NULL);\n+\t\t\t\t\t length, NULL, NULL);\n \t\treturn err;\n \t}\n \t/* Handle partial zero out on the start of the range */\n \tif (partial_start) {\n \t\terr = ext4_block_zero_range(handle, inode, lstart,\n-\t\t\t\t\t sb->s_blocksize, NULL);\n+\t\t\t\t\t sb->s_blocksize, NULL, NULL);\n \t\tif (err)\n \t\t\treturn err;\n \t}\n@@ -4235,7 +4246,7 @@ int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode,\n \tif (partial_end != sb->s_blocksize - 1)\n \t\terr = ext4_block_zero_range(handle, inode,\n \t\t\t\t\t byte_end - partial_end,\n-\t\t\t\t\t partial_end + 1, NULL);\n+\t\t\t\t\t partial_end + 1, NULL, NULL);\n \treturn err;\n }\n \n@@ -4410,17 +4421,6 @@ int ext4_punch_hole(struct file *file, loff_t offset, loff_t length)\n \t\tend = max_end;\n \tlength = end - offset;\n \n-\t/*\n-\t * Attach jinode to inode for jbd2 if we do any zeroing of partial\n-\t * block.\n-\t */\n-\tif (!IS_ALIGNED(offset | end, sb->s_blocksize)) {\n-\t\tret = ext4_inode_attach_jinode(inode);\n-\t\tif (ret < 0)\n-\t\t\treturn ret;\n-\t}\n-\n-\n \tret = ext4_update_disksize_before_punch(inode, offset, length);\n \tif (ret)\n \t\treturn ret;\n", "prefixes": [ "v2", "06/10" ] }