Re: deadlock in synchronize_srcu() in debugfs?

From: Johannes Berg
Date: Thu Mar 23 2017 - 11:30:19 EST


On Thu, 2017-03-23 at 15:54 +0100, Johannes Berg wrote:

> Before I go hunting - has anyone seen a deadlock in
> synchronize_srcu() in debugfs_remove() before?

Isn't it possible for the following to happen?

CPU1 CPU2

mutex_lock(&M);
full_proxy_xyz();
srcu_read_lock(&debugfs_srcu);
real_fops->xyz();
mutex_lock(&M);
debugfs_remove(F);
synchronize_srcu(&debugfs_srcu);

-> deadlock?

I'm not convinced that this is the scenario I'm looking at, since then
it seems I should see the mutex_lock(&M) on CPU 2 with a backtrace
pointing to a full_proxy and the debugfs operation I recognize, but
lots of debugfs files acquire locks and it seems likely that it's not
always removed without holding those locks?

Am I missing something? I'll see if I can add lockdep annotations.

johannes