summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChao Yu <chao@kernel.org>2024-02-26 04:19:16 +0100
committerJaegeuk Kim <jaegeuk@kernel.org>2024-03-04 18:51:52 +0100
commit2fc2bcc8d39945ac9e26114280d2b6d1e624825c (patch)
tree7d8741b2026e9dbe1241e2fa9fd84ea48520995d /fs
parentf2fs: fix to use correct segment type in f2fs_allocate_data_block() (diff)
downloadlinux-2fc2bcc8d39945ac9e26114280d2b6d1e624825c.tar.xz
linux-2fc2bcc8d39945ac9e26114280d2b6d1e624825c.zip
f2fs: fix to check return value in f2fs_insert_range()
In f2fs_insert_range(), it missed to check return value of filemap_write_and_wait_range(), fix it. Meanwhile, just return error number once __exchange_data_block() fails. Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/file.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 1c044fb19c87..4ca6c693b33a 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1679,10 +1679,12 @@ static int f2fs_insert_range(struct inode *inode, loff_t offset, loff_t len)
}
filemap_invalidate_unlock(mapping);
f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
+ if (ret)
+ return ret;
/* write out all moved pages, if possible */
filemap_invalidate_lock(mapping);
- filemap_write_and_wait_range(mapping, offset, LLONG_MAX);
+ ret = filemap_write_and_wait_range(mapping, offset, LLONG_MAX);
truncate_pagecache(inode, offset);
filemap_invalidate_unlock(mapping);