[PATCH] cachefiles: narrow the scope of flushed requests when releasing fd

Gao Xiang hsiangkao at linux.alibaba.com
Fri Jun 10 19:03:06 AEST 2022


On Thu, Jun 09, 2022 at 04:54:10PM +0800, Jia Zhu wrote:
> 
> 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 at bytedance.com>

Looks good to me, thanks for catching this!

Reviewed-by: Gao Xiang <hsiangkao at linux.alibaba.com>

Hi David,

Could you apply this patch to your tree? I think it'd be much better
to have cachefiles patches via your tree as long as no code coupling..

Thanks a lot!

Thanks,
Gao Xiang


> ---
>  fs/cachefiles/ondemand.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> 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);
> -- 
> 2.20.1
> 


More information about the Linux-erofs mailing list