lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 27 Jun 2024 07:01:37 -0400
From: Jeff Layton <jlayton@...nel.org>
To: libaokun@...weicloud.com, netfs@...ts.linux.dev, dhowells@...hat.com
Cc: hsiangkao@...ux.alibaba.com, jefflexu@...ux.alibaba.com, 
 zhujia.zj@...edance.com, linux-erofs@...ts.ozlabs.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>
Subject: Re: [PATCH v2 2/5] cachefiles: flush all requests for the object
 that is being dropped

On Wed, 2024-05-15 at 20:51 +0800, libaokun@...weicloud.com wrote:
> From: Baokun Li <libaokun1@...wei.com>
> 
> Because after an object is dropped, requests for that object are
> useless,
> flush them to avoid causing other problems.
> 
> This prepares for the later addition of cancel_work_sync(). After the
> reopen requests is generated, flush it to avoid cancel_work_sync()
> blocking by waiting for daemon to complete the reopen requests.
> 
> Signed-off-by: Baokun Li <libaokun1@...wei.com>
> ---
>  fs/cachefiles/ondemand.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/fs/cachefiles/ondemand.c b/fs/cachefiles/ondemand.c
> index 73da4d4eaa9b..d24bff43499b 100644
> --- a/fs/cachefiles/ondemand.c
> +++ b/fs/cachefiles/ondemand.c
> @@ -564,12 +564,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;
> +
> +	/* Flush all requests for the object that is being dropped.
> */

I wouldn't call this a "Flush". In the context of writeback, that
usually means that we're writing out pages now in order to do something
else. In this case, it looks like you're more canceling these requests
since you're marking them with an error and declaring them complete.

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

-- 
Jeff Layton <jlayton@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ