Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp350464ybl; Mon, 2 Dec 2019 11:42:36 -0800 (PST) X-Google-Smtp-Source: APXvYqyh8muxtmd8bieRed5iX+sFgh25wGIeRyW6pc0NmlWz9xmuZdUTVasGebgKnsJlVImz1saV X-Received: by 2002:a17:906:3195:: with SMTP id 21mr981558ejy.207.1575315755959; Mon, 02 Dec 2019 11:42:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575315755; cv=none; d=google.com; s=arc-20160816; b=weLls0ihWQdIDwMLem4RAAdwPruOFYZ6Pm5NOezfuwz7CyWgetbUUjiMqiM+0Et7XX +vL8wkpIBI+L72fa6QAExtwD8NggR0cppeR5shtAbG7li6z5clMWL9/m71+bBUScqNZX OWySe8EF2MgMlmjravoPTv5/+hkWrUcCnD3oIkaRINPoDzf1L5+jmh4HN4DZdgrMTkSR xyS9v95+Avff+oTNpow+6nWXmThBhU1Npzq3EsldDD5iUnJaMLcusQvkv9AI0GyZBLPV gIi1e0rgA4nS4q1aMNGkfX9B8pBYkyVdfdHU48LST8YM+UpXeadayPh40lK+U1WVfkcc aO8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=5vrnNPHSVeoy/IsjebKWHPSAuDOiUanCGg42LLJu46g=; b=qgM/W0d00uNH2nZ71jXVYH674d6oHXHuOYI2WhU5FUMTW3nPO7y8pezmp0lYuo6Q7+ fc+/fKEs6b1cOHD8Mb8YXDccFzz1CoEutwcPa4r7v6WjnmAKUGo+SQanXXtmaiqZoi0v CVKbBGn1ASM1NT8nsRli8/8QK8i7jd3NFjAD4cwyN0jbK11cB93hmngyH7kjO5a3kSR/ 7tyMSepL22NQXfGVV3JXYX/I5jmk9kMVAxL/MfrW/waJ2suEE9RA1XYKqd7kAcfm9coB o+rSSyIV9QOwCjZFEUImnRsM1ln7DxwWjZDPz5hszjw4RpK03x3eH/kL2ncTy4cceTBI KLhQ== 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 cb5si325713edb.252.2019.12.02.11.42.11; Mon, 02 Dec 2019 11:42:35 -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 S1728002AbfLBTlP (ORCPT + 99 others); Mon, 2 Dec 2019 14:41:15 -0500 Received: from mx.ewheeler.net ([173.205.220.69]:49709 "EHLO mx.ewheeler.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727927AbfLBTlP (ORCPT ); Mon, 2 Dec 2019 14:41:15 -0500 X-Greylist: delayed 385 seconds by postgrey-1.27 at vger.kernel.org; Mon, 02 Dec 2019 14:41:14 EST Received: from localhost (localhost [127.0.0.1]) by mx.ewheeler.net (Postfix) with ESMTP id 5EF76A0440; Mon, 2 Dec 2019 19:34:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at ewheeler.net Received: from mx.ewheeler.net ([127.0.0.1]) by localhost (mx.ewheeler.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id uRQNVO4LW8_g; Mon, 2 Dec 2019 19:34:23 +0000 (UTC) Received: from mx.ewheeler.net (mx.ewheeler.net [173.205.220.69]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx.ewheeler.net (Postfix) with ESMTPSA id 1F97BA0693; Mon, 2 Dec 2019 19:34:23 +0000 (UTC) Date: Mon, 2 Dec 2019 19:34:12 +0000 (UTC) From: Eric Wheeler X-X-Sender: lists@mx.ewheeler.net To: Coly Li cc: kungf , kent.overstreet@gmail.com, linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bcache: add REQ_FUA to avoid data lost in writeback mode In-Reply-To: <785fe04f-f841-3083-66db-53fab7bc0577@suse.de> Message-ID: References: <20191202102409.3980-1-wings.wyang@gmail.com> <785fe04f-f841-3083-66db-53fab7bc0577@suse.de> User-Agent: Alpine 2.11 (LRH 23 2013-08-11) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-844282404-2137853158-1575315263=:11561" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---844282404-2137853158-1575315263=:11561 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: 8BIT On Mon, 2 Dec 2019, Coly Li wrote: > On 2019/12/2 6:24 下午, kungf wrote: > > data may lost when in the follow scene of writeback mode: > > 1. client write data1 to bcache > > 2. client fdatasync > > 3. bcache flush cache set and backing device > > if now data1 was not writed back to backing, it was only guaranteed safe in cache. > > 4.then cache writeback data1 to backing with only REQ_OP_WRITE > > So data1 was not guaranteed in non-volatile storage, it may lost if power interruption  > > > > Hi, > > Do you encounter such problem in real work load ? With bcache journal, I > don't see the possibility of data lost with your description. > > Correct me if I am wrong. > > Coly Li If this does become necessary, then we should have a sysfs or superblock flag to disable FUA for those with RAID BBUs. -- Eric Wheeler > > Signed-off-by: kungf > > --- > > drivers/md/bcache/writeback.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c > > index 4a40f9eadeaf..e5cecb60569e 100644 > > --- a/drivers/md/bcache/writeback.c > > +++ b/drivers/md/bcache/writeback.c > > @@ -357,7 +357,7 @@ static void write_dirty(struct closure *cl) > > */ > > if (KEY_DIRTY(&w->key)) { > > dirty_init(w); > > - bio_set_op_attrs(&io->bio, REQ_OP_WRITE, 0); > > + bio_set_op_attrs(&io->bio, REQ_OP_WRITE | REQ_FUA, 0); > > io->bio.bi_iter.bi_sector = KEY_START(&w->key); > > bio_set_dev(&io->bio, io->dc->bdev); > > io->bio.bi_end_io = dirty_endio; > > > > ---844282404-2137853158-1575315263=:11561--