diff options
Diffstat (limited to 'net/ceph/mon_client.c')
-rw-r--r-- | net/ceph/mon_client.c | 51 |
1 files changed, 46 insertions, 5 deletions
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index 105d533b55f3..900ea0f043fc 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c | |||
@@ -311,6 +311,17 @@ int ceph_monc_open_session(struct ceph_mon_client *monc) | |||
311 | EXPORT_SYMBOL(ceph_monc_open_session); | 311 | EXPORT_SYMBOL(ceph_monc_open_session); |
312 | 312 | ||
313 | /* | 313 | /* |
314 | * We require the fsid and global_id in order to initialize our | ||
315 | * debugfs dir. | ||
316 | */ | ||
317 | static bool have_debugfs_info(struct ceph_mon_client *monc) | ||
318 | { | ||
319 | dout("have_debugfs_info fsid %d globalid %lld\n", | ||
320 | (int)monc->client->have_fsid, monc->auth->global_id); | ||
321 | return monc->client->have_fsid && monc->auth->global_id > 0; | ||
322 | } | ||
323 | |||
324 | /* | ||
314 | * The monitor responds with mount ack indicate mount success. The | 325 | * The monitor responds with mount ack indicate mount success. The |
315 | * included client ticket allows the client to talk to MDSs and OSDs. | 326 | * included client ticket allows the client to talk to MDSs and OSDs. |
316 | */ | 327 | */ |
@@ -320,9 +331,12 @@ static void ceph_monc_handle_map(struct ceph_mon_client *monc, | |||
320 | struct ceph_client *client = monc->client; | 331 | struct ceph_client *client = monc->client; |
321 | struct ceph_monmap *monmap = NULL, *old = monc->monmap; | 332 | struct ceph_monmap *monmap = NULL, *old = monc->monmap; |
322 | void *p, *end; | 333 | void *p, *end; |
334 | int had_debugfs_info, init_debugfs = 0; | ||
323 | 335 | ||
324 | mutex_lock(&monc->mutex); | 336 | mutex_lock(&monc->mutex); |
325 | 337 | ||
338 | had_debugfs_info = have_debugfs_info(monc); | ||
339 | |||
326 | dout("handle_monmap\n"); | 340 | dout("handle_monmap\n"); |
327 | p = msg->front.iov_base; | 341 | p = msg->front.iov_base; |
328 | end = p + msg->front.iov_len; | 342 | end = p + msg->front.iov_len; |
@@ -344,12 +358,22 @@ static void ceph_monc_handle_map(struct ceph_mon_client *monc, | |||
344 | 358 | ||
345 | if (!client->have_fsid) { | 359 | if (!client->have_fsid) { |
346 | client->have_fsid = true; | 360 | client->have_fsid = true; |
361 | if (!had_debugfs_info && have_debugfs_info(monc)) { | ||
362 | pr_info("client%lld fsid %pU\n", | ||
363 | ceph_client_id(monc->client), | ||
364 | &monc->client->fsid); | ||
365 | init_debugfs = 1; | ||
366 | } | ||
347 | mutex_unlock(&monc->mutex); | 367 | mutex_unlock(&monc->mutex); |
348 | /* | 368 | |
349 | * do debugfs initialization without mutex to avoid | 369 | if (init_debugfs) { |
350 | * creating a locking dependency | 370 | /* |
351 | */ | 371 | * do debugfs initialization without mutex to avoid |
352 | ceph_debugfs_client_init(client); | 372 | * creating a locking dependency |
373 | */ | ||
374 | ceph_debugfs_client_init(monc->client); | ||
375 | } | ||
376 | |||
353 | goto out_unlocked; | 377 | goto out_unlocked; |
354 | } | 378 | } |
355 | out: | 379 | out: |
@@ -865,8 +889,10 @@ static void handle_auth_reply(struct ceph_mon_client *monc, | |||
865 | { | 889 | { |
866 | int ret; | 890 | int ret; |
867 | int was_auth = 0; | 891 | int was_auth = 0; |
892 | int had_debugfs_info, init_debugfs = 0; | ||
868 | 893 | ||
869 | mutex_lock(&monc->mutex); | 894 | mutex_lock(&monc->mutex); |
895 | had_debugfs_info = have_debugfs_info(monc); | ||
870 | if (monc->auth->ops) | 896 | if (monc->auth->ops) |
871 | was_auth = monc->auth->ops->is_authenticated(monc->auth); | 897 | was_auth = monc->auth->ops->is_authenticated(monc->auth); |
872 | monc->pending_auth = 0; | 898 | monc->pending_auth = 0; |
@@ -889,7 +915,22 @@ static void handle_auth_reply(struct ceph_mon_client *monc, | |||
889 | __send_subscribe(monc); | 915 | __send_subscribe(monc); |
890 | __resend_generic_request(monc); | 916 | __resend_generic_request(monc); |
891 | } | 917 | } |
918 | |||
919 | if (!had_debugfs_info && have_debugfs_info(monc)) { | ||
920 | pr_info("client%lld fsid %pU\n", | ||
921 | ceph_client_id(monc->client), | ||
922 | &monc->client->fsid); | ||
923 | init_debugfs = 1; | ||
924 | } | ||
892 | mutex_unlock(&monc->mutex); | 925 | mutex_unlock(&monc->mutex); |
926 | |||
927 | if (init_debugfs) { | ||
928 | /* | ||
929 | * do debugfs initialization without mutex to avoid | ||
930 | * creating a locking dependency | ||
931 | */ | ||
932 | ceph_debugfs_client_init(monc->client); | ||
933 | } | ||
893 | } | 934 | } |
894 | 935 | ||
895 | static int __validate_auth(struct ceph_mon_client *monc) | 936 | static int __validate_auth(struct ceph_mon_client *monc) |