Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp582649imu; Thu, 8 Nov 2018 12:29:39 -0800 (PST) X-Google-Smtp-Source: AJdET5f5x43hEFtBsp3QaaX9/EcqBTaWA87ztaBAywWSF4la81vHp75vpNMtfSbeiCUCZhl5CtwH X-Received: by 2002:a62:d8c3:: with SMTP id e186-v6mr6154505pfg.52.1541708979426; Thu, 08 Nov 2018 12:29:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541708979; cv=none; d=google.com; s=arc-20160816; b=S/yXe/EFOAi87d9yKlCAOqNo4rGmfL/h4vvDzkUxZBcbE6v85aZoCt3vvO92DJwu9z xk34fbY3EF7isEDw7bODsQnkhrY1Wmr+BkwWKxg1S5tDPClUZiEm/469g8/ZBrGSF50A FN+h75MPS0wIhqX6uG7LZX4fiC0tSkVdEpoMdQmhpYTnEXuYRJLshTjPR4jnLtWAFeyA HTMYrPkJ8Ruig5DFVxZvw2+YyM+P0Aceq5WJIESUjzIBR2ZdW/NA/8ZuRtTV9UrWNRyJ MgmPGPS5STg59lPhjnVtOjS8UkXGGuyI8NMvw98fcGOLsMksft5yZiM+wQw6Gdf57GFy hUaA== 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:dkim-signature; bh=HGbZv/L+wKALhoUBJ409tU3OaittkqlYxCQLpDz3UBI=; b=rhTtnDJEUl6TXUw/pZ7JtfYXMCxj626HlCrLadlJyvB7b5QDqb5MpN7LNtwAZmVzeh V0pbrCbqM5aMB2QwpXxsHYyNHb/B6qotosbcSNbX4GCseebkZpaq0j19sWQWNGqXUUF5 pGIls2as39QbRRb/PRLTXYkJ7BocbNOWKyatQOoeEBa791FVZYVRkIhAAv/cNVqp+5jB Wsw5/yzdIAIGZv5cQrhZtnqLwqOcIxg4c6+TdWTANWcs13hymC+F6Wggx52d2JTsQfXs yqNpJlDOQgkURBnz9nFGyt/qQ277/R240Kjkctqs11e9ICdx+mXnkCkd8eQJ32P3zYkJ tAPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tnMWPxQ2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r2si4547393pgo.483.2018.11.08.12.29.22; Thu, 08 Nov 2018 12:29:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tnMWPxQ2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727349AbeKIGEU (ORCPT + 99 others); Fri, 9 Nov 2018 01:04:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:48844 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725723AbeKIGEU (ORCPT ); Fri, 9 Nov 2018 01:04:20 -0500 Received: from localhost (unknown [104.132.0.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 26D0E206BA; Thu, 8 Nov 2018 20:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541708834; bh=hU3eyLPUfBm8DRJuOwjA/Laztv+c5H3c5FB7+MQhafM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tnMWPxQ2lhLwrT4vaUXcCYTdPkJcKByAwUwCzHuda1Si7Hz04h2WAaoDUFhWM7Os7 txXUmPmIcdi8VWW/e3isv6JjgtC2cKuKjV+eaeBS7CHYa3/3YW1erMaiZE6f93Eb/2 ZNHnPfhWhv9Q0xneUNbx7oJRmaD/wO41X2HFN02U= Date: Thu, 8 Nov 2018 12:27:13 -0800 From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: stable@vger.kernel.org Subject: Re: [PATCH] f2fs: wait writeback before reading data to avoid stale encrypted block Message-ID: <20181108202713.GA9862@jaegeuk-macbookpro.roam.corp.google.com> References: <20181107024639.41771-1-jaegeuk@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181107024639.41771-1-jaegeuk@kernel.org> User-Agent: Mutt/1.8.2 (2017-04-18) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Let me drop this, since I missed there was a patch to introdcued this. :) On 11/06, Jaegeuk Kim wrote: > If background GC is running very frequently by gc_urgent, the next GC > can see unwritten data generated by the previous GC, which incurs to write > stale corrupted data in disk. > > Cc: > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/gc.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c > index a07241fb8537..49fea136a3f3 100644 > --- a/fs/f2fs/gc.c > +++ b/fs/f2fs/gc.c > @@ -658,6 +658,9 @@ static int ra_data_block(struct inode *inode, pgoff_t index) > fio.page = page; > fio.new_blkaddr = fio.old_blkaddr = dn.data_blkaddr; > > + /* wait writeback before reading out */ > + f2fs_wait_on_block_writeback(inode, dn.data_blkaddr); > + > fio.encrypted_page = f2fs_pagecache_get_page(META_MAPPING(sbi), > dn.data_blkaddr, > FGP_LOCK | FGP_CREAT, GFP_NOFS); > @@ -755,6 +758,9 @@ static int move_data_block(struct inode *inode, block_t bidx, > fio.page = page; > fio.new_blkaddr = fio.old_blkaddr = dn.data_blkaddr; > > + /* wait writeback before reading out */ > + f2fs_wait_on_block_writeback(inode, fio.old_blkaddr); > + > if (lfs_mode) > down_write(&fio.sbi->io_order_lock); > > -- > 2.19.0.605.g01d371f741-goog