Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp8634586pxu; Sun, 27 Dec 2020 14:00:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNtChZIX54wcnNX6DeHpTqULilSjNIG2+kdfUVJyI4q577fNF8RbiYnJXoej66zpl0sxzN X-Received: by 2002:a17:906:add7:: with SMTP id lb23mr41422986ejb.352.1609106414555; Sun, 27 Dec 2020 14:00:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609106414; cv=none; d=google.com; s=arc-20160816; b=k6iqUScdJWBv0y5ukrXUZVR1b/GPUuxK8TqeDFGegodyzVQxcvBp5bLy6tIzMobgXH hRznPCMfiG/UhwYIcAuxNaotdCNuFTD/zkpskZssyU0qDKCu+OyDr+TK7pvDssJ0ITsU mKBXzS2GvfTwx64pR7n90pVOe/rPn7r9emNBq1Kxe7LDP8PRRhq91VO39Cxffh+1nSw8 4ZOQNx+UR700b8xohSRTdSUKu1ZbUUUUwi6fPiI2xWTFZKJ6juqEmXUeCzK1keh0Ww7m hNdBFNFThHadxisBiCiEbdE6AGXqtw66ua+YYco9HtkaEaHom3D/P4mQqIXmfSHk+b87 ASVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=TZGwr38xDshaEyznDYmDhUJkniF++juH9IoMu8nm3sI=; b=DzyOlKvs9/1bL3vpA3o/7dGPM+VZZPrA5uGp8XfxVrwyvbySwI+zwFw4x01eeeKWam tAeeHgH1YkaPJekDuTxJIVlEL3zIE2suTand8rBag3IAdCpgZB5mMoxu+438NTXpGy3m O3MNkTHA8zPkai+qn09xR8O+Hm9CMtqf0F42Z7QgVL9/vhjBSnkcUtotju4HO0UVQMBo 4ak+ey4SHg/1Sy6tTM9LZAASC9S0qOmuGpqKp7lWKth262pro4f2vr97f68jEHIOXSec gJRh1uDKUChDiq3rSKjEhQu+9RNzwn+mooAS61XnG/iX5gFivl2ZMvQaeh8EljRpwHXU CPHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FrRdiI4V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id ch18si18115487ejb.736.2020.12.27.13.59.40; Sun, 27 Dec 2020 14:00:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FrRdiI4V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726253AbgL0V6G (ORCPT + 99 others); Sun, 27 Dec 2020 16:58:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:41318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726172AbgL0V6F (ORCPT ); Sun, 27 Dec 2020 16:58:05 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id CC7CC22AAB; Sun, 27 Dec 2020 21:57:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1609106245; bh=4MFzvoyxvWRh9e/3p4uTIb7qp4diLUFpLw6324rdMdI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FrRdiI4VtCP2Jh+pvScqUsl0+NLr/hDFsYNIMcdHqiKmtAKU0ErVUy/KAmaHidnu5 dHgdZPyhmGZ/dntmnfYbrSnW4NO77NIV1ZSSdj9PasXEoenFrLfnU9G+Iy3L++rwNA tvKuPRsPi3oWt15Rxq0jCA+yucOtWeBnSHGUTtDTrf27ZaGWmJxxxgKSGP4sPtOwbc ZtuuVpPVAQfU8lkpx/UFH7YfTHG0fZ/6bRYgtKp2oC3aiiYXzPKUZ0bP7PngqJoiK6 GZmL8F1XJP5Z+wThMmQep72m9+fVeZIeck8Hl20+R4fzlymThaagM9oCnIYmqP+5Ie nXcymR/0WNW1Q== Received: by mail-lf1-f47.google.com with SMTP id h205so20154848lfd.5; Sun, 27 Dec 2020 13:57:24 -0800 (PST) X-Gm-Message-State: AOAM5310DrFXDFYKy6Aaf+OtfO1y5Kqfm7W/o/187eSMRPv4ge0Trl3k 6stDNqtpqY6b6I69hVCK6LZqsvigmhfwS0s3hpM= X-Received: by 2002:a2e:8910:: with SMTP id d16mr20131771lji.357.1609106243184; Sun, 27 Dec 2020 13:57:23 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Song Liu Date: Sun, 27 Dec 2020 13:57:12 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: PROBLEM: Recent raid10 block discard patchset causes filesystem corruption on fstrim To: Xiao Ni Cc: Song Liu , Matthew Ruffell , linux-raid , lkml , Coly Li , Guoqing Jiang , "khalid.elmously@canonical.com" , Jay Vosburgh Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Xiao, On Thu, Dec 24, 2020 at 2:18 AM Xiao Ni wrote: > > > [...] > > [ 789.709501] discard bio start : 70968, size : 191176 > [ 789.709507] first stripe index 69, start disk index 0, start disk > offset 70968 > [ 789.709509] last stripe index 256, end disk index 0, end disk offset > 262144 > [ 789.709511] disk 0, dev start : 70968, dev end : 262144 > [ 789.709515] disk 1, dev start : 70656, dev end : 262144 > > For example, in this test case, it has 2 near copies. The > start_disk_offset for the first disk is 70968. > It should use the same offset address for second disk. But it uses the > start address of this chunk. > It discard more region. The patch in the attachment can fix this > problem. It split the region that > doesn't align with chunk size. > > There is another problem. The stripe size should be calculated > differently for near layout and far layout. > > @Song, do you want me to use a separate patch for this fix, or fix this > in the original patch? Please fold in the changes in the original patches and resend the whole set. Thanks, Song > > Merry Christmas > Xiao >