Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4616343rwr; Sun, 30 Apr 2023 11:02:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ79DmAc7j1qONK2MGZWsqaThSu7lCJjhnize57CdVMP3hKQRACAasj77zeoXopAJRtiGJaD X-Received: by 2002:a05:6a20:7f84:b0:f6:9492:93a6 with SMTP id d4-20020a056a207f8400b000f6949293a6mr15206804pzj.4.1682877746881; Sun, 30 Apr 2023 11:02:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682877746; cv=none; d=google.com; s=arc-20160816; b=o8gMVH/yhg325jITzZnFX4XtLpcFsy4jqoB7pqErLjYgGX/gzAc6OO5I2sgn02ikOx FrIFqzSlV/LUzHFkNkatiEkEhEkaq4/PDwA3JqmzOSe5s4nYYzBRtHnXQv6ptDbCDxRz 0aq8NjmiNlPugsWuB6tV/yqnbmrYzg0y0kITqebvnOewPVPe7pF6RfBnkzcLLOujusUa lt3bpYZrk6dUofdU5BhZANBO7IMbEuoCyEed0ZhoFGWzdF77FSCroO0j+fLBm55x7BHK apJrovOtf88NMEVETw9m25PbKy5k3U6I4UGAY3oJsLxJ8fl0gC58E8GEMRJd0Zi+1geG FU/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Cfo6Mtxwx/YQNd6YUF27EOglHQTP1AmdHtP9GnLOOJ4=; b=p1BLyTrBgtqOptrht1hgU3L0HSd1KxNKyCmU7MLP6766S35DfXz+IVyxArn7x+hDW3 L5qLARbbhv/wTLC+xNzZhzq6ka/VI3wMv8MjARFjY2ygz8kRvVQ0QBPvBMDBnQfKdnO4 vvf3cZ9wavOf8PeQaoaVaLELRy3FotDXAR3UjlUqQj1naDt9/ghFkeimDvP5u9BUwVlD /y1w0MoxJnDWW2vZzOpvVz0QVP3JPSjrv3vRgm0mShEJgnVP+45+HO57ak1yDNuM82YR DjQoFk7I0fXUNOAz6BwSVduGQ8y6zHPe7btIABp8K74n7lbMMya2mo78GnN9kSj47P5q F/fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mit.edu header.s=outgoing header.b="nN08k/BX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i189-20020a6387c6000000b005181ce2302csi19565294pge.749.2023.04.30.11.02.15; Sun, 30 Apr 2023 11:02:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mit.edu header.s=outgoing header.b="nN08k/BX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231225AbjD3R7p (ORCPT + 99 others); Sun, 30 Apr 2023 13:59:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231153AbjD3R7i (ORCPT ); Sun, 30 Apr 2023 13:59:38 -0400 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00F941997 for ; Sun, 30 Apr 2023 10:59:37 -0700 (PDT) Received: from cwcc.thunk.org (pool-173-48-120-46.bstnma.fios.verizon.net [173.48.120.46]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 33UHx88U016290 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 30 Apr 2023 13:59:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=outgoing; t=1682877551; bh=Cfo6Mtxwx/YQNd6YUF27EOglHQTP1AmdHtP9GnLOOJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nN08k/BXDa+DS88AQwRyryJAIJiF88ubrp1BDzvjNbm+d8R7m4nmdHwSALh/fGCLT OUgf/8l5tB3xTZCbh6tPmZBFITHEmUO93JUlMKe6j4v0syXNppbHgg7kJE3nbzWNDl Qa63ELp+POI7ksQyV6W1bGDXjlCO/O2HhFX9tkFmrbjtssklFqqU7KlQaYYUT8F+F4 PiAVeXaWqDzWN4edQ4Wh1ik3mUWSrSWjH9giFL1o41yTiLlDnmIUzcjxweDzihSDFG uBoIkskpNaQhoqPgMnTFQ8ad5pXHDfuuiZRWVXSFap9izDKlulRepVJK2/o8vgnzB+ 70Au+gov1ikjw== Received: by cwcc.thunk.org (Postfix, from userid 15806) id 855AA15C02E2; Sun, 30 Apr 2023 13:59:08 -0400 (EDT) From: "Theodore Ts'o" To: adilger.kernel@dilger.ca, jack@suse.com, tudor.ambarus@linaro.org, Zhihao Cheng Cc: "Theodore Ts'o" , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, yi.zhang@huawei.com Subject: Re: [PATCH v2] ext4: Fix i_disksize exceeding i_size problem in paritally written case Date: Sun, 30 Apr 2023 13:59:05 -0400 Message-Id: <168287753833.584010.2522737520636014795.b4-ty@mit.edu> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20230321013721.89818-1-chengzhihao1@huawei.com> References: <20230321013721.89818-1-chengzhihao1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 21 Mar 2023 09:37:21 +0800, Zhihao Cheng wrote: > Following process makes i_disksize exceed i_size: > > generic_perform_write > copied = iov_iter_copy_from_user_atomic(len) // copied < len > ext4_da_write_end > | ext4_update_i_disksize > | new_i_size = pos + copied; > | WRITE_ONCE(EXT4_I(inode)->i_disksize, newsize) // update i_disksize > | generic_write_end > | copied = block_write_end(copied, len) // copied = 0 > | if (unlikely(copied < len)) > | if (!PageUptodate(page)) > | copied = 0; > | if (pos + copied > inode->i_size) // return false > if (unlikely(copied == 0)) > goto again; > if (unlikely(iov_iter_fault_in_readable(i, bytes))) { > status = -EFAULT; > break; > } > > [...] Applied, thanks! [1/1] ext4: Fix i_disksize exceeding i_size problem in paritally written case commit: 1dedde690303c05ef732b7c5c8356fdf60a4ade3 Best regards, -- Theodore Ts'o