]> git.baikalelectronics.ru Git - kernel.git/commit
f2fs: extend stat_lock to avoid potential race in statfs
authorNiels Dossche <dossche.niels@gmail.com>
Fri, 22 Apr 2022 18:05:04 +0000 (20:05 +0200)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 6 May 2022 17:18:11 +0000 (10:18 -0700)
commitdd2cb2b2cd4dbe7a099c5dcb778dcba783b97b0d
tree4aaf71fd474dc807b387323f78ebf95e012cdbe8
parent3f4c1287f1953ca520c6727d0be6bbd35e278840
f2fs: extend stat_lock to avoid potential race in statfs

There are multiple calculations and reads of fields of sbi that should
be protected by stat_lock. As stat_lock is not used to read these
values in statfs, this can lead to inconsistent results.
Extend the locking to prevent this issue.
Commit 40a68ab627ab ("f2fs: fix to avoid potential race on
sbi->unusable_block_count access/update")
already added the use of sbi->stat_lock in statfs in
order to make the calculation of multiple, different fields atomic so
that results are consistent. This is similar to that patch regarding the
change in statfs.

Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/super.c