get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2215728/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2215728,
    "url": "http://patchwork.ozlabs.org/api/patches/2215728/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260325072850.3997161-11-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-11-yi.zhang@huaweicloud.com>",
    "list_archive_url": null,
    "date": "2026-03-25T07:28:49",
    "name": "[v2,10/10] ext4: zero post-EOF partial block before appending write",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "86822cd70bd393dac575cdd44b0dfbf35151dc03",
    "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-11-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/2215728/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2215728/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <SRS0=l/bm=BZ=vger.kernel.org=linux-ext4+bounces-15336-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=150.107.74.76; helo=mail.ozlabs.org;\n envelope-from=srs0=l/bm=bz=vger.kernel.org=linux-ext4+bounces-15336-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)",
            "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c04:e001:36c::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:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15336-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=45.249.212.56",
            "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 (gandalf.ozlabs.org [150.107.74.76])\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 4fgdyv2R6qz1y1G\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 18:37:11 +1100 (AEDT)",
            "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4fgdyv1vYSz4wCG\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 18:37:11 +1100 (AEDT)",
            "by gandalf.ozlabs.org (Postfix)\n\tid 4fgdyv1rSfz4wF0; Wed, 25 Mar 2026 18:37:11 +1100 (AEDT)",
            "from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::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 4fgdyq5l89z4wCG\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 25 Mar 2026 18:37:07 +1100 (AEDT)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 9F845303F55A\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 25 Mar 2026 07:34:31 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id AB99B379EDF;\n\tWed, 25 Mar 2026 07:33:54 +0000 (UTC)",
            "from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com\n [45.249.212.56])\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 E4E92374E6C;\n\tWed, 25 Mar 2026 07:33:50 +0000 (UTC)",
            "from mail.maildlp.com (unknown [172.19.163.198])\n\tby dggsgout12.his.huawei.com (SkyGuard) with ESMTPS id 4fgdt54W5lzKHMZw;\n\tWed, 25 Mar 2026 15:33:01 +0800 (CST)",
            "from mail02.huawei.com (unknown [10.116.40.112])\n\tby mail.maildlp.com (Postfix) with ESMTP id F32EC40539;\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--.49898S14;\n\tWed, 25 Mar 2026 15:33:39 +0800 (CST)"
        ],
        "ARC-Seal": [
            "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1774424231; cv=pass;\n\tb=SN5LDlkJDE7ruMmosJV+wTzo1qcOsGqTUN4Yfgidh2V8srSrHeFGvzW89Ou7V7eiBEPfYAdch7LiW9fDMMT+bag/nbR5YTazCttMB5qUoGyhtrgZNVx3jaxeHhEv5/iaM64nc/zrbJ0LAeh7Pr3SeT4oqpM4iPZTVj1CaJNRpSGZ1CxES+3lO+ZiDNvG/M2U5xfR3PaxLgzB1fd96zuRq8nlEYrGDqIHJpc9V2YGULamN/cAmD0/yUiZ1RXclu27oG5nkl8RsnuKQr/H4COAYCj4BkS/7ASePGjIfzA+nq9ACj26MkthvLvJ4JSaN6X761JP9VRh7p2AjfDE/BDt3A==",
            "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774424034; cv=none;\n b=P2eYOMB33uXI3z9Mto7PoUDRje4aR9vw+yIG6NbrXwvTzADtY30yImGgH3UPBh5Wu2pjqSHrGfhNHJggG0JgzcRez0xUcinXlz67kLuKw6m4DsW6Y7hZ+cCwk46e1vlVu+JtaXUQSlrOay0/zaFHWh9gWAk5BhHzPKgvJyNv6jM="
        ],
        "ARC-Message-Signature": [
            "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1774424231; c=relaxed/relaxed;\n\tbh=a0IT2ENqC2GJvKv/olh4wT1J7ix6fkwzCkxmpUAdl6g=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=QJ0qyzWMeMO7rLf0WGNvEyJcwSpR9UN6l1m+1cEZvxaz1gmXQsTpzCSmFJdi+IUnNpLNyaPW9C0v5kpyco+y8wYsWklC3QtilY+M0y+HtENpUapa5hZELno6sJ/HFK5sexFTWxdX5C6lUxDvRrHzdBfgBhA9LqxjlQfYN/S323BYU11nupKKkYMdepIpiUyfZiI/T0mkwaf2KbyP10CHEHOTiODTS8vW8yXUup89TKZpkqvFlHuW/GnbBmwR7XrwuDgiu7tqmFm/gDwTOhuWEqLKfTrS9GBxnjbRXnyA3xKi7WlDFTyqcCamIm2gtvpZUTSME2GmI4PGcsfQUyIn0A==",
            "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774424034; c=relaxed/simple;\n\tbh=T5rWW1i7HG6tg/wuxYxYjvwLy+YvzaEM/Du4AE7QwB8=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=CpxCe2CKezG3nc/mpGcuL6IYIJtFsc890C8BQ3EXbDyglHJ6kk6Cuo97psayXRjXUSB0sJdCNxnlZe5o8jVf3sfpScqzvE92yzPTFaktDKIGzbaP7KTZQJwlune8T7VBTRYnyXk39mXyBHKNrl+GrHJSiwCKq8Q/nkfQw3ZBP3k="
        ],
        "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:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15336-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.56"
        ],
        "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 10/10] ext4: zero post-EOF partial block before appending\n write",
        "Date": "Wed, 25 Mar 2026 15:28:49 +0800",
        "Message-ID": "<20260325072850.3997161-11-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--.49898S14",
        "X-Coremail-Antispam": "1UD129KBjvJXoWxGrW8WrWrtryxZr17AF17GFg_yoWrWryDpF\n\tZIkF1fuwnFgr9rWrWxKFsrZ34jka48JrW7GFyfKrWrZFnxJw18KF12q34UtFW5trZrXa1F\n\tqF4qkFy8G3Wjy3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n\t9KBjDU0xBIdaVrnRJUUUmS14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0\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_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVW8JVW5JwCI\n\t42IY6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF\n\t4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8Jr0_Cr1UYxBI\n\tdaVFxhVjvjDU0xZFpf9x0JUWMKtUUUUU=",
        "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\nIn cases of appending write beyond EOF, ext4_zero_partial_blocks() is\ncalled within ext4_*_write_end() to zero out the partial block beyond\nEOF. This prevents exposing stale data that might be written through\nmmap.\n\nHowever, supporting only the regular buffered write path is\ninsufficient. It is also necessary to support the DAX path as well as\nthe upcoming iomap buffered write path. Therefore, move this operation\nto ext4_write_checks().\n\nIn addition, this may introduce a race window in which a post-EOF\nbuffered write can race with an mmap write after the old EOF block has\nbeen zeroed. As a result, the data in this block written by the\nbuffer-write and the data written by the mmap-write may be mixed.\nHowever, this is safe because users should not rely on the result of the\nrace condition.\n\nSigned-off-by: Zhang Yi <yi.zhang@huawei.com>\nReviewed-by: Jan Kara <jack@suse.cz>\n---\n fs/ext4/file.c  | 14 ++++++++++++++\n fs/ext4/inode.c | 21 +++++++--------------\n 2 files changed, 21 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/fs/ext4/file.c b/fs/ext4/file.c\nindex f1dc5ce791a7..b2e44601ab6a 100644\n--- a/fs/ext4/file.c\n+++ b/fs/ext4/file.c\n@@ -271,6 +271,8 @@ static ssize_t ext4_generic_write_checks(struct kiocb *iocb,\n \n static ssize_t ext4_write_checks(struct kiocb *iocb, struct iov_iter *from)\n {\n+\tstruct inode *inode = file_inode(iocb->ki_filp);\n+\tloff_t old_size = i_size_read(inode);\n \tssize_t ret, count;\n \n \tcount = ext4_generic_write_checks(iocb, from);\n@@ -280,6 +282,18 @@ static ssize_t ext4_write_checks(struct kiocb *iocb, struct iov_iter *from)\n \tret = file_modified(iocb->ki_filp);\n \tif (ret)\n \t\treturn ret;\n+\n+\t/*\n+\t * If the position is beyond the EOF, it is necessary to zero out the\n+\t * partial block that beyond the existing EOF, as it may contains\n+\t * stale data written through mmap.\n+\t */\n+\tif (iocb->ki_pos > old_size && !ext4_verity_in_progress(inode)) {\n+\t\tret = ext4_block_zero_eof(inode, old_size, iocb->ki_pos);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t}\n+\n \treturn count;\n }\n \ndiff --git a/fs/ext4/inode.c b/fs/ext4/inode.c\nindex 530197a53208..1479ff56f7d0 100644\n--- a/fs/ext4/inode.c\n+++ b/fs/ext4/inode.c\n@@ -1456,10 +1456,9 @@ static int ext4_write_end(const struct kiocb *iocb,\n \tfolio_unlock(folio);\n \tfolio_put(folio);\n \n-\tif (old_size < pos && !verity) {\n+\tif (old_size < pos && !verity)\n \t\tpagecache_isize_extended(inode, old_size, pos);\n-\t\text4_block_zero_eof(inode, old_size, pos);\n-\t}\n+\n \t/*\n \t * Don't mark the inode dirty under folio lock. First, it unnecessarily\n \t * makes the holding time of folio lock longer. Second, it forces lock\n@@ -1574,10 +1573,8 @@ static int ext4_journalled_write_end(const struct kiocb *iocb,\n \tfolio_unlock(folio);\n \tfolio_put(folio);\n \n-\tif (old_size < pos && !verity) {\n+\tif (old_size < pos && !verity)\n \t\tpagecache_isize_extended(inode, old_size, pos);\n-\t\text4_block_zero_eof(inode, old_size, pos);\n-\t}\n \n \tif (size_changed) {\n \t\tret2 = ext4_mark_inode_dirty(handle, inode);\n@@ -3196,7 +3193,7 @@ static int ext4_da_do_write_end(struct address_space *mapping,\n \tstruct inode *inode = mapping->host;\n \tloff_t old_size = inode->i_size;\n \tbool disksize_changed = false;\n-\tloff_t new_i_size, zero_len = 0;\n+\tloff_t new_i_size;\n \thandle_t *handle;\n \n \tif (unlikely(!folio_buffers(folio))) {\n@@ -3240,19 +3237,15 @@ static int ext4_da_do_write_end(struct address_space *mapping,\n \tfolio_unlock(folio);\n \tfolio_put(folio);\n \n-\tif (pos > old_size) {\n+\tif (pos > old_size)\n \t\tpagecache_isize_extended(inode, old_size, pos);\n-\t\tzero_len = pos - old_size;\n-\t}\n \n-\tif (!disksize_changed && !zero_len)\n+\tif (!disksize_changed)\n \t\treturn copied;\n \n-\thandle = ext4_journal_start(inode, EXT4_HT_INODE, 2);\n+\thandle = ext4_journal_start(inode, EXT4_HT_INODE, 1);\n \tif (IS_ERR(handle))\n \t\treturn PTR_ERR(handle);\n-\tif (zero_len)\n-\t\text4_block_zero_eof(inode, old_size, pos);\n \text4_mark_inode_dirty(handle, inode);\n \text4_journal_stop(handle);\n \n",
    "prefixes": [
        "v2",
        "10/10"
    ]
}