Re: [PATCH] blk-mq: use mutex_trylock to avoid lock inversion

From: Bart Van Assche
Date: Tue Jun 19 2018 - 11:20:48 EST


On Tue, 2018-06-19 at 15:00 +0800, Jianchao Wang wrote:
> Currently, the kobject_del for kobjs of mq, hctx and ctx is invoked
> under sysfs_lock, lock inversion will come up when other one is
> acessing the associated sysfs file and trying to acquire the
> sysfs_lock. To fix it, use mutex_trylock in blk_mq_sysfs_ops and
> blk_mq_hw_sysfs_ops, if the lock in on contending, return -EAGAIN.

Is this a theoretical issue or something you actually ran into? Which lock
other than sysfs_lock do you think is involved in the lock inversion?

Bart.