f2fs: fix race condition on setting FI_NO_EXTENT flag
Zhang Qilong authored
[ Upstream commit 07725adc ]

The following scenarios exist.
process A:               process B:
->f2fs_drop_extent_tree  ->f2fs_update_extent_cache_range
                          ->f2fs_update_extent_tree_range
                           ->write_lock
 ->set_inode_flag
                           ->is_inode_flag_set
                           ->__free_extent_tree // Shouldn't
                                                // have been
                                                // cleaned up
                                                // here
  ->write_lock

In this case, the "FI_NO_EXTENT" flag is set between
f2fs_update_extent_tree_range and is_inode_flag_set
by other process. it leads to clearing the whole exten
tree which should not have happened. And we fix it by
move the setting it to the range of write_lock.

Fixes:5f281fab ("f2fs: disable extent_cache for fcollapse/finsert inodes")
Signed-off-by: Zh...
c5ed3a37
Name Last commit Last update
Documentation iio: ABI: Fix wrong format of differential capacitance channel ABI.
LICENSES LICENSES: Rename other to deprecated
arch powerpc: Fix SPE Power ISA properties for e500v1 platforms
block blk-mq: don't create hctx debugfs dir until q->debugfs_dir is created
certs certs/blacklist_hashes.c: fix const confusion in certs blacklist
crypto crypto: akcipher - default implementation for setting a private key
drivers crypto: cavium - prevent integer overflow loading firmware
fs f2fs: fix race condition on setting FI_NO_EXTENT flag
include iommu/iova: Fix module config properly
init random: handle latent entropy and command line from random_init()
ipc ipc/mqueue: use get_tree_nodev() in mqueue_get_tree()
kernel cgroup/cpuset: Enable update_tasks_cpumask() on top_cpuset
lib dyndbg: let query-modname override actual module name
mm mm: pagewalk: Fix race between unmap and page walker
net once: add DO_ONCE_SLOW() for sleepable contexts
samples samples/kretprobes: Fix return value if register_kretprobe() failed
scripts kbuild: remove the target in signal traps when interrupted
security efi: Correct Macmini DMI match in uefi cert quirk
sound ALSA: hda/hdmi: Don't skip notification handling during PM operation
tools bpftool: Fix a wrong type cast in btf_dumper_int
usr initramfs: restore default compression behavior
virt KVM: Add infrastructure and macro to mark VM as bugged
.clang-format clang-format: Update with the latest for_each macro list
.cocciconfig scripts: add Linux .cocciconfig for coccinelle
.get_maintainer.ignore Opt out of scripts/get_maintainer.pl
.gitattributes .gitattributes: set git diff driver for C source code files
.gitignore Merge tag 'modules-for-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux
.mailmap Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
COPYING COPYING: use the new text with points to the license files
CREDITS MAINTAINERS: Remove Simon as Renesas SoC Co-Maintainer
Kbuild kbuild: do not descend to ./Kbuild when cleaning
Kconfig docs: kbuild: convert docs to ReST and rename to *.rst
MAINTAINERS MAINTAINERS: add Chandan as xfs maintainer for 5.4.y
Makefile Linux 5.4.219
README Drop all 00-INDEX files from Documentation/
Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.