linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] ext4: Fix potential races when performing online resizing
@ 2020-02-19  3:08 Suraj Jitindar Singh
  2020-02-19  3:08 ` [PATCH 1/3] ext4: introduce macro sbi_array_rcu_deref() to access rcu protected fields Suraj Jitindar Singh
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Suraj Jitindar Singh @ 2020-02-19  3:08 UTC (permalink / raw)
  To: linux-ext4; +Cc: tytso, sblbir, sjitindarsingh, Suraj Jitindar Singh

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


^ permalink raw reply	[flat|nested] 12+ messages in thread
* [PATCH -v2 0/3] Fix various races in online resizing
@ 2020-02-21  5:34 Theodore Ts'o
  2020-02-21  5:34 ` [PATCH 2/3] ext4: fix potential race between s_group_info online resizing and access Theodore Ts'o
  0 siblings, 1 reply; 12+ messages in thread
From: Theodore Ts'o @ 2020-02-21  5:34 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Suraj Jitindar Singh, Theodore Ts'o

I added __rcu decorations to s_group_desc, s_group_info and
s_flex_group, and this turned up quite a few places where we were
missing an rcu_dereference.  A number of them weren't strictly
necessary, but suppress warnings from the sparse code analysis tool
--- and sparse did find some places where the missing rcu_deference
could have led to some very hard to find bugs!

I folded the "introduce macro sbi_array_rcu_deref() to access rcu
protected fields" patch into the first patch, since we now need to use
the array in many more places.

Suraj Jitindar Singh (2):
  ext4: fix potential race between s_group_info online resizing and
    access
  ext4: fix potential race between s_flex_groups online resizing and
    access

Theodore Ts'o (1):
  ext4: fix potential race between online resizing and write operations

 fs/ext4/balloc.c  |  14 +++++--
 fs/ext4/ext4.h    |  30 ++++++++++---
 fs/ext4/ialloc.c  |  23 ++++++----
 fs/ext4/mballoc.c |  61 ++++++++++++++++++---------
 fs/ext4/resize.c  |  62 +++++++++++++++++++++------
 fs/ext4/super.c   | 105 ++++++++++++++++++++++++++++++++--------------
 6 files changed, 212 insertions(+), 83 deletions(-)

-- 
2.24.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-02-21  5:35 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-19  3:08 [PATCH 0/3] ext4: Fix potential races when performing online resizing Suraj Jitindar Singh
2020-02-19  3:08 ` [PATCH 1/3] ext4: introduce macro sbi_array_rcu_deref() to access rcu protected fields Suraj Jitindar Singh
2020-02-19  3:16   ` Jitindar SIngh, Suraj
2020-02-19  3:34   ` Singh, Balbir
2020-02-20  5:04   ` Theodore Y. Ts'o
2020-02-19  3:08 ` [PATCH 2/3] ext4: fix potential race between s_group_info online resizing and access Suraj Jitindar Singh
2020-02-19 20:20   ` Singh, Balbir
2020-02-20  5:13   ` Theodore Y. Ts'o
2020-02-19  3:08 ` [PATCH 3/3] ext4: fix potential race between s_flex_groups " Suraj Jitindar Singh
2020-02-20  6:14 ` [PATCH 0/3] ext4: Fix potential races when performing online resizing Theodore Y. Ts'o
2020-02-21  0:07   ` Jitindar SIngh, Suraj
  -- strict thread matches above, loose matches on Subject: below --
2020-02-21  5:34 [PATCH -v2 0/3] Fix various races in " Theodore Ts'o
2020-02-21  5:34 ` [PATCH 2/3] ext4: fix potential race between s_group_info online resizing and access Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).