Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4324942pxb; Mon, 1 Feb 2021 19:50:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJxHBhfaAjHHDWOnJAB8v83c5SvsIUFEpmgaT/lE4irzdWLRhg0stWm6CclntCKlowHk3GfE X-Received: by 2002:a05:6402:4391:: with SMTP id o17mr22159014edc.196.1612237815476; Mon, 01 Feb 2021 19:50:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612237815; cv=none; d=google.com; s=arc-20160816; b=bPE4HtFRpnDGmI9PwlNTtkD4GLQeladJS0sR0FtFE5FdYurYXIgyXsK472jwSbgiSZ +5iy32QrRmTTnPbAIEJ9inRlAA/6rR+zHeXNLzppBYAgDi1cDz9T+paBCvsJm/7Nnhhj qE7y+ZOQT716BmRW4lz2Jo0wB32FDxEzB3bCUqI12kN86MCZhjOKi3HTodZZ2lCF4sfN YXok2WasvGSd9p3iE5a0+/M0U/c48ifAMLk9ihwSdr0UK6gbGbI8KmDQ9RPZtW8Jdc14 CG912/aAM33gmhTHJEOYmNW7IlUJSQUHOBPDDli/Yp5IEOF4hJLoBh6Fh/UHFaYnLv58 Xx2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=2QyTMXw4YiHlxPz2TDd2N4/mAS03FpHnAiVRaHpKfIA=; b=Q+dCZbcglFJMV+1FLGYA64Nx6Fb2QPlHCOQeitsQWjMiu2XxgSjZWSm/5kO5igNk95 2cmX/GOCHFabB3KQmuohc7Pz+OU2/3qcS6oarARcVUGACWAv4wEBtTpFtsvFI2TkTS65 mQpMTHvRlpd+bRU48kA+70N5Mb+/My253UsjVd1mdMgubgqFcxNughWJ8Dyp0K+23zPa CwB9ryPR3xrCil61Kf6dXpb2hnVjZVPpPhA9aaSxxEtSrHaaci8P5jaKJWV6YC/BQ8Tr VsqN1ZF7iCioYGQGeiYL+7FDH10zi/XsQOIypUmlTV9/XqPgbhigfDJkbSiUpbyh1oCT S6Ig== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l23si12063098edr.523.2021.02.01.19.49.51; Mon, 01 Feb 2021 19:50:15 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231446AbhBBDqZ (ORCPT + 99 others); Mon, 1 Feb 2021 22:46:25 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:59421 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231225AbhBBDqY (ORCPT ); Mon, 1 Feb 2021 22:46:24 -0500 Received: from mail-pj1-f69.google.com ([209.85.216.69]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1l6maE-0003HO-81 for linux-kernel@vger.kernel.org; Tue, 02 Feb 2021 03:42:30 +0000 Received: by mail-pj1-f69.google.com with SMTP id x5so908437pjk.7 for ; Mon, 01 Feb 2021 19:42:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2QyTMXw4YiHlxPz2TDd2N4/mAS03FpHnAiVRaHpKfIA=; b=Pwmndgt2jrjaH/ZZAERgv/HUICLVvOPPvbTPPKXUr6Bq9SPsxEVW8/rdHf81hyMlcf HgMOWp8SlW4jKr8d7DtYzZaO+l02XRilTqMguL9yZW3o7HD4Vr0cAxmn4ZihL4qkzo+o yQDUdwSEJIbwgvUohMDQHKWUFuQtPyVbph+RAhsKpY80tTvT+hnabWVhc3g1Syicg8Jb Kr1CTuJY2z61JZy1UbL1OGEXF76A7Ynn48GTMQrfclkG3ktiq1hAR5L6a1nv2TQYlwsA g4/Fb3g4a88xNjRBkrmvT5a10a6MLdogTyKxFUKn52zSU58dAb3IMLFarNeAlIN3n9Pf SJSg== X-Gm-Message-State: AOAM531UTTOXnSVyQX19DakqdWOz0GlxOQ6Qx4s98ND9ZPsjNIBqHGaW lUns+E+e6n0+tkXmjYj0qFwNr5Thzf7QZuEnnhM3N8j8IUdmRE8kTfzE+TZ09BCotiG2qcFg/Yw /afrR+AWdFl2oMAks3SMX5hLcCcGy0/nfOYBDBXDdmg== X-Received: by 2002:a17:90a:404c:: with SMTP id k12mr2138853pjg.4.1612237348963; Mon, 01 Feb 2021 19:42:28 -0800 (PST) X-Received: by 2002:a17:90a:404c:: with SMTP id k12mr2138827pjg.4.1612237348614; Mon, 01 Feb 2021 19:42:28 -0800 (PST) Received: from [192.168.1.107] (222-152-178-139-fibre.sparkbb.co.nz. [222.152.178.139]) by smtp.gmail.com with ESMTPSA id ck10sm965775pjb.3.2021.02.01.19.42.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Feb 2021 19:42:27 -0800 (PST) Subject: Re: PROBLEM: Recent raid10 block discard patchset causes filesystem corruption on fstrim To: Xiao Ni , Song Liu Cc: linux-raid , Song Liu , lkml , Coly Li , Guoqing Jiang , "khalid.elmously@canonical.com" , Jay Vosburgh References: From: Matthew Ruffell Message-ID: <71b9c9df-93a8-165a-d254-746a874f2238@canonical.com> Date: Tue, 2 Feb 2021 16:42:20 +1300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Xiao, On 24/12/20 11:18 pm, Xiao Ni wrote:> The root cause is found. Now we use a similar way with raid0 to handle discard request > for raid10. Because the discard region is very big, we can calculate the start/end address > for each disk. Then we can submit the discard request to each disk. But for raid10, it has > copies. For near layout, if the discard request doesn't align with chunk size, we calculate > a start_disk_offset. Now we only use start_disk_offset for the first disk, but it should be > used for the near copies disks too. Thanks for finding the root cause and making a patch that corrects the offset addresses for multiple disks! > > [  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. Just wondering, what is the current status of the patchset? Is there anything that I can do to help? > > There is another problem. The stripe size should be calculated differently for near layout and far layout. > I can help review the patch and help test the patches anytime. Do you need help with making a patch to calculate the stripe size for near and far layouts? Let me know how you are going with this patchset, and if there is anything I can do for you. Thanks, Matthew > @Song, do you want me to use a separate patch for this fix, or fix this in the original patch? > > Merry Christmas > Xiao >