summaryrefslogtreecommitdiffstats
path: root/fs/ceph/super.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-11-18 16:50:41 -0800
committerSage Weil <sage@newdream.net>2009-11-20 14:24:27 -0800
commit0743304d871559cb4c7c066357de2caa60e94c2f (patch)
tree546510a84c1bda27e71a8a8229544d99f5624252 /fs/ceph/super.c
parentcfea1cf42b614583c02727d5bffd5a2384e92bda (diff)
downloadop-kernel-dev-0743304d871559cb4c7c066357de2caa60e94c2f.zip
op-kernel-dev-0743304d871559cb4c7c066357de2caa60e94c2f.tar.gz
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 df05617..3df6d4a 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -19,6 +19,7 @@
#include "decode.h"
#include "super.h"
#include "mon_client.h"
+#include "auth.h"
/*
* Ceph superblock operations
@@ -510,14 +511,11 @@ static struct ceph_client *ceph_create_client(struct ceph_mount_args *args)
client->sb = NULL;
client->mount_state = CEPH_MOUNT_MOUNTING;
- client->whoami = -1;
client->mount_args = args;
client->msgr = NULL;
client->mount_err = 0;
- client->signed_ticket = NULL;
- client->signed_ticket_len = 0;
err = bdi_init(&client->backing_dev_info);
if (err < 0)
@@ -582,8 +580,6 @@ static void ceph_destroy_client(struct ceph_client *client)
ceph_monc_stop(&client->monc);
ceph_osdc_stop(&client->osdc);
- kfree(client->signed_ticket);
-
ceph_debugfs_client_cleanup(client);
destroy_workqueue(client->wb_wq);
destroy_workqueue(client->pg_inv_wq);
@@ -600,6 +596,32 @@ static void ceph_destroy_client(struct ceph_client *client)
}
/*
+ * Initially learn our fsid, or verify an fsid matches.
+ */
+int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid)
+{
+ if (client->have_fsid) {
+ if (ceph_fsid_compare(&client->fsid, fsid)) {
+ print_hex_dump(KERN_ERR, "this fsid: ",
+ DUMP_PREFIX_NONE, 16, 1,
+ (void *)fsid, 16, 0);
+ print_hex_dump(KERN_ERR, " old fsid: ",
+ DUMP_PREFIX_NONE, 16, 1,
+ (void *)&client->fsid, 16, 0);
+ pr_err("fsid mismatch\n");
+ return -1;
+ }
+ } else {
+ pr_info("client%lld fsid " FSID_FORMAT "\n",
+ client->monc.auth->global_id, PR_FSID(fsid));
+ memcpy(&client->fsid, fsid, sizeof(*fsid));
+ ceph_debugfs_client_init(client);
+ client->have_fsid = true;
+ }
+ return 0;
+}
+
+/*
* true if we have the mon map (and have thus joined the cluster)
*/
static int have_mon_map(struct ceph_client *client)
OpenPOWER on IntegriCloud