f2fs: fix to reserve space for IO align feature
authorChao Yu <chao@kernel.org>
Sat, 11 Dec 2021 13:27:36 +0000 (21:27 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:05:30 +0000 (11:05 +0100)
commit0789b9b3492264e4bbe212b688866117d14df0c8
tree74427fdc7d2b85b20a0f83aa69da62fe3bfa00cc
parent56dabe87c4aadb58d4855ad734d74787cdca10d8
f2fs: fix to reserve space for IO align feature

commit 300a842937fbcfb5a189cea9ba15374fdb0b5c6b upstream.

https://bugzilla.kernel.org/show_bug.cgi?id=204137

With below script, we will hit panic during new segment allocation:

DISK=bingo.img
MOUNT_DIR=/mnt/f2fs

dd if=/dev/zero of=$DISK bs=1M count=105
mkfs.f2fe -a 1 -o 19 -t 1 -z 1 -f -q $DISK

mount -t f2fs $DISK $MOUNT_DIR -o "noinline_dentry,flush_merge,noextent_cache,mode=lfs,io_bits=7,fsync_mode=strict"

for (( i = 0; i < 4096; i++ )); do
name=`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 10`
mkdir $MOUNT_DIR/$name
done

umount $MOUNT_DIR
rm $DISK
fs/f2fs/f2fs.h
fs/f2fs/segment.h
fs/f2fs/super.c
fs/f2fs/sysfs.c