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]
Message-ID: <apzp52dtiqmcnyrapztovqmw7lhfw7c4yefvup2rapcdes527n@l2r7v2noqxek>
Date: Mon, 31 Mar 2025 11:58:39 +0200
From: Jan Kara <jack@...e.cz>
To: Christian Brauner <brauner@...nel.org>
Cc: linux-fsdevel@...r.kernel.org, jack@...e.cz, 
	linux-kernel@...r.kernel.org, James Bottomley <James.Bottomley@...senpartnership.com>, 
	mcgrof@...nel.org, hch@...radead.org, david@...morbit.com, rafael@...nel.org, 
	djwong@...nel.org, pavel@...nel.org, peterz@...radead.org, mingo@...hat.com, 
	will@...nel.org, boqun.feng@...il.com
Subject: Re: [PATCH v2 2/6] super: simplify user_get_super()

On Sat 29-03-25 09:42:15, Christian Brauner wrote:
> Make it easier to read and remove one level of identation.
> 
> Signed-off-by: Christian Brauner <brauner@...nel.org>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> ---
>  fs/super.c | 29 +++++++++++++++--------------
>  1 file changed, 15 insertions(+), 14 deletions(-)
> 
> diff --git a/fs/super.c b/fs/super.c
> index dc14f4bf73a6..b1acfc38ba0c 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -987,20 +987,21 @@ struct super_block *user_get_super(dev_t dev, bool excl)
>  
>  	spin_lock(&sb_lock);
>  	list_for_each_entry(sb, &super_blocks, s_list) {
> -		if (sb->s_dev == dev) {
> -			bool locked;
> -
> -			sb->s_count++;
> -			spin_unlock(&sb_lock);
> -			/* still alive? */
> -			locked = super_lock(sb, excl);
> -			if (locked)
> -				return sb; /* caller will drop */
> -			/* nope, got unmounted */
> -			spin_lock(&sb_lock);
> -			__put_super(sb);
> -			break;
> -		}
> +		bool locked;
> +
> +		if (sb->s_dev != dev)
> +			continue;
> +
> +		sb->s_count++;
> +		spin_unlock(&sb_lock);
> +
> +		locked = super_lock(sb, excl);
> +		if (locked)
> +			return sb;
> +
> +		spin_lock(&sb_lock);
> +		__put_super(sb);
> +		break;
>  	}
>  	spin_unlock(&sb_lock);
>  	return NULL;
> 
> -- 
> 2.47.2
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ