aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/super.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-11-18 19:50:41 -0500
committerSage Weil <sage@newdream.net>2009-11-20 17:24:27 -0500
commit0743304d871559cb4c7c066357de2caa60e94c2f (patch)
tree546510a84c1bda27e71a8a8229544d99f5624252 /fs/ceph/super.c
parentcfea1cf42b614583c02727d5bffd5a2384e92bda (diff)
ceph: fix debugfs entry, simplify fsid checks
We may first learn our fsid from any of the mon, osd, or mds maps (whichever the monitor sends first). Consolidate checks in a single helper. Initialize the client debugfs entry then, since we need the fsid (and global_id) for the directory name. Also remove dead mount code. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/super.c')
-rw-r--r--fs/ceph/super.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index df05617aca86..3df6d4ab236c 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -19,6 +19,7 @@
19#include "decode.h" 19#include "decode.h"
20#include "super.h" 20#include "super.h"
21#include "mon_client.h" 21#include "mon_client.h"
22#include "auth.h"
22 23
23/* 24/*
24 * Ceph superblock operations 25 * Ceph superblock operations
@@ -510,14 +511,11 @@ static struct ceph_client *ceph_create_client(struct ceph_mount_args *args)
510 511
511 client->sb = NULL; 512 client->sb = NULL;
512 client->mount_state = CEPH_MOUNT_MOUNTING; 513 client->mount_state = CEPH_MOUNT_MOUNTING;
513 client->whoami = -1;
514 client->mount_args = args; 514 client->mount_args = args;
515 515
516 client->msgr = NULL; 516 client->msgr = NULL;
517 517
518 client->mount_err = 0; 518 client->mount_err = 0;
519 client->signed_ticket = NULL;
520 client->signed_ticket_len = 0;
521 519
522 err = bdi_init(&client->backing_dev_info); 520 err = bdi_init(&client->backing_dev_info);
523 if (err < 0) 521 if (err < 0)
@@ -582,8 +580,6 @@ static void ceph_destroy_client(struct ceph_client *client)
582 ceph_monc_stop(&client->monc); 580 ceph_monc_stop(&client->monc);
583 ceph_osdc_stop(&client->osdc); 581 ceph_osdc_stop(&client->osdc);
584 582
585 kfree(client->signed_ticket);
586
587 ceph_debugfs_client_cleanup(client); 583 ceph_debugfs_client_cleanup(client);
588 destroy_workqueue(client->wb_wq); 584 destroy_workqueue(client->wb_wq);
589 destroy_workqueue(client->pg_inv_wq); 585 destroy_workqueue(client->pg_inv_wq);
@@ -600,6 +596,32 @@ static void ceph_destroy_client(struct ceph_client *client)
600} 596}
601 597
602/* 598/*
599 * Initially learn our fsid, or verify an fsid matches.
600 */
601int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid)
602{
603 if (client->have_fsid) {
604 if (ceph_fsid_compare(&client->fsid, fsid)) {
605 print_hex_dump(KERN_ERR, "this fsid: ",
606 DUMP_PREFIX_NONE, 16, 1,
607 (void *)fsid, 16, 0);
608 print_hex_dump(KERN_ERR, " old fsid: ",
609 DUMP_PREFIX_NONE, 16, 1,
610 (void *)&client->fsid, 16, 0);
611 pr_err("fsid mismatch\n");
612 return -1;
613 }
614 } else {
615 pr_info("client%lld fsid " FSID_FORMAT "\n",
616 client->monc.auth->global_id, PR_FSID(fsid));
617 memcpy(&client->fsid, fsid, sizeof(*fsid));
618 ceph_debugfs_client_init(client);
619 client->have_fsid = true;
620 }
621 return 0;
622}
623
624/*
603 * true if we have the mon map (and have thus joined the cluster) 625 * true if we have the mon map (and have thus joined the cluster)
604 */ 626 */
605static int have_mon_map(struct ceph_client *client) 627static int have_mon_map(struct ceph_client *client)