Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp119918ybv; Tue, 18 Feb 2020 19:11:01 -0800 (PST) X-Google-Smtp-Source: APXvYqwd72apLqO1Khek3QquXJyHB1xYuwe7r0mNp5i+V4T8bQV8rtmCye3pf3zLJnDY/ffV9VPg X-Received: by 2002:a9d:138:: with SMTP id 53mr18707558otu.334.1582081861265; Tue, 18 Feb 2020 19:11:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582081861; cv=none; d=google.com; s=arc-20160816; b=RAynIcZWhZzn1aaCZx72s8U2P1I6IRh8DFtT4N/PVxPuQ9jJl4AoA25mvZGd/wxcV/ KEP0BkbRMfi9kxysV8DFZLTXx02qW4pQ9KdXAUdPVOppLHAGpTBHBzWD7CFjy6su63x6 l7DcCKLJYL/PbQBsCMIgYcKzHYGpamH4/CXFsiSbDN8mLEGj68IkOsp6+iVDo06efaQ1 v3AdpfzgH9PJI4Itw4x8Ih1OKmVcPpmskuUr8ZMbIN/z054ghwVvgoEs2jmwFoazBmG7 c0Ouee2Kj7YVpEK9tKabiKBZ7q0RNLpAsApdOpyQ1xg1L05c5lAC49ishdj4WBN/8bNO OrHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:ironport-sdr:dkim-signature; bh=/IeOXZFEImLP23fnQIbZ0isIjjVE+31UmVP9q10URvk=; b=t2TpTDANP3MaH3o5RpYtl3R2LaRMFJ2WQPmbtVWfXOOz5TkOnGbOleHCz4tuHFusF4 IrHV2nPbOQyIIxO3013Vjl9GtfKvNGZdu81FFdFsmT00sLNZ7ghSVebTtzC6ubKxQdlY YrjQkWPcnuyCMCGOp/iO7aIoBIsNRJXecg/6x8xad7j1Q7WGa7D8fKjtp9i3fYys8KBf z2pXvEKLzqM63b9OBSbhhdDU8uHWMDwnHwTBWSGO99Tr4EnG3JH29AQMA2ebZG2D+odI /LYA44PBlI2QUo+llNl4RcouYlFe2E44tYcT/Dp9ETuCY5sLxK1pSNaW80OViJlGP0RX k01A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b="Bce/wDAM"; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q124si9356721oig.228.2020.02.18.19.10.50; Tue, 18 Feb 2020 19:11:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b="Bce/wDAM"; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728219AbgBSDKi (ORCPT + 99 others); Tue, 18 Feb 2020 22:10:38 -0500 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:28837 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728280AbgBSDKi (ORCPT ); Tue, 18 Feb 2020 22:10:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1582081837; x=1613617837; h=from:to:cc:subject:date:message-id:mime-version; bh=/IeOXZFEImLP23fnQIbZ0isIjjVE+31UmVP9q10URvk=; b=Bce/wDAM13QLuXxwoaINdIxsMgezZ5C1LiI/iyVzbYVLF3ftZ9vf8uho bjYCTM819ylCfvbnn9e5B/jVwO0MYjvVv27Nm9opD2hGnanbNTdi+c9q8 1adyBRZBltReDeolI8sRZPqBfZE9sksQURxyV0twtFcab+ri55HhjqWnp E=; IronPort-SDR: sucj/9iHjZJBzWWs/wMcbdITLbv6Of6fOCy2WfcEsOZjDUeQOIs0DRaNvr5FCCVZgbau3rb1Ap jgLI6Rq5ogGg== X-IronPort-AV: E=Sophos;i="5.70,458,1574121600"; d="scan'208";a="16986530" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1d-2c665b5d.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 19 Feb 2020 03:10:24 +0000 Received: from EX13MTAUWC001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1d-2c665b5d.us-east-1.amazon.com (Postfix) with ESMTPS id 462FCA2BCC; Wed, 19 Feb 2020 03:10:22 +0000 (UTC) Received: from EX13D30UWC001.ant.amazon.com (10.43.162.128) by EX13MTAUWC001.ant.amazon.com (10.43.162.135) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 19 Feb 2020 03:10:22 +0000 Received: from u3c3f5cfe23135f.ant.amazon.com (10.43.161.235) by EX13D30UWC001.ant.amazon.com (10.43.162.128) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 19 Feb 2020 03:10:22 +0000 From: Suraj Jitindar Singh To: CC: , , , "Suraj Jitindar Singh" Subject: [PATCH 0/3] ext4: Fix potential races when performing online resizing Date: Tue, 18 Feb 2020 19:08:48 -0800 Message-ID: <20200219030851.2678-1-surajjs@amazon.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.161.235] X-ClientProxiedBy: EX13D33UWB004.ant.amazon.com (10.43.161.225) To EX13D30UWC001.ant.amazon.com (10.43.162.128) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org This patch series fixes 2 additional races between array resizing and array element access when performing online resizing of the arrays s_group_info and s_flex_groups. These patches apply on top of the patch: [PATCH RFC] ext4: fix potential race between online resizing and write operations The macro sbi_array_rcu_deref() is introduced for simplicity but can be removed if undesired. Tested by performing the following: truncate -s 100G /tmp/foo sudo bash -c 'while true; do dd if=/dev/zero of=/mnt/xxx bs=1M count=1; sync; \ rm /mnt/xxx; done' & while true; do mkfs.ext4 -b 1024 -E resize=26213883 /tmp/foo 2096635 -F; \ sudo mount -o loop /tmp/foo /mnt; sudo resize2fs /dev/loop0 26213883; \ sudo umount /mnt; done Suraj Jitindar Singh (3): ext4: introduce macro sbi_array_rcu_deref() to access rcu protected fields ext4: fix potential race between s_group_info online resizing and access ext4: fix potential race between s_flex_groups online resizing and access fs/ext4/balloc.c | 11 +++++----- fs/ext4/ext4.h | 25 +++++++++++++++++---- fs/ext4/ialloc.c | 21 +++++++++++------- fs/ext4/mballoc.c | 19 ++++++++++------ fs/ext4/resize.c | 4 ++-- fs/ext4/super.c | 56 ++++++++++++++++++++++++++++++++--------------- 6 files changed, 91 insertions(+), 45 deletions(-) -- 2.17.1