summaryrefslogtreecommitdiffstats
path: root/fs/cachefiles
diff options
context:
space:
mode:
authorJia Zhu <zhujia.zj@bytedance.com>2022-06-09 16:54:10 +0800
committerDavid Howells <dhowells@redhat.com>2022-07-05 16:12:21 +0100
commit65aa5f6fd8a12e0a343aaf1815949a79a49e3f35 (patch)
tree2f0f615fe963c85c974034675921d6314881ea4d /fs/cachefiles
parent5c4588aea6675b69e328d468c5b6be5127e19a79 (diff)
downloadlinux-stable-65aa5f6fd8a12e0a343aaf1815949a79a49e3f35.tar.gz
linux-stable-65aa5f6fd8a12e0a343aaf1815949a79a49e3f35.tar.bz2
linux-stable-65aa5f6fd8a12e0a343aaf1815949a79a49e3f35.zip
cachefiles: narrow the scope of flushed requests when releasing fd
When an anonymous fd is released, only flush the requests associated with it, rather than all of requests in xarray. Fixes: 9032b6e8589f ("cachefiles: implement on-demand read") Signed-off-by: Jia Zhu <zhujia.zj@bytedance.com> Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeffle Xu <jefflexu@linux.alibaba.com> Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com> Link: https://listman.redhat.com/archives/linux-cachefs/2022-June/006937.html
Diffstat (limited to 'fs/cachefiles')
-rw-r--r--fs/cachefiles/ondemand.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/cachefiles/ondemand.c b/fs/cachefiles/ondemand.c
index a41ae6efc545..1fee702d5529 100644
--- a/fs/cachefiles/ondemand.c
+++ b/fs/cachefiles/ondemand.c
@@ -21,7 +21,8 @@ static int cachefiles_ondemand_fd_release(struct inode *inode,
* anon_fd.
*/
xas_for_each(&xas, req, ULONG_MAX) {
- if (req->msg.opcode == CACHEFILES_OP_READ) {
+ if (req->msg.object_id == object_id &&
+ req->msg.opcode == CACHEFILES_OP_READ) {
req->error = -EIO;
complete(&req->done);
xas_store(&xas, NULL);