ceph_common.c (ec3b34e1975670e68be3abff76f56dbb41dd417c) ceph_common.c (a319bf56a617354e62cf5f774d2ca4e1a8a3bff3)
1
2#include <linux/ceph/ceph_debug.h>
3#include <linux/backing-dev.h>
4#include <linux/ctype.h>
5#include <linux/fs.h>
6#include <linux/inet.h>
7#include <linux/in6.h>
8#include <linux/key.h>

--- 338 unchanged lines hidden (view full) ---

347 goto out;
348
349 dout("parse_options %p options '%s' dev_name '%s'\n", opt, options,
350 dev_name);
351
352 /* start with defaults */
353 opt->flags = CEPH_OPT_DEFAULT;
354 opt->osd_keepalive_timeout = CEPH_OSD_KEEPALIVE_DEFAULT;
1
2#include <linux/ceph/ceph_debug.h>
3#include <linux/backing-dev.h>
4#include <linux/ctype.h>
5#include <linux/fs.h>
6#include <linux/inet.h>
7#include <linux/in6.h>
8#include <linux/key.h>

--- 338 unchanged lines hidden (view full) ---

347 goto out;
348
349 dout("parse_options %p options '%s' dev_name '%s'\n", opt, options,
350 dev_name);
351
352 /* start with defaults */
353 opt->flags = CEPH_OPT_DEFAULT;
354 opt->osd_keepalive_timeout = CEPH_OSD_KEEPALIVE_DEFAULT;
355 opt->mount_timeout = CEPH_MOUNT_TIMEOUT_DEFAULT; /* seconds */
356 opt->osd_idle_ttl = CEPH_OSD_IDLE_TTL_DEFAULT; /* seconds */
355 opt->mount_timeout = CEPH_MOUNT_TIMEOUT_DEFAULT;
356 opt->osd_idle_ttl = CEPH_OSD_IDLE_TTL_DEFAULT;
357
358 /* get mon ip(s) */
359 /* ip1[:port1][,ip2[:port2]...] */
360 err = ceph_parse_ips(dev_name, dev_name_end, opt->mon_addr,
361 CEPH_MAX_MON, &opt->num_mon);
362 if (err < 0)
363 goto out;
364

--- 69 unchanged lines hidden (view full) ---

434 goto out;
435 break;
436
437 /* misc */
438 case Opt_osdtimeout:
439 pr_warn("ignoring deprecated osdtimeout option\n");
440 break;
441 case Opt_osdkeepalivetimeout:
357
358 /* get mon ip(s) */
359 /* ip1[:port1][,ip2[:port2]...] */
360 err = ceph_parse_ips(dev_name, dev_name_end, opt->mon_addr,
361 CEPH_MAX_MON, &opt->num_mon);
362 if (err < 0)
363 goto out;
364

--- 69 unchanged lines hidden (view full) ---

434 goto out;
435 break;
436
437 /* misc */
438 case Opt_osdtimeout:
439 pr_warn("ignoring deprecated osdtimeout option\n");
440 break;
441 case Opt_osdkeepalivetimeout:
442 opt->osd_keepalive_timeout = intval;
442 /* 0 isn't well defined right now, reject it */
443 if (intval < 1 || intval > INT_MAX / 1000) {
444 pr_err("osdkeepalive out of range\n");
445 err = -EINVAL;
446 goto out;
447 }
448 opt->osd_keepalive_timeout =
449 msecs_to_jiffies(intval * 1000);
443 break;
444 case Opt_osd_idle_ttl:
450 break;
451 case Opt_osd_idle_ttl:
445 opt->osd_idle_ttl = intval;
452 /* 0 isn't well defined right now, reject it */
453 if (intval < 1 || intval > INT_MAX / 1000) {
454 pr_err("osd_idle_ttl out of range\n");
455 err = -EINVAL;
456 goto out;
457 }
458 opt->osd_idle_ttl = msecs_to_jiffies(intval * 1000);
446 break;
447 case Opt_mount_timeout:
459 break;
460 case Opt_mount_timeout:
448 opt->mount_timeout = intval;
461 /* 0 is "wait forever" (i.e. infinite timeout) */
462 if (intval < 0 || intval > INT_MAX / 1000) {
463 pr_err("mount_timeout out of range\n");
464 err = -EINVAL;
465 goto out;
466 }
467 opt->mount_timeout = msecs_to_jiffies(intval * 1000);
449 break;
450
451 case Opt_share:
452 opt->flags &= ~CEPH_OPT_NOSHARE;
453 break;
454 case Opt_noshare:
455 opt->flags |= CEPH_OPT_NOSHARE;
456 break;

--- 50 unchanged lines hidden (view full) ---

507 if (opt->flags & CEPH_OPT_NOCRC)
508 seq_puts(m, "nocrc,");
509 if (opt->flags & CEPH_OPT_NOMSGAUTH)
510 seq_puts(m, "nocephx_require_signatures,");
511 if ((opt->flags & CEPH_OPT_TCP_NODELAY) == 0)
512 seq_puts(m, "notcp_nodelay,");
513
514 if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT)
468 break;
469
470 case Opt_share:
471 opt->flags &= ~CEPH_OPT_NOSHARE;
472 break;
473 case Opt_noshare:
474 opt->flags |= CEPH_OPT_NOSHARE;
475 break;

--- 50 unchanged lines hidden (view full) ---

526 if (opt->flags & CEPH_OPT_NOCRC)
527 seq_puts(m, "nocrc,");
528 if (opt->flags & CEPH_OPT_NOMSGAUTH)
529 seq_puts(m, "nocephx_require_signatures,");
530 if ((opt->flags & CEPH_OPT_TCP_NODELAY) == 0)
531 seq_puts(m, "notcp_nodelay,");
532
533 if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT)
515 seq_printf(m, "mount_timeout=%d,", opt->mount_timeout);
534 seq_printf(m, "mount_timeout=%d,",
535 jiffies_to_msecs(opt->mount_timeout) / 1000);
516 if (opt->osd_idle_ttl != CEPH_OSD_IDLE_TTL_DEFAULT)
536 if (opt->osd_idle_ttl != CEPH_OSD_IDLE_TTL_DEFAULT)
517 seq_printf(m, "osd_idle_ttl=%d,", opt->osd_idle_ttl);
537 seq_printf(m, "osd_idle_ttl=%d,",
538 jiffies_to_msecs(opt->osd_idle_ttl) / 1000);
518 if (opt->osd_keepalive_timeout != CEPH_OSD_KEEPALIVE_DEFAULT)
519 seq_printf(m, "osdkeepalivetimeout=%d,",
539 if (opt->osd_keepalive_timeout != CEPH_OSD_KEEPALIVE_DEFAULT)
540 seq_printf(m, "osdkeepalivetimeout=%d,",
520 opt->osd_keepalive_timeout);
541 jiffies_to_msecs(opt->osd_keepalive_timeout) / 1000);
521
522 /* drop redundant comma */
523 if (m->count != pos)
524 m->count--;
525
526 return 0;
527}
528EXPORT_SYMBOL(ceph_print_client_options);

--- 93 unchanged lines hidden (view full) ---

622}
623
624/*
625 * mount: join the ceph cluster, and open root directory.
626 */
627int __ceph_open_session(struct ceph_client *client, unsigned long started)
628{
629 int err;
542
543 /* drop redundant comma */
544 if (m->count != pos)
545 m->count--;
546
547 return 0;
548}
549EXPORT_SYMBOL(ceph_print_client_options);

--- 93 unchanged lines hidden (view full) ---

643}
644
645/*
646 * mount: join the ceph cluster, and open root directory.
647 */
648int __ceph_open_session(struct ceph_client *client, unsigned long started)
649{
650 int err;
630 unsigned long timeout = client->options->mount_timeout * HZ;
651 unsigned long timeout = client->options->mount_timeout;
631
632 /* open session, and wait for mon and osd maps */
633 err = ceph_monc_open_session(&client->monc);
634 if (err < 0)
635 return err;
636
637 while (!have_mon_and_osd_map(client)) {
638 err = -EIO;
639 if (timeout && time_after_eq(jiffies, started + timeout))
640 return err;
641
642 /* wait */
643 dout("mount waiting for mon_map\n");
644 err = wait_event_interruptible_timeout(client->auth_wq,
645 have_mon_and_osd_map(client) || (client->auth_err < 0),
652
653 /* open session, and wait for mon and osd maps */
654 err = ceph_monc_open_session(&client->monc);
655 if (err < 0)
656 return err;
657
658 while (!have_mon_and_osd_map(client)) {
659 err = -EIO;
660 if (timeout && time_after_eq(jiffies, started + timeout))
661 return err;
662
663 /* wait */
664 dout("mount waiting for mon_map\n");
665 err = wait_event_interruptible_timeout(client->auth_wq,
666 have_mon_and_osd_map(client) || (client->auth_err < 0),
646 timeout);
667 ceph_timeout_jiffies(timeout));
647 if (err == -EINTR || err == -ERESTARTSYS)
648 return err;
649 if (client->auth_err < 0)
650 return client->auth_err;
651 }
652
653 return 0;
654}

--- 71 unchanged lines hidden ---
668 if (err == -EINTR || err == -ERESTARTSYS)
669 return err;
670 if (client->auth_err < 0)
671 return client->auth_err;
672 }
673
674 return 0;
675}

--- 71 unchanged lines hidden ---