Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40bb0058 authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

f2fs: avoid to drop nat entries due to the negative nr_shrink



The try_to_free_nats should not receive the negative nr_shrink.
Otherwise, it can drop all the nat entries by the while loop.

Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
parent 3cb5ad15
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ int try_to_free_nats(struct f2fs_sb_info *sbi, int nr_shrink)
{
	struct f2fs_nm_info *nm_i = NM_I(sbi);

	if (nm_i->nat_cnt <= NM_WOUT_THRESHOLD)
	if (nm_i->nat_cnt <= NM_WOUT_THRESHOLD || nr_shrink <= 0)
		return 0;

	write_lock(&nm_i->nat_tree_lock);