mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] xfs: fix double mutex_lock() call in xfs_ioc_health_monitor()
@ 2026-09-10 13:29 Shigeru Yoshida
  2026-09-10 14:57 ` Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Shigeru Yoshida @ 2026-09-10 13:29 UTC (permalink / raw)
  To: Carlos Maiolino, Deepanshu Kartikey, Darrick J. Wong
  Cc: Shigeru Yoshida, linux-xfs, linux-kernel

Commit 4870da4f49ae ("xfs: take hm->lock in xfs_ioc_health_monitor()
before insert") intended to protect the __xfs_healthmon_insert() call
with hm->lock, but the second mutex operation was accidentally left as
mutex_lock() instead of mutex_unlock(), causing self-deadlock. Change
the second call to mutex_unlock() as originally intended.

Fixes: 4870da4f49ae ("xfs: take hm->lock in xfs_ioc_health_monitor() before insert")
Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
---
 fs/xfs/xfs_healthmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_healthmon.c b/fs/xfs/xfs_healthmon.c
index 6dc3f69d6798..c3749675ef19 100644
--- a/fs/xfs/xfs_healthmon.c
+++ b/fs/xfs/xfs_healthmon.c
@@ -1225,7 +1225,7 @@ xfs_ioc_health_monitor(
 	running_event->domain = XFS_HEALTHMON_MOUNT;
 	mutex_lock(&hm->lock);
 	__xfs_healthmon_insert(hm, INSERT_HEAD, running_event);
-	mutex_lock(&hm->lock);
+	mutex_unlock(&hm->lock);
 
 	/*
 	 * Preallocate the unmount event so that we can't fail to notify the
-- 
2.55.0


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

* Re: [PATCH] xfs: fix double mutex_lock() call in xfs_ioc_health_monitor()
  2026-09-10 13:29 [PATCH] xfs: fix double mutex_lock() call in xfs_ioc_health_monitor() Shigeru Yoshida
@ 2026-09-10 14:57 ` Darrick J. Wong
  2026-09-10 15:12   ` Carlos Maiolino
  0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2026-09-10 14:57 UTC (permalink / raw)
  To: Shigeru Yoshida
  Cc: Carlos Maiolino, Deepanshu Kartikey, linux-xfs, linux-kernel

On Thu, Sep 10, 2026 at 10:29:55PM +0900, Shigeru Yoshida wrote:
> Commit 4870da4f49ae ("xfs: take hm->lock in xfs_ioc_health_monitor()
> before insert") intended to protect the __xfs_healthmon_insert() call
> with hm->lock, but the second mutex operation was accidentally left as
> mutex_lock() instead of mutex_unlock(), causing self-deadlock. Change
> the second call to mutex_unlock() as originally intended.
> 
> Fixes: 4870da4f49ae ("xfs: take hm->lock in xfs_ioc_health_monitor() before insert")
> Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>

The original patch I reviewed unlocked hm->lock correctly, not sure how
it got corrupted by the tooling such that we need this.  I think cem
fixed it already(?) but in case anyone needs it,

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_healthmon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_healthmon.c b/fs/xfs/xfs_healthmon.c
> index 6dc3f69d6798..c3749675ef19 100644
> --- a/fs/xfs/xfs_healthmon.c
> +++ b/fs/xfs/xfs_healthmon.c
> @@ -1225,7 +1225,7 @@ xfs_ioc_health_monitor(
>  	running_event->domain = XFS_HEALTHMON_MOUNT;
>  	mutex_lock(&hm->lock);
>  	__xfs_healthmon_insert(hm, INSERT_HEAD, running_event);
> -	mutex_lock(&hm->lock);
> +	mutex_unlock(&hm->lock);
>  
>  	/*
>  	 * Preallocate the unmount event so that we can't fail to notify the
> -- 
> 2.55.0
> 
> 

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

* Re: [PATCH] xfs: fix double mutex_lock() call in xfs_ioc_health_monitor()
  2026-09-10 14:57 ` Darrick J. Wong
@ 2026-09-10 15:12   ` Carlos Maiolino
  0 siblings, 0 replies; 3+ messages in thread
From: Carlos Maiolino @ 2026-09-10 15:12 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: Shigeru Yoshida, Deepanshu Kartikey, linux-xfs, linux-kernel

On Thu, Sep 10, 2026 at 07:57:20AM -0700, Darrick J. Wong wrote:
> On Thu, Sep 10, 2026 at 10:29:55PM +0900, Shigeru Yoshida wrote:
> > Commit 4870da4f49ae ("xfs: take hm->lock in xfs_ioc_health_monitor()
> > before insert") intended to protect the __xfs_healthmon_insert() call
> > with hm->lock, but the second mutex operation was accidentally left as
> > mutex_lock() instead of mutex_unlock(), causing self-deadlock. Change
> > the second call to mutex_unlock() as originally intended.
> > 
> > Fixes: 4870da4f49ae ("xfs: take hm->lock in xfs_ioc_health_monitor() before insert")
> > Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
> 
> The original patch I reviewed unlocked hm->lock correctly, not sure how
> it got corrupted by the tooling such that we need this.  I think cem
> fixed it already(?) but in case anyone needs it,

yes, it's fixed already... I had not a single clue what happened, I
haven't changed any patch manually on this batch, might have been the
tooling with some weird fuzz to fix context conflicts, but most likely I
screwed up somewhere.

Whatever the reason, this is on me for not having double-checked the
result once I pulled the patches in, so I'm really sorry for that.

And thanks again Yoshida for having spotted it.

> 
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
> 
> --D
> 
> > ---
> >  fs/xfs/xfs_healthmon.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/xfs/xfs_healthmon.c b/fs/xfs/xfs_healthmon.c
> > index 6dc3f69d6798..c3749675ef19 100644
> > --- a/fs/xfs/xfs_healthmon.c
> > +++ b/fs/xfs/xfs_healthmon.c
> > @@ -1225,7 +1225,7 @@ xfs_ioc_health_monitor(
> >  	running_event->domain = XFS_HEALTHMON_MOUNT;
> >  	mutex_lock(&hm->lock);
> >  	__xfs_healthmon_insert(hm, INSERT_HEAD, running_event);
> > -	mutex_lock(&hm->lock);
> > +	mutex_unlock(&hm->lock);
> >  
> >  	/*
> >  	 * Preallocate the unmount event so that we can't fail to notify the
> > -- 
> > 2.55.0
> > 
> > 
> 

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

end of thread, other threads:[~2026-09-10 15:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-10 13:29 [PATCH] xfs: fix double mutex_lock() call in xfs_ioc_health_monitor() Shigeru Yoshida
2026-09-10 14:57 ` Darrick J. Wong
2026-09-10 15:12   ` Carlos Maiolino

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

all inboxes | Powered by JetHome®