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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8e235c73-faac-4cb7-bc6a-e1eea5075cbe@linux.alibaba.com>
Date: Wed, 14 Aug 2024 17:56:06 +0800
From: Jingbo Xu <jefflexu@...ux.alibaba.com>
To: yangyun <yangyun50@...wei.com>, Miklos Szeredi <miklos@...redi.hu>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
 lixiaokeng@...wei.com
Subject: Re: [PATCH] fuse: add fast path for fuse_range_is_writeback



On 8/14/24 5:36 PM, yangyun wrote:
> In some cases, the fi->writepages may be empty. And there is no need
> to check fi->writepages with spin_lock, which may have an impact on
> performance due to lock contention. For example, in scenarios where
> multiple readers read the same file without any writers, or where
> the page cache is not enabled.
> 
> Also remove the outdated comment since commit 6b2fb79963fb ("fuse:
> optimize writepages search") has optimize the situation by replacing
> list with rb-tree.
> 
> Signed-off-by: yangyun <yangyun50@...wei.com>
> ---
>  fs/fuse/file.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> index f39456c65ed7..59c911b61000 100644
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -448,9 +448,6 @@ static struct fuse_writepage_args *fuse_find_writeback(struct fuse_inode *fi,
>  
>  /*
>   * Check if any page in a range is under writeback
> - *
> - * This is currently done by walking the list of writepage requests
> - * for the inode, which can be pretty inefficient.
>   */
>  static bool fuse_range_is_writeback(struct inode *inode, pgoff_t idx_from,
>  				   pgoff_t idx_to)
> @@ -458,6 +455,9 @@ static bool fuse_range_is_writeback(struct inode *inode, pgoff_t idx_from,
>  	struct fuse_inode *fi = get_fuse_inode(inode);
>  	bool found;
>  
> +	if (RB_EMPTY_ROOT(&fi->writepages))
> +		return false;

fi->lock is held when inserting wpa into fi->writepages rbtree (see
fuse_writepage_add()).  I doubt if there is race condition when checking
if fi->writepages rbtree is empty without fi->lock held.


-- 
Thanks,
Jingbo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ