Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3793371ybl; Tue, 20 Aug 2019 02:18:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqxmoYXspb7onQFcccBwBH/lTgZqfHMqERZPf1loTDSojLSx5b3IU7HOgfaRpydbX9jnJ7mZ X-Received: by 2002:a63:3009:: with SMTP id w9mr24823594pgw.260.1566292693106; Tue, 20 Aug 2019 02:18:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566292693; cv=none; d=google.com; s=arc-20160816; b=iPhiZz0N+rgU9IcaPE0xortQuG7HrGoLEK5MKshFHdWQB1NjLWqMgC8LrQiM8JA1eF DLWEcyaMFFRPx70G+UjXcE50ujZc4m8rV3W1MW+1P+U0v/VITE4jhz5VUe3nOoHiTtZr zR0SYOIq97ERN11yVFpmSXtG8nHUZcEEnPwV4QMHJmafi7hbyj4eomUse+zSQtuo9w8d lUj5jxPVZx4UceiNpQ+lhfnPm3anbosNi9zwc+QM/MmS4ux7vYND6+6cu/CoJu1xl8xC /qijoYeG7SbteE40mHJCw4LQG9bmBgsrBYfk8Ds1xzAv5qwAA2O07B6hvIAquYd+8vXK jDyA== 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:from:references:cc:to:subject; bh=isMFtwz7KabAHoGlJlcsmxIDUiH5y82m7cI138msfDM=; b=yQzNEuqPXonF6GeGvCtOMhYUgCjDMk/p8+Qdz+9OrBEyW0GCKYdIQ49U/klF+OHbgr AhqAuu2D48g8SGYoLlbM8kHooeg17zT83dUKOCE0sCS9rDjkTblyT1IbWvZv2qDwvEyY 3BlKFNPsmMgcRV242mnztUKDHcbMyu8ssuryVRbgUaGBUPV3spVebdzvhwKpsaUubT6w 62X/2nk7tzwN67vDYuxbWIJv+4mB6coiSwBt52m/R4JOJmDL4mGjoYlOOTnr4GvjBivN 1YtpzJtpRyO4t7O6YRR8W19LFk4g7aYwhWwCpeRmfd45aPD/+7Sd2DT/2LIihIVvBDMp 2lhg== 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 j1si11973360plk.55.2019.08.20.02.17.58; Tue, 20 Aug 2019 02:18:13 -0700 (PDT) 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 S1729356AbfHTJRF (ORCPT + 99 others); Tue, 20 Aug 2019 05:17:05 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:42230 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728414AbfHTJRE (ORCPT ); Tue, 20 Aug 2019 05:17:04 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id BD8848EC234F8254D4D4; Tue, 20 Aug 2019 17:17:02 +0800 (CST) Received: from [10.134.22.195] (10.134.22.195) by smtp.huawei.com (10.3.19.207) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 20 Aug 2019 17:16:59 +0800 Subject: Re: [PATCH] f2fs: fix to avoid data corruption by forbidding SSR overwrite To: Jaegeuk Kim CC: , , References: <20190816030334.81035-1-yuchao0@huawei.com> <3349ceea-85ac-173a-81a4-1188ce3804ca@huawei.com> <20190820010000.GA45681@jaegeuk-macbookpro.roam.corp.google.com> From: Chao Yu Message-ID: <74d1d451-e2a7-dc0f-a218-a05cd4cdcfa8@huawei.com> Date: Tue, 20 Aug 2019 17:16:58 +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: <20190820010000.GA45681@jaegeuk-macbookpro.roam.corp.google.com> Content-Type: text/plain; charset="windows-1252" 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 On 2019/8/20 9:00, Jaegeuk Kim wrote: > On 08/19, Chao Yu wrote: >> On 2019/8/16 11:03, Chao Yu wrote: >>> There is one case can cause data corruption. >>> >>> - write 4k to fileA >>> - fsync fileA, 4k data is writebacked to lbaA >>> - write 4k to fileA >>> - kworker flushs 4k to lbaB; dnode contain lbaB didn't be persisted yet >>> - write 4k to fileB >>> - kworker flush 4k to lbaA due to SSR >>> - SPOR -> dnode with lbaA will be recovered, however lbaA contains fileB's >>> data >>> >>> One solution is tracking all fsynced file's block history, and disallow >>> SSR overwrite on newly invalidated block on that file. >>> >>> However, during recovery, no matter the dnode is flushed or fsynced, all >>> previous dnodes until last fsynced one in node chain can be recovered, >>> that means we need to record all block change in flushed dnode, which >>> will cause heavy cost, so let's just use simple fix by forbidding SSR >>> overwrite directly. >>> >> >> Jaegeuk, >> >> Please help to add below missed tag to keep this patch being merged in stable >> kernel. >> >> Fixes: 5b6c6be2d878 ("f2fs: use SSR for warm node as well") > > Done. Thanks! :) Thanks,