[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a5c8edce-a314-4321-b2fb-4ed2dfeea481@bytedance.com>
Date: Tue, 2 Jul 2024 20:31:18 +0800
From: Jia Zhu <zhujia.zj@...edance.com>
To: libaokun@...weicloud.com, netfs@...ts.linux.dev, dhowells@...hat.com,
jlayton@...nel.org
Cc: hsiangkao@...ux.alibaba.com, jefflexu@...ux.alibaba.com,
linux-erofs@...ts.ozlabs.org, brauner@...nel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
yangerkun@...wei.com, houtao1@...wei.com, yukuai3@...wei.com,
wozizhi@...wei.com, Baokun Li <libaokun1@...wei.com>, zhujia.zj@...edance.com
Subject: Re: [External] [PATCH v3 6/9] cachefiles: cancel all requests for the
object that is being dropped
在 2024/6/28 14:29, libaokun@...weicloud.com 写道:
> From: Baokun Li <libaokun1@...wei.com>
>
> Because after an object is dropped, requests for that object are useless,
> cancel them to avoid causing other problems.
>
> This prepares for the later addition of cancel_work_sync(). After the
> reopen requests is generated, cancel it to avoid cancel_work_sync()
> blocking by waiting for daemon to complete the reopen requests.
>
> Signed-off-by: Baokun Li <libaokun1@...wei.com>
> Acked-by: Jeff Layton <jlayton@...nel.org>
Reviewed-by: Jia Zhu <zhujia.zj@...edance.com>
> ---
> fs/cachefiles/ondemand.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/fs/cachefiles/ondemand.c b/fs/cachefiles/ondemand.c
> index 8a3b52c3ebba..36b97ded16b4 100644
> --- a/fs/cachefiles/ondemand.c
> +++ b/fs/cachefiles/ondemand.c
> @@ -669,12 +669,31 @@ int cachefiles_ondemand_init_object(struct cachefiles_object *object)
>
> void cachefiles_ondemand_clean_object(struct cachefiles_object *object)
> {
> + unsigned long index;
> + struct cachefiles_req *req;
> + struct cachefiles_cache *cache;
> +
> if (!object->ondemand)
> return;
>
> cachefiles_ondemand_send_req(object, CACHEFILES_OP_CLOSE, 0,
> cachefiles_ondemand_init_close_req, NULL);
> +
> + if (!object->ondemand->ondemand_id)
> + return;
> +
> + /* Cancel all requests for the object that is being dropped. */
> + cache = object->volume->cache;
> + xa_lock(&cache->reqs);
> cachefiles_ondemand_set_object_dropping(object);
> + xa_for_each(&cache->reqs, index, req) {
> + if (req->object == object) {
> + req->error = -EIO;
> + complete(&req->done);
> + __xa_erase(&cache->reqs, index);
> + }
> + }
> + xa_unlock(&cache->reqs);
> }
>
> int cachefiles_ondemand_init_obj_info(struct cachefiles_object *object,
Powered by blists - more mailing lists