mbox series

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

Message ID 20200219030851.2678-1-surajjs@amazon.com
Headers show
Series ext4: Fix potential races when performing online resizing | expand

Message

Suraj Jitindar Singh Feb. 19, 2020, 3:08 a.m. UTC
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(-)

Comments

Theodore Ts'o Feb. 20, 2020, 6:14 a.m. UTC | #1
Hi Suraj,

All of the patches to fix BZ 206443 are now on the ext4 git tree:

https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git/log/?h=dev

I'm currently giving them a full regression test set using xfstests.
Could you run your tests to make sure it looks good for you?

I'm hoping to issue a pull request to Linus in time for 5.6-rc3 by
this weekend.

Also, if you can figure out a way to package up the repro as an
xfstests test case, that would be really excellent.  I think the
challenge is that some of them took a *huge* amount of pounding before
they repro'ed, correct?  I wasn't actually able to trigger the repro
using kvm, but I was only using a 2 CPU configuration.

Thanks,

						- Ted
Suraj Jitindar Singh Feb. 21, 2020, 12:07 a.m. UTC | #2
On Thu, 2020-02-20 at 01:14 -0500, Theodore Y. Ts'o wrote:
> Hi Suraj,
> 
> All of the patches to fix BZ 206443 are now on the ext4 git tree:
> 
> 
https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git/log/?h=dev
> 
> I'm currently giving them a full regression test set using xfstests.
> Could you run your tests to make sure it looks good for you?

Hi,

Have run my repo case for 6 hours without issue.
Previously this reproduced 100% of the time within <30 mins.

> 
> I'm hoping to issue a pull request to Linus in time for 5.6-rc3 by
> this weekend.
> 
> Also, if you can figure out a way to package up the repro as an
> xfstests test case, that would be really excellent.  I think the
> challenge is that some of them took a *huge* amount of pounding
> before
> they repro'ed, correct?  I wasn't actually able to trigger the repro
> using kvm, but I was only using a 2 CPU configuration.

I will look into this.

Thanks,
Suraj

> 
> Thanks,
> 
> 						- Ted
>