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

authored by

Jia Zhu and committed by
David Howells
65aa5f6f 5c4588ae

+2 -1
+2 -1
fs/cachefiles/ondemand.c
··· 21 * anon_fd. 22 */ 23 xas_for_each(&xas, req, ULONG_MAX) { 24 - if (req->msg.opcode == CACHEFILES_OP_READ) { 25 req->error = -EIO; 26 complete(&req->done); 27 xas_store(&xas, NULL);
··· 21 * anon_fd. 22 */ 23 xas_for_each(&xas, req, ULONG_MAX) { 24 + if (req->msg.object_id == object_id && 25 + req->msg.opcode == CACHEFILES_OP_READ) { 26 req->error = -EIO; 27 complete(&req->done); 28 xas_store(&xas, NULL);