Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1585251iob; Thu, 5 May 2022 04:38:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbgoHjXrdU3J2Z/lnr/DNv865LWFZRiTCzILyiMhhydTBAzSR88MV1fEpxY652yRCtdYAR X-Received: by 2002:a17:903:41d1:b0:15e:b27a:2523 with SMTP id u17-20020a17090341d100b0015eb27a2523mr15898165ple.25.1651750721419; Thu, 05 May 2022 04:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651750721; cv=none; d=google.com; s=arc-20160816; b=eYwGptkNm+JU0Ouw2Gf3nHvn5rlwyYfaGmJu22bk79Tr6DhIVrA+EyU1WELGTG00WB c6nnXxwQPWuYwofI5+1cXmupOFQzOJ9+PepuZcP7FzDOawmmCHplsPfVMwhAuS2m094b boIfqwhCXszoBFsF8jNZ27h2fuvVb9LBeuz9ANvGp09qEUoOqSyjCKbcldWa09+wvASq WwRGpApwcxDNGeLEKxV8NYmb8G5AWPXDjo5eI5Fki07onYAxNwhRM8LS/VoDJ6bPodU4 +0v5GY77RMhbPEDZC+hhvOVFZ7Iwcqn1OMThf9BOH1uZA2akswcTt/ka3S36RROzkqUA sWyA== 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=yf7BR3WltEqwAzcMwH0wKy6tL9PI+XUug92MYo/xJjM=; b=hQnbCVUcYIY3aI6OqzKX0TguP21H1kX618KdRXXeVHZE4YJZvQ3x8JRV2Ll2Kmm/q6 OuUk3vmruHST10Kp3nP65QEjW8g+gH+elsPsN8JOvTLWb6m1lTaOSHABH7W5c0VV7O6y ViSbEAJ68xY6eVmZXeELHan6UIRoMYU0O/LFdwm4bHSsr/HQAr2ZxqMGgaG9nomsL1jv o6PB8ivYZiBuo2Pt94QdL28DbIscTzRWCq4099ErQPesgXu7+OtXKfpmPnnG3LJcLisM o1537bRRbPYM8tvEneoDwn4efcS3k9V7et1adO3QiDEG4A9YFAZqdEy4Ts/aTGTTzGFU IP8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=d3bSrsi5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c71-20020a624e4a000000b0050d7ec4043dsi1289244pfb.233.2022.05.05.04.38.25; Thu, 05 May 2022 04:38:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=d3bSrsi5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376821AbiEDS0u (ORCPT + 99 others); Wed, 4 May 2022 14:26:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355866AbiEDS0m (ORCPT ); Wed, 4 May 2022 14:26:42 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9B701A94DC for ; Wed, 4 May 2022 10:52:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651686765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yf7BR3WltEqwAzcMwH0wKy6tL9PI+XUug92MYo/xJjM=; b=d3bSrsi5MLhWXw88Wmv6TyJ4CvWKKHu4tXFy6Nl/eeehJ5Xae+LsxpdjSwwndAWG2rGw8m QnC4aoL8Z7gC13JkS2TqstlreYSq3Ln4uD6PEOw63G1lHu/gEDrdfmIP++xML1Ykx2oK4y bvg4gQRSfCBTrvAyGmbP3dvvC5tDBxA= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-562-z66s-U5fPBStj-CeHJigJg-1; Wed, 04 May 2022 13:52:42 -0400 X-MC-Unique: z66s-U5fPBStj-CeHJigJg-1 Received: by mail-wr1-f70.google.com with SMTP id p18-20020adf9592000000b00207bc12decbso610268wrp.21 for ; Wed, 04 May 2022 10:52:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yf7BR3WltEqwAzcMwH0wKy6tL9PI+XUug92MYo/xJjM=; b=6f3rjvSjmP94D81WOYesg6Wj6Hyyg+X2qH4/Cv4NmcTRE3V1MVEshB7I1OB46dOpuu +mZ98PfKob+VW1qw+tXjudBrh6fUDnOC71NnPu+HhPkuNfOrlRZwF0+EL/sdYR19OA7a ZT1p/jRBiBx+yyr+uM3jAcI8RC9NZQKS79wf5QFQW9OFdv+iZxEzB/CjqISwi1IsHrIm TjjLDpw1c18PV0APZl8pTUCulb4vgurCRaY83EceqZv4co9UnIdOBUPtm52wfevxNg97 /+P4NW+U8tg75soALxFsOVxvFeq8Tz38Kgemz4Jouo7fNOMGrD8hhNWipfSqsvblWxJj hIyQ== X-Gm-Message-State: AOAM532O8Kuqo9EgSGScVry3iiJCGRe1hliWFIr5CnByswVn8oFE2LJO HhGM/F/asxwE2TUH8QwcWBrNT365QxLJKtA7MmF9yPzJ7tulaW+Y2OvKnHwXNhHzssVx8uaEeAa u8SMge1/jYnmOLFnjvANFN7rPQ1Fr/b1ABhOYzwT/ X-Received: by 2002:adf:f30a:0:b0:20a:e193:6836 with SMTP id i10-20020adff30a000000b0020ae1936836mr17475069wro.654.1651686760680; Wed, 04 May 2022 10:52:40 -0700 (PDT) X-Received: by 2002:adf:f30a:0:b0:20a:e193:6836 with SMTP id i10-20020adff30a000000b0020ae1936836mr17475050wro.654.1651686760467; Wed, 04 May 2022 10:52:40 -0700 (PDT) MIME-Version: 1.0 References: <20220426145445.2282274-1-agruenba@redhat.com> <20220503213524.3273690-1-agruenba@redhat.com> In-Reply-To: From: Andreas Gruenbacher Date: Wed, 4 May 2022 19:52:29 +0200 Message-ID: Subject: Re: [GIT PULL] gfs2 fix To: Linus Torvalds Cc: Christoph Hellwig , "Darrick J. Wong" , Dave Chinner , cluster-devel , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 4, 2022 at 12:42 AM Linus Torvalds wrote: > On Tue, May 3, 2022 at 2:35 PM Andreas Gruenbacher wrote: > > > > More testing still ongoing, but the following patch seems to fix the > > data corruption. > > Fingers crossed. It turns out that crossing fingers wasn't enough and we still get corruption, but less frequently than before. We're going in the right direction. My working theory is that this is due to a subtle bug in the hole punching done by gfs2_iomap_end() to get rid of unused blocks. With the test case that fails, gfs2_iomap_end() is punching holes way more often than I was expecting, and way more often than it should. Remember that the test case is doing 32-MiB writes of a user buffer that usually isn't entirely in memory. The first iomap_file_buffered_write() allocates filesystem blocks for the entire buffer, and when it finds that it could only do a partial write, it frees a large part of those blocks. It will then call fault_in_iov_iter_readable() for the next chunk, and the next call to iomap_file_buffered_write() will then usually be able to write that chunk entirely. So it seems that we should always call fault_in_iov_iter_readable() before calling into iomap_file_buffered_write(). This will probably hide whatever is going wrong in punch_hole(), but we'll get to that later ... (Side note: the chunk size should be aligned to the page cache, not to the iov_iter as in the current code.) > > + truncate_pagecache_range(inode, hstart, hend - 1); > > + if (hstart < hend) > > + punch_hole(ip, hstart, hend - hstart); > > Why doesn't that "hstart < hend" condition cover both the truncate and > the hole punch? That was a leftover from a previous experiment in which I did the truncate_pagecache_range() on the unaligned boundaries. Which turned out to be pointless. I'll clean that up. Thanks, Andreas