public inbox for linux-raid@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 16/62] md: Make mddev_suspend() easier to analyze
       [not found] <20260223214950.2153735-1-bvanassche@acm.org>
@ 2026-02-23 21:49 ` Bart Van Assche
  2026-02-23 22:01   ` Paul Menzel
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Van Assche @ 2026-02-23 21:49 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Bart Van Assche, Song Liu, Yu Kuai, linux-raid

Prepare for enabling Clang's thread-safety analysis by moving an
if-statement. No functionality has been changed.

Cc: Song Liu <song@kernel.org>
Cc: Yu Kuai <yukuai@fnnas.com>
Cc: linux-raid@vger.kernel.org
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 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);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 16/62] md: Make mddev_suspend() easier to analyze
       [not found] <20260223215118.2154194-1-bvanassche@acm.org>
@ 2026-02-23 21:50 ` Bart Van Assche
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2026-02-23 21:50 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Ingo Molnar, Will Deacon, Boqun Feng, Waiman Long, linux-kernel,
	Marco Elver, Christoph Hellwig, Steven Rostedt, Nick Desaulniers,
	Nathan Chancellor, Kees Cook, Jann Horn, Bart Van Assche,
	Song Liu, Yu Kuai, linux-raid

Prepare for enabling Clang's thread-safety analysis by moving an
if-statement. No functionality has been changed.

Cc: Song Liu <song@kernel.org>
Cc: Yu Kuai <yukuai@fnnas.com>
Cc: linux-raid@vger.kernel.org
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 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);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 16/62] md: Make mddev_suspend() easier to analyze
       [not found] <20260223220102.2158611-1-bart.vanassche@linux.dev>
@ 2026-02-23 22:00 ` Bart Van Assche
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2026-02-23 22:00 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Ingo Molnar, Will Deacon, Boqun Feng, Waiman Long, linux-kernel,
	Marco Elver, Christoph Hellwig, Steven Rostedt, Nick Desaulniers,
	Nathan Chancellor, Kees Cook, Jann Horn, Bart Van Assche,
	Song Liu, Yu Kuai, linux-raid

From: Bart Van Assche <bvanassche@acm.org>

Prepare for enabling Clang's thread-safety analysis by moving an
if-statement. No functionality has been changed.

Cc: Song Liu <song@kernel.org>
Cc: Yu Kuai <yukuai@fnnas.com>
Cc: linux-raid@vger.kernel.org
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 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);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 16/62] md: Make mddev_suspend() easier to analyze
  2026-02-23 21:49 ` Bart Van Assche
@ 2026-02-23 22:01   ` Paul Menzel
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Menzel @ 2026-02-23 22:01 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Peter Zijlstra, Song Liu, Yu Kuai, linux-raid

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 <song@kernel.org>
> Cc: Yu Kuai <yukuai@fnnas.com>
> Cc: linux-raid@vger.kernel.org
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-23 22:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260223220102.2158611-1-bart.vanassche@linux.dev>
2026-02-23 22:00 ` [PATCH 16/62] md: Make mddev_suspend() easier to analyze Bart Van Assche
     [not found] <20260223215118.2154194-1-bvanassche@acm.org>
2026-02-23 21:50 ` Bart Van Assche
     [not found] <20260223214950.2153735-1-bvanassche@acm.org>
2026-02-23 21:49 ` Bart Van Assche
2026-02-23 22:01   ` Paul Menzel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox