Re: [PATCH 16/62] md: Make mddev_suspend() easier to analyze

Paul Menzel <[email protected]>
Newsgroups gmane.linux.raid
Message-ID <[email protected]>
Dear Bart,


Thank you for the patch.

Am 23.02.26 um 22:49 schrieb Bart Van Assche:
> Prepare for enabling Clang's thread-safety analysis by moving an
> if-statement. No functionality has been changed.

Why does the if-statement need to be moved? Could you explain it in the 
commit message?

> Cc: Song Liu <[email protected]>
> Cc: Yu Kuai <[email protected]>
> Cc: [email protected]
> Signed-off-by: Bart Van Assche <[email protected]>
> ---
>   drivers/md/md.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 3ce6f9e9d38e..b0d260d03a7d 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -475,12 +475,13 @@ int mddev_suspend(struct mddev *mddev, bool interruptible)
>   	 */
>   	lockdep_assert_not_held(&mddev->reconfig_mutex);
>   
> -	if (interruptible)
> +	if (interruptible) {
>   		err = mutex_lock_interruptible(&mddev->suspend_mutex);
> -	else
> +		if (err)
> +			return err;
> +	} else {
>   		mutex_lock(&mddev->suspend_mutex);
> -	if (err)
> -		return err;
> +	}
>   
>   	if (mddev->suspended) {
>   		WRITE_ONCE(mddev->suspended, mddev->suspended + 1);
> 


Kind regards,

Paul
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.