Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6614775ybe; Wed, 18 Sep 2019 06:26:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqyA7DE8wmrSuv0gLl2Bq9ziRyX10Vi1sMsrS4kqkVKQbDClEJbdZKV+P8XjS0b1iM/9+RVz X-Received: by 2002:a17:906:4910:: with SMTP id b16mr9304752ejq.301.1568813170414; Wed, 18 Sep 2019 06:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568813170; cv=none; d=google.com; s=arc-20160816; b=QJr3XsLqntlcGPD6QTzoWn4QGqHiiNa/TRNMLJVCx6l/IJSadPIh6mYzoyD0I6oRvb 9JobNbDQ6DIgohRUZxLkWJF5ZIxmOcj5uGqzWaFNQTCk0LaUQ1nXLtaZ/fcQ0X4IMDyk iNf2E3U+fsa0XfXnXHlO314/1KhFh4fih4IdvYIXbvaGOlby8Q4xyJIt0rc5mikJWo4R blGh89eoufBiLa1YTiCQcm4GzcQByJ9FwaIRbop18vKEMD/7a7BnUqkiMoW+P9hfKr17 sPPu8GgPfIGc1iSAG7qj6AArjLLDvhGwiw0z/DCrj4ehtZOA4a6MMP8vh98awLVbEZFj D5zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=F8mUBAfbKcYNQWQc6A9wey/4w/8L8IloH/HWlFZzsNw=; b=fDylz9h7kxcut6wfApxV+nSvDSO9O0BHwwsc8SYtg3ewcC7FmsbZZ/MTinzk5rnNO+ l9+9Kj3vC5uHh9auXj/oDKP5+Ke55cMm/ywdR+uz4GNyhWnHC+n7wdXATTpezBoayIEc 0JprY7ZhgSc2fDRU4DewvhxwfhuudSDPWxVqREbIE+2uMDYFFSdz+8QEDZsLDUht1pWv I+KCaJ+iudoGkAHZggPeD3nc5Vto4dhoSziieE7cfIdsPB9kwwMjVc/Ym3tKR3gEBX1J ewYTk42bWvORX38yuU84+kUMOaWHW6GoZGP5G+UoKC0OTMs93hfmond9IePdFakIxEpI Ueaw== 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 z19si954582edr.403.2019.09.18.06.25.44; Wed, 18 Sep 2019 06:26:10 -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 S1727637AbfIRMPE (ORCPT + 99 others); Wed, 18 Sep 2019 08:15:04 -0400 Received: from mx2.suse.de ([195.135.220.15]:52190 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730608AbfIRMPE (ORCPT ); Wed, 18 Sep 2019 08:15:04 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5EAF0AD45; Wed, 18 Sep 2019 12:15:03 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 7810E1E4215; Wed, 18 Sep 2019 12:06:27 +0200 (CEST) Date: Wed, 18 Sep 2019 12:06:27 +0200 From: Jan Kara To: "Theodore Y. Ts'o" Cc: yangerkun , jack@suse.cz, linux-ext4@vger.kernel.org, yi.zhang@huawei.com, houtao1@huawei.com Subject: Re: [PATCH] ext4: fix a bug in ext4_wait_for_tail_page_commit Message-ID: <20190918100627.GB25056@quack2.suse.cz> References: <20190917084814.40370-1-yangerkun@huawei.com> <20190917153140.GF6762@mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190917153140.GF6762@mit.edu> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue 17-09-19 11:31:40, 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)) No, what yangerkun wrote is correct. We don't have to wait for commit when offset == 0 - truncate_inode_pages() should just happily process such page. Also '>' in the above condition is correct. offset == PAGE_SIZE - i_blocksize(inode) means one full block is getting truncated from the page and we need to wait in that case to avoid jbd2_journal_invalidatepage() failing with EBUSY when called from truncate_inode_pages(). Honza -- Jan Kara SUSE Labs, CR