Skip to content

Commit

Permalink
cachefiles: narrow the scope of flushed requests when releasing fd
Browse files Browse the repository at this point in the history
When an anonymous fd is released, only flush the requests
associated with it, rather than all of requests in xarray.

Fixes: 9032b6e ("cachefiles: implement on-demand read")
Signed-off-by: Jia Zhu <[email protected]>
Signed-off-by: David Howells <[email protected]>
Reviewed-by: Jeffle Xu <[email protected]>
Reviewed-by: Gao Xiang <[email protected]>
Link: https://listman.redhat.com/archives/linux-cachefs/2022-June/006937.html
  • Loading branch information
Jia Zhu authored and dhowells committed Jul 5, 2022
1 parent 5c4588a commit 65aa5f6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/cachefiles/ondemand.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 65aa5f6

Please sign in to comment.