Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp61462pxk; Mon, 5 Oct 2020 17:49:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhGQyz1MVEQ36cl6RZ6HpXmlSIT4jxeUEijGU85bA/0BdYPU1DCIfI2n89Bu2uuzk7sOG8 X-Received: by 2002:a05:6402:3184:: with SMTP id di4mr2621201edb.362.1601945367567; Mon, 05 Oct 2020 17:49:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601945367; cv=none; d=google.com; s=arc-20160816; b=hs09tsPMjf23nFgvs7twO/I+dYaNFm7lA2zkrfUwwwBsRgfg+IH8yOq4Gf4joBbCPG hzQf6wMxguhR2zIz5koDtGUv8Nx1W/wD/s26NhboMowjh/uPySt1H7WXrEwW5cD7uDiF 5VO1NInrc2MJg8CsIc6ufzJiGHZinx6fmKZw2O2JO4Zsd+27vWVb3XtvaenqFgafbT1z eP23ld5CAfXBHL3pOm/TCYg2IO7ZUG7J8OSSHaf7MfdlxjRSJSLuHjyBnimz+9L2sm7b t6jXxU7oNj9Eu3gxjfqHSls3dMXPVRLmaN0SQKKo21UJJw0RZ2nv3Ys/bBmUw4Rf4dtI GVBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=KL3RF0x6ptbcwHYMVL6UlKkC5BqgmC0cXv7kdsRP0mE=; b=ovXUYG+81kq8xxxLklDZMHF6DWTiIDzG+GDM8XR0qNhvave5aid4COVR93Px6J/voh 2XBHcM9p/G8beiOrfB2B032w7m0WjhxXbW2AS3Q3150loZvCdj0Dvd7f/8ZJVaVvpAii dh1B5Vtx7J+xTOKy6SCmyM0nLV0NuNQh2OusD4xEMPMavQJH6Yun0gNalih+HUuoLME5 Z+4YgPkgQ5VcTqHWoacw+dARazjTAwRyzB0yh0d96vhlMu2s/TYpRtu7NZP1ZcqJT6Ev JE83LCQUCPtvI0JH8R26dggAyvzdq/Kl2y0V2LAMxHLyHwmbUjMKLqGdd9R9mF4pNSm/ 5oIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 s13si1122825edw.599.2020.10.05.17.48.54; Mon, 05 Oct 2020 17:49:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 S1725870AbgJFAsw (ORCPT + 99 others); Mon, 5 Oct 2020 20:48:52 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:56622 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725865AbgJFAsw (ORCPT ); Mon, 5 Oct 2020 20:48:52 -0400 Received: from mail-qv1-f70.google.com ([209.85.219.70]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kPb9u-0004US-C4 for linux-ext4@vger.kernel.org; Tue, 06 Oct 2020 00:48:50 +0000 Received: by mail-qv1-f70.google.com with SMTP id w32so7118792qvw.8 for ; Mon, 05 Oct 2020 17:48:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KL3RF0x6ptbcwHYMVL6UlKkC5BqgmC0cXv7kdsRP0mE=; b=rkoAQzNlg7NPASQ3pFXwkuyUKUFP3n1LDQkkeIDgkDLHHya1xZGxnOV2jwc87FDzDx jwbAHKN5KWKhX3bEekIWkQxaMB778IZhfZmQIAoX1rq74WBZzSnHXfETkv2CH70lWx/y n5+t4R3s7moeaka3tQCYJAQnvBntPAGuDnoNsVeu59Pc5GoB5B5pE6NkZzVZcMF1JfW/ h4rt2OJpRAmklmgYMGLstNR0HR5EsShZm4maLFEHPT1NMcnuvPUaYWcVfdHGpBp65pWZ uvWlRFih6yCEMs/UhFRlKbDHofGpyEFC/01RghGp+a8DcwpwrWqdRkWXxvcCOodDEpMX pmKg== X-Gm-Message-State: AOAM532gT2xCtF+NPwcvpu/m01yMBC2Hvug6UfShH+/tjMmlNO6ceXIV 3VwApbUIugYeM0x8ZBFrE1Dd5A7nupCrV3U0bwv/Y+OcIld7bB3J6js8XZOD3DqL+Nl5+iFGaRV elLIX+kO1oEZlTZkQBKRkywqQxLJymOgbIIEEiqg= X-Received: by 2002:a37:b603:: with SMTP id g3mr2892616qkf.475.1601945329237; Mon, 05 Oct 2020 17:48:49 -0700 (PDT) X-Received: by 2002:a37:b603:: with SMTP id g3mr2892603qkf.475.1601945328987; Mon, 05 Oct 2020 17:48:48 -0700 (PDT) Received: from localhost.localdomain ([201.82.49.101]) by smtp.gmail.com with ESMTPSA id l125sm1355322qke.23.2020.10.05.17.48.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 17:48:48 -0700 (PDT) From: Mauricio Faria de Oliveira To: linux-ext4@vger.kernel.org, ocfs2-devel@oss.oracle.com Cc: Jan Kara , Andreas Dilger , dann frazier , Joseph Qi Subject: [PATCH v5 0/4] ext4/jbd2: data=journal: write-protect pages on transaction commit Date: Mon, 5 Oct 2020 21:48:37 -0300 Message-Id: <20201006004841.600488-1-mfo@canonical.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Hey Jan, Andreas, Ted et al. This series fixes the issue that buffers writeably mapped to userspace can be modified during transaction commit, in between checksumming and write-out to the journal, thus cause inconsistency in the journal that prevents recovery/mount after kernel crash or power loss. It's really ideas and patience from Jan guiding me how to write/fix it. Huge thanks! Although the synthetic test case in [v2] demonstrates the bug and that the fix works, there's stress-ng tests that still causes inconsistency. Unfortunately I couldn't look more into it yet; per discussion in [v4] cover letter I'll send it as-is now, since it already fixes something, and will continue to analyze. It might be something else/another fix. There's also some fstests that _apparently_ become more flaky w/ the patchset applied, but don't seem to be mmap() related.. so I'll look at them more carefully too. The set of consistent failures (ie, that happen most of the time) is the same between original/patched builds, on both data=ordered and data=journal (different for each mode, ofc.) data=ordered: Failures: ext4/045 generic/044 generic/045 generic/046 generic/051 generic/223 generic/388 generic/465 generic/475 generic/553 generic/554 generic/555 generic/565 generic/611 data=journal: Failures: ext4/045 generic/051 generic/223 generic/347 generic/388 generic/441 generic/475 generic/553 generic/554 generic/555 generic/565 generic/611 There's a small change to OCFS2 in patch 2, which has been tested w/ stress-ng's filesystem and io stressor classes; no regressions found. # mkfs.ocfs2 --mount local $DEV # mount $DEV $MNT # cd $MNT # stress-ng --sequential 0 --class filesystem,io The only changes from v4 are style-change suggestions from Andreas applied to patches 02/04 and where we set OCFS2 journal callbacks; plus Reviewed-By: tags. Tested on v5.9-rc7'ish and next-20200930; build tested on -rc8'ish and next-20201002 today. cheers, Mauricio [v4] https://lore.kernel.org/linux-ext4/20200928194103.244692-1-mfo@canonical.com/ [v3] https://lore.kernel.org/linux-ext4/20200910193127.276214-1-mfo@canonical.com/ [v2] https://lore.kernel.org/linux-ext4/20200810010210.3305322-1-mfo@canonical.com/ [v1] https://lore.kernel.org/linux-ext4/20200423233705.5878-1-mfo@canonical.com/ Mauricio Faria de Oliveira (4): jbd2: introduce/export functions jbd2_journal_submit|finish_inode_data_buffers() jbd2, ext4, ocfs2: introduce/use journal callbacks j_submit|finish_inode_data_buffers() ext4: data=journal: fixes for ext4_page_mkwrite() ext4: data=journal: write-protect pages on j_submit_inode_data_buffers() fs/ext4/inode.c | 62 ++++++++++++++++++++++++++----- fs/ext4/super.c | 87 ++++++++++++++++++++++++++++++++++++++++++++ fs/jbd2/commit.c | 62 ++++++++++++++++--------------- fs/jbd2/journal.c | 2 + fs/ocfs2/journal.c | 4 ++ include/linux/jbd2.h | 29 ++++++++++++++- 6 files changed, 206 insertions(+), 40 deletions(-) -- 2.17.1