Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp222584iob; Mon, 2 May 2022 17:41:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrSSiZak5UskJ8cbNb/anVRaW4CNBI+IlM6zIyQZKB344wRZSGkxVpDD8Twh1F2c3IFBwL X-Received: by 2002:a63:85c6:0:b0:3ab:4545:e29e with SMTP id u189-20020a6385c6000000b003ab4545e29emr11479642pgd.573.1651538464513; Mon, 02 May 2022 17:41:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651538464; cv=none; d=google.com; s=arc-20160816; b=ljBkX7qdOr0pHwZXzWWcTITIl4HTmm3+I5+tIJH/61ZsE34Lk6fcvvlchK4/CkjC96 sNs/3y4pQQMC03qAeQXj4+WfHzir7ngEJ/jwLHO9in8/6pw07LqJPjfLM0ams2Bh/9hj xsblpFl/0nKbOHSZoOztGasWwawvuVHjmNVYAU0ytIbThFzjp1pYMJ8NfKt2ZKcmuW0L iZDgF5K+Dsn4BtBrQ27voama8bwz8DBPvVS+aqV86jO7oI54oFdHUB//flU4vnbooQv2 yPTjUSmGZJ7+hkRNspLUZ96JSBWwbHcHfqdjOT/xC1IsBWWLyQQR2W8hFI4BWxqOFKYp CmGA== 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=CECE6TSK8MHjSmTIWBnzhHFpumjz5uVxh+Sa8svO4Ik=; b=e9KjsyaBtInbVsQLbfDoHR465ytLAC+obAmh0X2Yi6tgdoNpKwMpe+410nIQ4zSZCv SCYrfzfzR3Ah6SBpIgcPxuMdKAm9VI0sRtf6J8Oo8LPQh3Xvd0DWFwNReUdBxXmxc0Nx OAInMrmlwF16ln/AAlJsR/Z7t3gU6MrM7z4UCCAR2JbNndT4mk67bTeR1jyRN2Bp/L48 kncByTWP2CrZl8M7DqULRG63nHDcoE9ytWsZ3MVW9t6GFsPOyYtGGvxVNG+0EqU8GAGV crnUgwT128Mjj91fjshrKt6noPc1ZPeGXTnc/gxNME2a+eZsiL3MQptp+P2uHu7Psczv NquQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=X4E70v2i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d71-20020a63364a000000b003c1d56c081bsi2978304pga.212.2022.05.02.17.41.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 17:41:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=X4E70v2i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 057C947549; Mon, 2 May 2022 17:31:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386990AbiEBTCX (ORCPT + 99 others); Mon, 2 May 2022 15:02:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229819AbiEBTCV (ORCPT ); Mon, 2 May 2022 15:02:21 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B89A064E1 for ; Mon, 2 May 2022 11:58:51 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id l19so19485091ljb.7 for ; Mon, 02 May 2022 11:58:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CECE6TSK8MHjSmTIWBnzhHFpumjz5uVxh+Sa8svO4Ik=; b=X4E70v2iXVM3ihjmV7BjytsYyEz9ntDrfu5Z5lmWsyUIDVc/hoV+kgQtmfpHjq+QaG RZHX0XUVq9LLxTj4kMxCrvbvC12tOFZ/wIMtSilIKFTBrXxenui/UU9vAD5EqqeSCzW+ NtJP10C4GHavyC+ks7adueMhrSbuNivJEsS8g= 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=CECE6TSK8MHjSmTIWBnzhHFpumjz5uVxh+Sa8svO4Ik=; b=ydde1/TSdYMFcI2DPy0fPGG4BD357kkQL2XHmQIiSlovSo8ky/9yPI36CsIyADFZCm pC/44LS/bwP818Fh9n3gXWtes+kdzKc9/ZMaCTS8nRT4hnL6QsTEJZGNxDx2aRuDII33 n0p5TkTt3O9NeYM3gfBFLxXhQHf/jGjMZ+OAlE3ZBNU3KJYztumIoGTjcf6GvwfSt0JD mfL6XDof4bta/1VLIStXV6Vaw1EzGwuMgjbXonEImmI3Ne6k+k1ScCbwXcPjZ4903ew+ fkr3fMsR51JXo+njEPoPskqpGz++FY+r6ftqj8WHF86dayJOKtFHEHKZzb8QSA7/SvU7 FYOw== X-Gm-Message-State: AOAM5332UteZOUVeMmRMG91exvc4TFc2+9SsCF+rda147JlyYbtZrYcG xYxmqOKeIE3p1feWh5736zH29gcvO+J472lE X-Received: by 2002:a05:651c:992:b0:250:664c:9058 with SMTP id b18-20020a05651c099200b00250664c9058mr917313ljq.26.1651517929864; Mon, 02 May 2022 11:58:49 -0700 (PDT) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com. [209.85.208.176]) by smtp.gmail.com with ESMTPSA id 16-20020a05651c00d000b0024f3d1daeebsm1119594ljr.115.2022.05.02.11.58.48 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 May 2022 11:58:48 -0700 (PDT) Received: by mail-lj1-f176.google.com with SMTP id 17so19507644lji.1 for ; Mon, 02 May 2022 11:58:48 -0700 (PDT) X-Received: by 2002:a2e:8789:0:b0:24f:124c:864a with SMTP id n9-20020a2e8789000000b0024f124c864amr8342835lji.164.1651517927914; Mon, 02 May 2022 11:58:47 -0700 (PDT) MIME-Version: 1.0 References: <20220426145445.2282274-1-agruenba@redhat.com> In-Reply-To: From: Linus Torvalds Date: Mon, 2 May 2022 11:58:31 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] gfs2 fix To: Andreas Gruenbacher , Christoph Hellwig , "Darrick J. Wong" , Dave Chinner Cc: cluster-devel , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Mon, May 2, 2022 at 11:31 AM Linus Torvalds wrote: > > NOTE! This patch is entirely untested. I also didn't actually yet go > look at what gfs2 does when 'bytes' and 'copied' are different. Oh, it's a lot of generic iomap_write_end() code, so I guess it's just as well that I brought in the iomap people. And the iomap code has many different cases. Some of them do if (unlikely(copied < len && !folio_test_uptodate(folio))) return 0; to force the whole IO to be re-done (looks sane - that's the "the underlying folio wasn't uptodate, because we expected the write to make it so"). And that might not have happened before, but it looks like gfs2 does actually try to deal with that case. But since Andreas said originally that the IO wasn't aligned, I don't think that "not uptodate" case is what is going on, and it's more about some "partial write in the middle of a buffer succeeded" And the code also has things like if (ret < len) iomap_write_failed(iter->inode, pos, len); which looks very wrong - it's not that the write failed, it's just incomplete because it was done with page faults disabled. It seems to try to do some page cache truncation based on the original 'len', but not taking the successful part into account. Which all sounds horrifically wrong. But I don't know the code well enough to really judge. It just makes me uncomfortable, and I do suspect this code may be quite buggy if the copy of the full 'len' doesn't succeed. Again, the patch I sent only _hides_ any issues and makes them practically impossible to see. It doesn't really _fix_ anything, since - as mentioned - regardless of fault_in_iov_iter_readable() succeeding, racing with page-out could then cause the later copy_page_from_iter_atomic() to have a partial copy anyway. And hey, maybe there's something entirely different going on, and my "Heureka! It might be explained by that partial write_end that generally didn't happen before" is only my shouting at windmills. Linus