Re: [PATCH 06/11] block: fix queue freeze vs limits lock order in sysfs store methods

Christoph Hellwig
2025-01-10T09:33:17Z

On Thu, Jan 09, 2025 at 01:07:47PM +0000, John Garry wrote:
> Do you mean that the sysfs_lock could be removed in future? I would have
> thought that queue limits lock could be used for the same thing, but I am
> probably failing to see some lock nesting/ordering issues...

More or less. Think about it: what does it even try to protect?

Readіng/writing sysfs files vs itself and file removal it serialized by
sysfs/kernfs internally.

Any information tweaked in sysfs usually also has other places that can
modify it. So we'll need a lock independent of sysfs for that anyway.
A big part, buy by far all of that is covered by limits_lock.

Serializing creating/removing sysfs attribues is supposed to be
serialized using sysfs_dir_lock, although that needs a careful audit.

It's also used to serialize a few debugfs things, but we'll need to look
carefully for what exactly and switch that over to debugfs_mutex or
something new.

And then there's a bunch of misc cruft that also needs a careful look.