Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4860045imu; Mon, 12 Nov 2018 19:17:13 -0800 (PST) X-Google-Smtp-Source: AJdET5ev6zOY9t7Pmzc+c8NLf7trCmpe81TBrR3NAsVXSemsbNQUZKtfWxlIt9iP02OXI9AqaUy/ X-Received: by 2002:a62:b24a:: with SMTP id x71mr1649939pfe.148.1542079033114; Mon, 12 Nov 2018 19:17:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542079033; cv=none; d=google.com; s=arc-20160816; b=aj3syPRWxfhNDRI3jYylXHtI/bGoIs+JoJs6THAEuSLwzlnP/TKnUQ1ZtVS8Qf5vGC Ztb2aEW4P/vBjAkPGu5D66L1FrRDjNv9YzA7OvHd+fvRcoK6oyfz3lPhAuR7JKUz0p1t whSoNduQIQRULZGMCt3h2AJh2h3mMoC8OEcTPYGDJ+P6l6CCWt/oQiQql+AfzCuyVDJ+ XPF81WTmKslcDMV2ikv4whYW7v/X3X/JrY4LPMDvWvKXFHSfo3kjFkFKaefjH99YTsDM 8EZjYzhlpnh+t9vZMiLuKSQn2k8UBKb0hYaMQkQwBTCfdc7Bv4MKsMEjZRN10uA42Or3 +rSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from; bh=Vg9t1PCUnGMrJaUxl5c3GggJYlgcSbgdtI0XdwjtbJY=; b=imDkeouUHtp4JyfH6X0BJpBiv+H+iSiN1D9wrJ/WASYpFXCk8BmIumpNjMG60Ifti3 zD+fVdKcrdjxfGbWnl5N9HiZSDPJ/daWi1AF1LWbHda6Ia/uhAtJh4LR4AC8vZKfFERH g5Zi18briMHysydbrjgBI1ph9sHGw8SkNZPXSjMTrFB1aUJ3IR8iUGsNYjNGWlD0gN0O 2Y9yp7Db3h5lRXTV91vWe5kXzGg2PJUkJ9sEYPkjHDL+VQ8X/LpGjqDlBQE9ShK69XEr 8IF4edxPuTsNV5CyBDEO/BD7u/iZcvmu6PmcYWQmNQ55bhny3Gd98fvncWtZEcZRTRaP WR5A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 63-v6si21660242pfg.234.2018.11.12.19.16.57; Mon, 12 Nov 2018 19:17:13 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728378AbeKMNMm (ORCPT + 99 others); Tue, 13 Nov 2018 08:12:42 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:15090 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726057AbeKMNMm (ORCPT ); Tue, 13 Nov 2018 08:12:42 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 081E4E6FAECF7; Tue, 13 Nov 2018 11:16:33 +0800 (CST) Received: from [127.0.0.1] (10.134.22.195) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Tue, 13 Nov 2018 11:16:25 +0800 From: Chao Yu Subject: [PATCH] f2fs: avoid GC causing encrypted file corrupted To: Chao Yu , Yunlong Song , , CC: , , , , , References: <1537274393-78441-1-git-send-email-yunlong.song@huawei.com> <19e63fa7-1a48-c1de-eef5-cde242e8300d@kernel.org> Message-ID: <5c3d6053-e03a-8c61-0a07-07d0090ba349@huawei.com> Date: Tue, 13 Nov 2018 11:16:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <19e63fa7-1a48-c1de-eef5-cde242e8300d@kernel.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.134.22.195] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jaegeuk, On 2018/9/18 21:21, Chao Yu wrote: > On 2018/9/18 20:39, Yunlong Song wrote: >> The encrypted file may be corrupted by GC in following case: >> >> Time 1: | segment 1 blkaddr = A | GC -> | segment 2 blkaddr = B | >> Encrypted block 1 is moved from blkaddr A of segment 1 to blkaddr B of >> segment 2, >> >> Time 2: | segment 1 blkaddr = B | GC -> | segment 3 blkaddr = C | >> >> Before page 1 is written back and if segment 2 become a victim, then >> page 1 is moved from blkaddr B of segment 2 to blkaddr Cof segment 3, >> during the GC process of Time 2, f2fs should wait for page 1 written back >> before reading it, or move_data_block will read a garbage block from >> blkaddr B since page is not written back to blkaddr B yet. >> >> Commit 6aa58d8a ("f2fs: readahead encrypted block during GC") introduce >> ra_data_block to read encrypted block, but it forgets to add >> f2fs_wait_on_page_writeback to avoid racing between GC and flush. >> >> Signed-off-by: Yunlong Song > > Reviewed-by: Chao Yu I've reviewed this patch, could you add missing tag in the patch located in dev-test branch? Thanks, > > Thanks, > > . >