linux-stable/fs/ubifs
Zhihao Cheng f7e252d7e4 ubifs: Rectify space amount budget for mkdir/tmpfile operations
[ Upstream commit a6dab6607d ]

UBIFS should make sure the flash has enough space to store dirty (Data
that is newer than disk) data (in memory), space budget is exactly
designed to do that. If space budget calculates less data than we need,
'make_reservation()' will do more work(return -ENOSPC if no free space
lelf, sometimes we can see "cannot reserve xxx bytes in jhead xxx, error
-28" in ubifs error messages) with ubifs inodes locked, which may effect
other syscalls.

A simple way to decide how much space do we need when make a budget:
See how much space is needed by 'make_reservation()' in ubifs_jnl_xxx()
function according to corresponding operation.

It's better to report ENOSPC in ubifs_budget_space(), as early as we can.

Fixes: 474b93704f ("ubifs: Implement O_TMPFILE")
Fixes: 1e51764a3c ("UBIFS: add new flash file system")
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-20 09:08:25 +02:00
..
budget.c
commit.c
compress.c
crypto.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
debug.c ubifs: dent: Fix some potential memory leaks while iterating entries 2020-11-05 11:07:02 +01:00
debug.h
dir.c ubifs: Rectify space amount budget for mkdir/tmpfile operations 2022-04-20 09:08:25 +02:00
file.c ubifs: Fix deadlock in concurrent bulk-read and writepage 2020-02-14 16:32:10 -05:00
find.c
gc.c
io.c ubifs: wbuf: Don't leak kernel memory to flash 2021-01-17 13:58:59 +01:00
ioctl.c ubifs: setflags: Make dirtied_ino_d 8 bytes aligned 2022-04-20 09:08:24 +02:00
journal.c ubifs: Fix synced_i_size calculation for xattr inodes 2018-09-09 19:56:00 +02:00
Kconfig ubifs: Add CONFIG_UBIFS_FS_SECURITY to disable/enable security labels 2017-05-08 20:48:23 +02:00
key.h ubifs: Add assert to dent_key_init() 2017-07-14 22:49:06 +02:00
log.c
lprops.c ubifs: Fix memory leak in lprobs self-check 2018-09-09 19:56:00 +02:00
lpt.c
lpt_commit.c
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
master.c
misc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
misc.h fs: ubifs: replace CURRENT_TIME_SEC with current_time 2017-05-08 17:15:15 -07:00
orphan.c
recovery.c ubifs: Remove unnecessary assignment 2017-05-08 20:48:47 +02:00
replay.c ubifs: Handle re-linking of inodes correctly while recovery 2018-12-29 13:39:11 +01:00
sb.c fs: ubifs: replace CURRENT_TIME_SEC with current_time 2017-05-08 17:15:15 -07:00
scan.c
shrinker.c
super.c ubifs: Error path in ubifs_remount_rw() seems to wrongly free write buffers 2022-01-27 09:00:59 +01:00
tnc.c ubifs: Correctly use tnc_next() in search_dh_cookie() 2019-09-19 09:08:06 +02:00
tnc_commit.c ubifs: Fail commit if TNC is obviously inconsistent 2017-07-14 22:49:07 +02:00
tnc_misc.c
ubifs-media.h
ubifs.h ubifs: Massage assert in ubifs_xattr_set() wrt. init_xattrs 2017-07-14 22:50:54 +02:00
xattr.c Revert "ubifs: xattr: Don't operate on deleted inodes" 2018-09-29 03:06:04 -07:00