Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6077399ybe; Tue, 17 Sep 2019 19:40:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyf2U/98Xu74wBEyEMrqyuJCTm784jkwEzWYdYF9ZyRISJCHmhfhxSKUQQqjwWhmhNvx0Dw X-Received: by 2002:a17:906:168f:: with SMTP id s15mr7393439ejd.109.1568774429722; Tue, 17 Sep 2019 19:40:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568774429; cv=none; d=google.com; s=arc-20160816; b=BZ1o/ysZFVn04+unU6P7VSjSVaYpd1VlmPJ1vQGnFH+Bs8jRpjVD2FV2fG1OQrYnsO oOTuUlUrEsSCffyw2LpEpegV3q2OZUBYslZXePTA69sNim6scnomIl7kInZTl1ZgQd8f QzMfogWdhEaYTXSjToqMMxKOX0bvpJkjnVcyKQTyfb7Av7QtQtJq8GOM2k/wybjuCf5e n/Y4uqoFpFCyCRoKCtIZjNtKghmjIwLxx4/sysSNLLc1OpbJk0g5V0c4yc96ma3N9YY/ 0/9qCn5HzsG70nrlOzmw1IboguhlTy8afAofqeFEt8SExWVUOcHbAslu92kRdczGfxa3 RxEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Iw8gSxKAcGqT+uBnW/MzkYMkVAQ3NKgk8i0p34xq/ec=; b=nkvZDdIgdnuYRonvfStqtLeWCdLjEcWN3loe2Z9CEPWH1sm1Twcsx4EErOh66oknIA DhHQq2h6c2904wlBygh6Wbkv9ZD9Wb92BKrMmEfvNH6jjk+kBTYSBJk9URhHGWX4zGQq si9SKBamvQiaaJbXJqQRVr9bHPVNeUt1dFMDRbglj+Oa5xRn3M+BGCvscKYZvvty3/4Y qOxl+KLu28mPqe8YrrgvzWEnk+eVF4JXcII9K5vYqNWECZCKmOU+7YpvOmwr+RCu9KOm AKT0bazaOjx3uXB1j6AV8Epbk4IpC+3b89V3uZZEcZNympxCYnmAXOSnUMS+DcHTasfX zB6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x14si2376999edq.49.2019.09.17.19.40.00; Tue, 17 Sep 2019 19:40:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726363AbfIRBri (ORCPT + 99 others); Tue, 17 Sep 2019 21:47:38 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:2670 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726345AbfIRBrh (ORCPT ); Tue, 17 Sep 2019 21:47:37 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 0845313B549124C17328; Wed, 18 Sep 2019 09:47:36 +0800 (CST) Received: from [127.0.0.1] (10.133.210.141) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.439.0; Wed, 18 Sep 2019 09:47:25 +0800 Subject: Re: [PATCH] ext4: fix a bug in ext4_wait_for_tail_page_commit To: "Theodore Y. Ts'o" CC: , , , References: <20190917084814.40370-1-yangerkun@huawei.com> <20190917153140.GF6762@mit.edu> From: yangerkun Message-ID: <6e4e2ea3-fd92-0b2c-24d9-60b8d67b07a6@huawei.com> Date: Wed, 18 Sep 2019 09:47:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190917153140.GF6762@mit.edu> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.133.210.141] X-CFilter-Loop: Reflected Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 2019/9/17 23:31, Theodore Y. Ts'o wrote: > On Tue, Sep 17, 2019 at 04:48:14PM +0800, yangerkun wrote: >> No need to wait when offset equals to 0. And it will trigger a bug since >> the latter __ext4_journalled_invalidatepage can free the buffers but leave >> page still dirty. > That's only true if the block size == the page size, no? If the > offset is zero and the block size is 1k, we still need to wait. > Shouldn't the better fix be: > >> - if (offset > PAGE_SIZE - i_blocksize(inode)) >> + if (offset >= PAGE_SIZE - i_blocksize(inode)) It can trigger free buffers in __ext4_journalled_invalidatepage(offset==0,blocksize=1k), and we will see the bug again. For some other case, like offset==3k blocksize=1k, actually we should wait the commit, but now we will return directly. Thanks. > - Ted > > . >