Skip to contentSkip to conversation

xfs: take hm->lock in xfs_ioc_health_monitor() before insert

PATCH Applied Deepanshu Kartikey 5 participants 10 messages Sep 6 – Sep 11 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: take hm->lock in xfs_ioc_health_monitor() before insert

__xfs_healthmon_insert() asserts that hm->lock is held (lockdep_assert_held), but xfs_ioc_health_monitor() called it right after allocating hm, before ever taking the lock, triggering a lockdep warning.

Take hm->lock around the call.

Fixes b3a289a2a9397 ("xfs: create event queuing, formatting, and discovery infrastructure")
Reported-by [email protected]
---
 fs/xfs/xfs_healthmon.c | 2 ++
 1 file changed, 2 insertions(+)
fs/xfs/xfs_healthmon.c +2 -0
index 3ae5f4496ad1..2f762f90d329 100644
@@ -1219,7 +1219,9 @@ xfs_ioc_health_monitor(
 	}
 	running_event->type = XFS_HEALTHMON_RUNNING;
 	running_event->domain = XFS_HEALTHMON_MOUNT;
+	mutex_lock(&hm->lock);
 	__xfs_healthmon_insert(hm, running_event);
+	mutex_unlock(&hm->lock);
 
 	/*
 	 * Preallocate the unmount event so that we can't fail to notify the
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Deepanshu Kartikey

__xfs_healthmon_insert() asserts that hm->lock is held (lockdep_assert_held), but xfs_ioc_health_monitor() called it right after allocating hm, before ever taking the lock, triggering a lockdep warning.

Take hm->lock around the call.

Fixes b3a289a2a9397 ("xfs: create event queuing, formatting, and discovery infrastructure")
Reported-by [email protected]

Heh, I added a patch just like this one to my own tree.

--D

Quoted 22 lines
---
 fs/xfs/xfs_healthmon.c | 2 ++
 1 file changed, 2 insertions(+)
fs/xfs/xfs_healthmon.c +2 -0
index 3ae5f4496ad1..2f762f90d329 100644
@@ -1219,7 +1219,9 @@ xfs_ioc_health_monitor(
 	}
 	running_event->type = XFS_HEALTHMON_RUNNING;
 	running_event->domain = XFS_HEALTHMON_MOUNT;
+	mutex_lock(&hm->lock);
 	__xfs_healthmon_insert(hm, running_event);
+	mutex_unlock(&hm->lock);
 
 	/*
 	 * Preallocate the unmount event so that we can't fail to notify the
Signature · 1 line
2.34.1
#2 lore raw
Quoted 8 lines · Darrick J. Wong
Quoted 7 lines · Deepanshu Kartikey

__xfs_healthmon_insert() asserts that hm->lock is held (lockdep_assert_held), but xfs_ioc_health_monitor() called it right after allocating hm, before ever taking the lock, triggering a lockdep warning.

Take hm->lock around the call.

Quoted 7 lines
Quoted 4 lines
Fixes b3a289a2a9397 ("xfs: create event queuing, formatting, and discovery infrastructure")
Reported-by [email protected]

Heh, I added a patch just like this one to my own tree.

Can we get this queued up ASAP? It's also causing a lot of failures in our zoned XFS CI.

maintainer
#3 lore raw
Quoted 14 lines · Christoph Hellwig
Quoted 13 lines · Darrick J. Wong
Quoted 11 lines · Deepanshu Kartikey

__xfs_healthmon_insert() asserts that hm->lock is held (lockdep_assert_held), but xfs_ioc_health_monitor() called it right after allocating hm, before ever taking the lock, triggering a lockdep warning.

Take hm->lock around the call.

Fixes b3a289a2a9397 ("xfs: create event queuing, formatting, and discovery infrastructure")
Reported-by [email protected]
Quoted 6 lines
Quoted 2 lines

Heh, I added a patch just like this one to my own tree.

Can we get this queued up ASAP? It's also causing a lot of failures in our zoned XFS CI.

Yes, give me a few minutes and I'll have it today, ready for the next rc

maintainer
#4 lore raw
In reply to Christoph Hellwig
Quoted 14 lines · Christoph Hellwig
Quoted 13 lines · Darrick J. Wong
Quoted 11 lines · Deepanshu Kartikey

__xfs_healthmon_insert() asserts that hm->lock is held (lockdep_assert_held), but xfs_ioc_health_monitor() called it right after allocating hm, before ever taking the lock, triggering a lockdep warning.

Take hm->lock around the call.

Fixes b3a289a2a9397 ("xfs: create event queuing, formatting, and discovery infrastructure")
Reported-by [email protected]
Quoted 7 lines
Quoted 2 lines

Heh, I added a patch just like this one to my own tree.

Can we get this queued up ASAP? It's also causing a lot of failures in our zoned XFS CI.

Oh... this is actually already in my queue, I just need to push it :)

I'm just trying to get darricks attr fsblock fix in too because that is also failing my own testing here.

maintainer
#5 lore raw
In reply to Christoph Hellwig
Quoted 14 lines · Christoph Hellwig
Quoted 13 lines · Darrick J. Wong
Quoted 11 lines · Deepanshu Kartikey

__xfs_healthmon_insert() asserts that hm->lock is held (lockdep_assert_held), but xfs_ioc_health_monitor() called it right after allocating hm, before ever taking the lock, triggering a lockdep warning.

Take hm->lock around the call.

Fixes b3a289a2a9397 ("xfs: create event queuing, formatting, and discovery infrastructure")
Reported-by [email protected]
Quoted 7 lines
Quoted 2 lines

Heh, I added a patch just like this one to my own tree.

Can we get this queued up ASAP? It's also causing a lot of failures in our zoned XFS CI.

Done. It's in for-next already. Not sure if I'll manage to push the attrs fsblock fix yet this -rc, but this one will go to Linus on Saturday

#6 lore raw
Quoted 18 lines · Carlos Maiolino
Quoted 17 lines · Christoph Hellwig
Quoted 15 lines · Darrick J. Wong
Quoted 11 lines · Deepanshu Kartikey

__xfs_healthmon_insert() asserts that hm->lock is held (lockdep_assert_held), but xfs_ioc_health_monitor() called it right after allocating hm, before ever taking the lock, triggering a lockdep warning.

Take hm->lock around the call.

Fixes b3a289a2a9397 ("xfs: create event queuing, formatting, and discovery infrastructure")
Reported-by [email protected]

Heh, I added a patch just like this one to my own tree.

Quoted 8 lines
Quoted 4 lines

Can we get this queued up ASAP? It's also causing a lot of failures in our zoned XFS CI.

Done. It's in for-next already. Not sure if I'll manage to push the attrs fsblock fix yet this -rc, but this one will go to Linus on Saturday

I noticed that the second mutex operation in this commit was accidentally left as mutex_lock() instead of mutex_unlock(). I've sent a fix as a separate patch ("xfs: fix double mutex_lock() call in xfs_ioc_health_monitor()"). Feel free to use it if it helps.

Thanks,
Shigeru

maintainer
#7 lore raw
Quoted 25 lines · Shigeru Yoshida
Quoted 23 lines · Carlos Maiolino
Quoted 21 lines · Christoph Hellwig
Quoted 8 lines · Darrick J. Wong
Quoted 7 lines · Deepanshu Kartikey

__xfs_healthmon_insert() asserts that hm->lock is held (lockdep_assert_held), but xfs_ioc_health_monitor() called it right after allocating hm, before ever taking the lock, triggering a lockdep warning.

Take hm->lock around the call.

Quoted 7 lines
Quoted 4 lines
Fixes b3a289a2a9397 ("xfs: create event queuing, formatting, and discovery infrastructure")
Reported-by [email protected]

Heh, I added a patch just like this one to my own tree.

Can we get this queued up ASAP? It's also causing a lot of failures in our zoned XFS CI.

Quoted 8 lines
Quoted 3 lines

Done. It's in for-next already. Not sure if I'll manage to push the attrs fsblock fix yet this -rc, but this one will go to Linus on Saturday

I noticed that the second mutex operation in this commit was accidentally left as mutex_lock() instead of mutex_unlock(). I've sent a fix as a separate patch ("xfs: fix double mutex_lock() call in xfs_ioc_health_monitor()"). Feel free to use it if it helps.

Thanks for the info, something went pretty wrong with b4. I didn't touch the patch manually and somehow it got twisted when I pulled it. I'll figure it out what went wrong but first let me fix this...

This shouldn't be in the tree at all, so I'll remove the patch for now as this has not been pulled into the linux-next.

Quoted 5 lines

Thanks,
Shigeru

maintainer Applied
#8 lore raw
In reply to Deepanshu Kartikey
Quoted 8 lines · Deepanshu Kartikey

__xfs_healthmon_insert() asserts that hm->lock is held (lockdep_assert_held), but xfs_ioc_health_monitor() called it right after allocating hm, before ever taking the lock, triggering a lockdep warning.

Take hm->lock around the call.

[...]

Applied to for-next, thanks!

[1/1] xfs: take hm->lock in xfs_ioc_health_monitor() before insert

      commit: 4870da4f49ae2df4f804a6f770d56846e57495d7

Best regards,

Signature · 1 line
Carlos Maiolino <[email protected]>
maintainer Applied
#9 lore raw
In reply to Deepanshu Kartikey
Quoted 8 lines · Deepanshu Kartikey

__xfs_healthmon_insert() asserts that hm->lock is held (lockdep_assert_held), but xfs_ioc_health_monitor() called it right after allocating hm, before ever taking the lock, triggering a lockdep warning.

Take hm->lock around the call.

[...]

Applied to for-next, thanks!

[1/1] xfs: take hm->lock in xfs_ioc_health_monitor() before insert

      commit: e240919ca727776f16a468d3d90686dc82cfe9cb

Best regards,

Signature · 1 line
Carlos Maiolino <[email protected]>