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 09:54:31 +0000 (10:54 +0100)
commita49e402f23096d21362b25d7224206a45288072a
tree01a1aa38d8eca24914edacd8d4045192f72ecc66
parent39ad0581176dd62d4dbb0ec528d2d2fb54f11069
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