Skip to content

Commit

Permalink
ceph: initialize client debugfs outside of monc->mutex
Browse files Browse the repository at this point in the history
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: #1940
Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
liewegas committed Feb 2, 2012
1 parent 114fc47 commit ab434b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 0 additions & 2 deletions net/ceph/ceph_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid)
} else {
pr_info("client%lld fsid %pU\n", ceph_client_id(client), fsid);
memcpy(&client->fsid, fsid, sizeof(*fsid));
ceph_debugfs_client_init(client);
client->have_fsid = true;
}
return 0;
}
Expand Down
13 changes: 12 additions & 1 deletion net/ceph/mon_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

#include <linux/ceph/mon_client.h>
#include <linux/ceph/libceph.h>
#include <linux/ceph/debugfs.h>
#include <linux/ceph/decode.h>

#include <linux/ceph/auth.h>

/*
Expand Down Expand Up @@ -340,8 +340,19 @@ static void ceph_monc_handle_map(struct ceph_mon_client *monc,
client->monc.monmap = monmap;
kfree(old);

if (!client->have_fsid) {
client->have_fsid = true;
mutex_unlock(&monc->mutex);
/*
* do debugfs initialization without mutex to avoid
* creating a locking dependency
*/
ceph_debugfs_client_init(client);
goto out_unlocked;
}
out:
mutex_unlock(&monc->mutex);
out_unlocked:
wake_up_all(&client->auth_wq);
}

Expand Down

0 comments on commit ab434b6

Please sign in to comment.