linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cachefiles: narrow the scope of flushed requests when releasing fd
       [not found] <1a03d5de-e0cf-b23d-b12a-f46795125968@bytedance.com>
@ 2022-06-09  8:54 ` Jia Zhu
  2022-06-09 11:13   ` JeffleXu
  2022-06-10  9:03   ` Gao Xiang
  0 siblings, 2 replies; 3+ messages in thread
From: Jia Zhu @ 2022-06-09  8:54 UTC (permalink / raw)
  To: Jeffle Xu, dhowells; +Cc: linux-cachefs, hsiangkao, linux-erofs, yinxin.x


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>
---
  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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cachefiles: narrow the scope of flushed requests when releasing fd
  2022-06-09  8:54 ` [PATCH] cachefiles: narrow the scope of flushed requests when releasing fd Jia Zhu
@ 2022-06-09 11:13   ` JeffleXu
  2022-06-10  9:03   ` Gao Xiang
  1 sibling, 0 replies; 3+ messages in thread
From: JeffleXu @ 2022-06-09 11:13 UTC (permalink / raw)
  To: Jia Zhu, dhowells; +Cc: hsiangkao, linux-cachefs, linux-erofs, yinxin.x


Hi, Jia Zhu,

Thanks for fixing this.


On 6/9/22 4:54 PM, 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@bytedance.com>
> ---
>  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);

LGTM.

Reviewed-by: Jeffle Xu <jefflexu@linux.alibaba.com>

-- 
Thanks,
Jeffle

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cachefiles: narrow the scope of flushed requests when releasing fd
  2022-06-09  8:54 ` [PATCH] cachefiles: narrow the scope of flushed requests when releasing fd Jia Zhu
  2022-06-09 11:13   ` JeffleXu
@ 2022-06-10  9:03   ` Gao Xiang
  1 sibling, 0 replies; 3+ messages in thread
From: Gao Xiang @ 2022-06-10  9:03 UTC (permalink / raw)
  To: Jia Zhu, David Howells; +Cc: linux-cachefs, linux-erofs, yinxin.x

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@bytedance.com>

Looks good to me, thanks for catching this!

Reviewed-by: Gao Xiang <hsiangkao@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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-10  9:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1a03d5de-e0cf-b23d-b12a-f46795125968@bytedance.com>
2022-06-09  8:54 ` [PATCH] cachefiles: narrow the scope of flushed requests when releasing fd Jia Zhu
2022-06-09 11:13   ` JeffleXu
2022-06-10  9:03   ` Gao Xiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).