From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86DEFC433ED for ; Mon, 26 Apr 2021 16:24:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5E1566109E for ; Mon, 26 Apr 2021 16:24:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234437AbhDZQZK (ORCPT ); Mon, 26 Apr 2021 12:25:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:42552 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234174AbhDZQZJ (ORCPT ); Mon, 26 Apr 2021 12:25:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 71B0B6109E; Mon, 26 Apr 2021 16:24:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619454268; bh=/mciGT2r+qLp/iKvtxJFn7ZF3e7aO9Aj7SKL5nmD3h8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GK75p3rD+ioPXfodNXoYViaWoDnK5nKqecFAvQD/2DtW37+DPjS0oMvbjXQzEfOY7 PnzzAQfQ63mqQ41F6vDEGaXPJg7sSunBmFDGAOGeeMiCNuRg+cgRFIL3f3A9ohs/XC 5brC1aud4+a9hzvsVgqaXB8VNMUMBG1ezwz33k1M= Date: Mon, 26 Apr 2021 18:24:25 +0200 From: Greg KH To: Christoph =?iso-8859-1?Q?B=F6hmwalder?= Cc: Lars Ellenberg , stable@vger.kernel.org Subject: Re: [PATCH] drbd: fix potential silent data corruption Message-ID: References: <20210426161708.3447606-1-christoph.boehmwalder@linbit.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210426161708.3447606-1-christoph.boehmwalder@linbit.com> Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Mon, Apr 26, 2021 at 06:17:08PM +0200, Christoph Böhmwalder wrote: > From: Lars Ellenberg > > Scenario: > --------- > > bio chain generated by blk_queue_split(). > Some split bio fails and propagates its error status to the "parent" bio. > But then the (last part of the) parent bio itself completes without error. > > We would clobber the already recorded error status with BLK_STS_OK, > causing silent data corruption. > > Reproducer: > ----------- > > How to trigger this in the real world within seconds: > > DRBD on top of degraded parity raid, > small stripe_cache_size, large read_ahead setting. > Drop page cache (sysctl vm.drop_caches=1, fadvise "DONTNEED", > umount and mount again, "reboot"). > > Cause significant read ahead. > > Large read ahead request is split by blk_queue_split(). > Parts of the read ahead that are already in the stripe cache, > or find an available stripe cache to use, can be serviced. > Parts of the read ahead that would need "too much work", > would need to wait for a "stripe_head" to become available, > are rejected immediately. > > For larger read ahead requests that are split in many pieces, it is very > likely that some "splits" will be serviced, but then the stripe cache is > exhausted/busy, and the remaining ones will be rejected. > > Signed-off-by: Lars Ellenberg > Signed-off-by: Christoph Böhmwalder > Cc: # 4.13.x > --- > drivers/block/drbd/drbd_req.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c > index 9398c2c2cb2d..a384a58de1fd 100644 > --- a/drivers/block/drbd/drbd_req.c > +++ b/drivers/block/drbd/drbd_req.c > @@ -180,7 +180,8 @@ void start_new_tl_epoch(struct drbd_connection *connection) > void complete_master_bio(struct drbd_device *device, > struct bio_and_error *m) > { > - m->bio->bi_status = errno_to_blk_status(m->error); > + if (unlikely(m->error)) > + m->bio->bi_status = errno_to_blk_status(m->error); > bio_endio(m->bio); > dec_ap_bio(device); > } > -- > 2.26.3 > This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html for how to do this properly.