Skip to content

Commit ab434b6

Browse files
committed
ceph: initialize client debugfs outside of monc->mutex
Initializing debufs under monc->mutex introduces a lock dependency for sb->s_type->i_mutex_key, which (combined with several other dependencies) leads to an annoying lockdep warning. There's no particular reason to do the debugfs setup under this lock, so move it out. It used to be the case that our first monmap could come from the OSD; that is no longer the case with recent servers, so we will reliably set up the client entry during the initial authentication. We don't have to worry about racing with debugfs teardown by ceph_debugfs_client_cleanup() because ceph_destroy_client() calls ceph_msgr_flush() first, which will wait for the message dispatch work to complete (and the debugfs init to complete). Fixes: raspberrypi#1940 Signed-off-by: Sage Weil <sage@newdream.net>
1 parent 114fc47 commit ab434b6

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

‎net/ceph/ceph_common.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid)
8585
} else {
8686
pr_info("client%lld fsid %pU\n", ceph_client_id(client), fsid);
8787
memcpy(&client->fsid, fsid, sizeof(*fsid));
88-
ceph_debugfs_client_init(client);
89-
client->have_fsid = true;
9088
}
9189
return 0;
9290
}

‎net/ceph/mon_client.c‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
#include <linux/ceph/mon_client.h>
1010
#include <linux/ceph/libceph.h>
11+
#include <linux/ceph/debugfs.h>
1112
#include <linux/ceph/decode.h>
12-
1313
#include <linux/ceph/auth.h>
1414

1515
/*
@@ -340,8 +340,19 @@ static void ceph_monc_handle_map(struct ceph_mon_client *monc,
340340
client->monc.monmap = monmap;
341341
kfree(old);
342342

343+
if (!client->have_fsid) {
344+
client->have_fsid = true;
345+
mutex_unlock(&monc->mutex);
346+
/*
347+
* do debugfs initialization without mutex to avoid
348+
* creating a locking dependency
349+
*/
350+
ceph_debugfs_client_init(client);
351+
goto out_unlocked;
352+
}
343353
out:
344354
mutex_unlock(&monc->mutex);
355+
out_unlocked:
345356
wake_up_all(&client->auth_wq);
346357
}
347358

0 commit comments

Comments
 (0)