diff options
author | Jingbo Xu <[email protected]> | 2022-11-04 13:40:27 +0800 |
---|---|---|
committer | Gao Xiang <[email protected]> | 2022-11-08 14:45:44 +0800 |
commit | 75e43355cbe4d5948a79bd592f2ffecb9f75f75d (patch) | |
tree | 2c569786a7bc1f8bcb3e635e2cbdd9e9a48dbe59 | |
parent | e5126de138caef0eedb3d6431059c0c5581a1a5d (diff) |
erofs: put metabuf in error path in fscache mode
For tail packing layout, put metabuf when error is encountered.
Fixes: 1ae9470c3e14 ("erofs: clean up .read_folio() and .readahead() in fscache mode")
Signed-off-by: Jingbo Xu <[email protected]>
Reviewed-by: Gao Xiang <[email protected]>
Reviewed-by: Jia Zhu <[email protected]>
Reviewed-by: Chao Yu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Gao Xiang <[email protected]>
-rw-r--r-- | fs/erofs/fscache.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c index fe05bc51f9f2..83559008bfa8 100644 --- a/fs/erofs/fscache.c +++ b/fs/erofs/fscache.c @@ -287,8 +287,10 @@ static int erofs_fscache_data_read(struct address_space *mapping, return PTR_ERR(src); iov_iter_xarray(&iter, READ, &mapping->i_pages, pos, PAGE_SIZE); - if (copy_to_iter(src + offset, size, &iter) != size) + if (copy_to_iter(src + offset, size, &iter) != size) { + erofs_put_metabuf(&buf); return -EFAULT; + } iov_iter_zero(PAGE_SIZE - size, &iter); erofs_put_metabuf(&buf); return PAGE_SIZE; |