aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/super.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-11-18 19:19:57 -0500
committerSage Weil <sage@newdream.net>2009-11-18 19:19:57 -0500
commit4e7a5dcd1bbab6560fbc8ada29a840e7a20ed7bc (patch)
treea77e9b4563022340361ca673ef2e1beebb538e2f /fs/ceph/super.c
parent5f44f142601bf94c448e2d463f0f18fd159da164 (diff)
ceph: negotiate authentication protocol; implement AUTH_NONE protocol
When we open a monitor session, we send an initial AUTH message listing the auth protocols we support, our entity name, and (possibly) a previously assigned global_id. The monitor chooses a protocol and responds with an initial message. Initially implement AUTH_NONE, a dummy protocol that provides no security, but works within the new framework. It generates 'authorizers' that are used when connecting to (mds, osd) services that simply state our entity name and global_id. This is a wire protocol change. 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, 19 insertions, 13 deletions
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index fe0a5962a082..c901395ae8a1 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -128,6 +128,8 @@ static int ceph_show_options(struct seq_file *m, struct vfsmount *mnt)
128 seq_puts(m, ",noasyncreaddir"); 128 seq_puts(m, ",noasyncreaddir");
129 if (strcmp(args->snapdir_name, CEPH_SNAPDIRNAME_DEFAULT)) 129 if (strcmp(args->snapdir_name, CEPH_SNAPDIRNAME_DEFAULT))
130 seq_printf(m, ",snapdirname=%s", args->snapdir_name); 130 seq_printf(m, ",snapdirname=%s", args->snapdir_name);
131 if (args->name)
132 seq_printf(m, ",name=%s", args->name);
131 if (args->secret) 133 if (args->secret)
132 seq_puts(m, ",secret=<hidden>"); 134 seq_puts(m, ",secret=<hidden>");
133 return 0; 135 return 0;
@@ -224,12 +226,12 @@ const char *ceph_msg_type_name(int type)
224 switch (type) { 226 switch (type) {
225 case CEPH_MSG_SHUTDOWN: return "shutdown"; 227 case CEPH_MSG_SHUTDOWN: return "shutdown";
226 case CEPH_MSG_PING: return "ping"; 228 case CEPH_MSG_PING: return "ping";
229 case CEPH_MSG_AUTH: return "auth";
230 case CEPH_MSG_AUTH_REPLY: return "auth_reply";
227 case CEPH_MSG_MON_MAP: return "mon_map"; 231 case CEPH_MSG_MON_MAP: return "mon_map";
228 case CEPH_MSG_MON_GET_MAP: return "mon_get_map"; 232 case CEPH_MSG_MON_GET_MAP: return "mon_get_map";
229 case CEPH_MSG_MON_SUBSCRIBE: return "mon_subscribe"; 233 case CEPH_MSG_MON_SUBSCRIBE: return "mon_subscribe";
230 case CEPH_MSG_MON_SUBSCRIBE_ACK: return "mon_subscribe_ack"; 234 case CEPH_MSG_MON_SUBSCRIBE_ACK: return "mon_subscribe_ack";
231 case CEPH_MSG_CLIENT_MOUNT: return "client_mount";
232 case CEPH_MSG_CLIENT_MOUNT_ACK: return "client_mount_ack";
233 case CEPH_MSG_STATFS: return "statfs"; 235 case CEPH_MSG_STATFS: return "statfs";
234 case CEPH_MSG_STATFS_REPLY: return "statfs_reply"; 236 case CEPH_MSG_STATFS_REPLY: return "statfs_reply";
235 case CEPH_MSG_MDS_MAP: return "mds_map"; 237 case CEPH_MSG_MDS_MAP: return "mds_map";
@@ -267,6 +269,7 @@ enum {
267 Opt_last_int, 269 Opt_last_int,
268 /* int args above */ 270 /* int args above */
269 Opt_snapdirname, 271 Opt_snapdirname,
272 Opt_name,
270 Opt_secret, 273 Opt_secret,
271 Opt_last_string, 274 Opt_last_string,
272 /* string args above */ 275 /* string args above */
@@ -293,6 +296,7 @@ static match_table_t arg_tokens = {
293 {Opt_readdir_max_entries, "readdir_max_entries=%d"}, 296 {Opt_readdir_max_entries, "readdir_max_entries=%d"},
294 /* int args above */ 297 /* int args above */
295 {Opt_snapdirname, "snapdirname=%s"}, 298 {Opt_snapdirname, "snapdirname=%s"},
299 {Opt_name, "name=%s"},
296 {Opt_secret, "secret=%s"}, 300 {Opt_secret, "secret=%s"},
297 /* string args above */ 301 /* string args above */
298 {Opt_ip, "ip=%s"}, 302 {Opt_ip, "ip=%s"},
@@ -407,6 +411,11 @@ static struct ceph_mount_args *parse_mount_args(int flags, char *options,
407 argstr[0].to-argstr[0].from, 411 argstr[0].to-argstr[0].from,
408 GFP_KERNEL); 412 GFP_KERNEL);
409 break; 413 break;
414 case Opt_name:
415 args->name = kstrndup(argstr[0].from,
416 argstr[0].to-argstr[0].from,
417 GFP_KERNEL);
418 break;
410 case Opt_secret: 419 case Opt_secret:
411 args->secret = kstrndup(argstr[0].from, 420 args->secret = kstrndup(argstr[0].from,
412 argstr[0].to-argstr[0].from, 421 argstr[0].to-argstr[0].from,
@@ -476,6 +485,8 @@ static void destroy_mount_args(struct ceph_mount_args *args)
476 dout("destroy_mount_args %p\n", args); 485 dout("destroy_mount_args %p\n", args);
477 kfree(args->snapdir_name); 486 kfree(args->snapdir_name);
478 args->snapdir_name = NULL; 487 args->snapdir_name = NULL;
488 kfree(args->name);
489 args->name = NULL;
479 kfree(args->secret); 490 kfree(args->secret);
480 args->secret = NULL; 491 args->secret = NULL;
481 kfree(args); 492 kfree(args);
@@ -657,27 +668,23 @@ static int ceph_mount(struct ceph_client *client, struct vfsmount *mnt,
657 client->msgr->nocrc = ceph_test_opt(client, NOCRC); 668 client->msgr->nocrc = ceph_test_opt(client, NOCRC);
658 } 669 }
659 670
660 /* send mount request, and wait for mon, mds, and osd maps */ 671 /* open session, and wait for mon, mds, and osd maps */
661 err = ceph_monc_request_mount(&client->monc); 672 err = ceph_monc_open_session(&client->monc);
662 if (err < 0) 673 if (err < 0)
663 goto out; 674 goto out;
664 675
665 while (!have_mon_map(client) && !client->mount_err) { 676 while (!have_mon_map(client)) {
666 err = -EIO; 677 err = -EIO;
667 if (timeout && time_after_eq(jiffies, started + timeout)) 678 if (timeout && time_after_eq(jiffies, started + timeout))
668 goto out; 679 goto out;
669 680
670 /* wait */ 681 /* wait */
671 dout("mount waiting for mount\n"); 682 dout("mount waiting for mon_map\n");
672 err = wait_event_interruptible_timeout(client->mount_wq, 683 err = wait_event_interruptible_timeout(client->mount_wq, /* FIXME */
673 client->mount_err || have_mon_map(client), 684 have_mon_map(client),
674 timeout); 685 timeout);
675 if (err == -EINTR || err == -ERESTARTSYS) 686 if (err == -EINTR || err == -ERESTARTSYS)
676 goto out; 687 goto out;
677 if (client->mount_err) {
678 err = client->mount_err;
679 goto out;
680 }
681 } 688 }
682 689
683 dout("mount opening root\n"); 690 dout("mount opening root\n");
@@ -795,7 +802,6 @@ static int ceph_register_bdi(struct super_block *sb, struct ceph_client *client)
795 client->backing_dev_info.ra_pages = 802 client->backing_dev_info.ra_pages =
796 (client->mount_args->rsize + PAGE_CACHE_SIZE - 1) 803 (client->mount_args->rsize + PAGE_CACHE_SIZE - 1)
797 >> PAGE_SHIFT; 804 >> PAGE_SHIFT;
798
799 err = bdi_register_dev(&client->backing_dev_info, sb->s_dev); 805 err = bdi_register_dev(&client->backing_dev_info, sb->s_dev);
800 return err; 806 return err;
801} 807}