Skip to content

ext4: Fix potential races when performing online resizing

Suraj Jitindar Singh linux-ext4 stable 1 version Applied

Status from this message: Thanks, applied.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 7 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/3ext4: introduce macro sbi_array_rcu_deref() to access rcu protected fieldsfs/ext4/balloc.c fs/ext4/ext4.h+22 -63 replies
2/3ext4: fix potential race between s_group_info online resizing and accessfs/ext4/ext4.h fs/ext4/mballoc.c+9 -72 replies
3/3ext4: fix potential race between s_flex_groups online resizing and accessfs/ext4/ext4.h fs/ext4/ialloc.c fs/ext4/mballoc.c +2 more+60 -320 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchBalbir Singh
1/3R-b
2/3R-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] ext4: Fix potential races when performing online resizing

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(-)
Signature · 1 line
2.17.1