Lines Matching +full:dout +full:- +full:default
1 // SPDX-License-Identifier: GPL-2.0-only
5 #include <linux/backing-dev.h>
49 doutc(fsc->client, "begin\n"); in ceph_put_super()
51 ceph_mdsc_close_sessions(fsc->mdsc); in ceph_put_super()
52 doutc(fsc->client, "done\n"); in ceph_put_super()
58 struct ceph_mon_client *monc = &fsc->client->monc; in ceph_statfs()
63 doutc(fsc->client, "begin\n"); in ceph_statfs()
64 if (fsc->mdsc->mdsmap->m_num_data_pg_pools == 1) { in ceph_statfs()
65 data_pool = fsc->mdsc->mdsmap->m_data_pg_pools[0]; in ceph_statfs()
75 buf->f_type = CEPH_SUPER_MAGIC; /* ?? */ in ceph_statfs()
79 * overflow on 32-bit machines. in ceph_statfs()
81 buf->f_frsize = 1 << CEPH_BLOCK_SHIFT; in ceph_statfs()
84 * By default use root quota for stats; fallback to overall filesystem in ceph_statfs()
90 buf->f_blocks = le64_to_cpu(st.kb) >> (CEPH_BLOCK_SHIFT-10); in ceph_statfs()
91 buf->f_bfree = le64_to_cpu(st.kb_avail) >> (CEPH_BLOCK_SHIFT-10); in ceph_statfs()
92 buf->f_bavail = le64_to_cpu(st.kb_avail) >> (CEPH_BLOCK_SHIFT-10); in ceph_statfs()
97 * not-yet-ancient versions of glibc that are broken. in ceph_statfs()
101 buf->f_bsize = buf->f_frsize; in ceph_statfs()
103 buf->f_files = le64_to_cpu(st.num_objects); in ceph_statfs()
104 buf->f_ffree = -1; in ceph_statfs()
105 buf->f_namelen = NAME_MAX; in ceph_statfs()
108 buf->f_fsid.val[0] = 0; in ceph_statfs()
109 mutex_lock(&monc->mutex); in ceph_statfs()
110 for (i = 0 ; i < sizeof(monc->monmap->fsid) / sizeof(__le32) ; ++i) in ceph_statfs()
111 buf->f_fsid.val[0] ^= le32_to_cpu(((__le32 *)&monc->monmap->fsid)[i]); in ceph_statfs()
112 mutex_unlock(&monc->mutex); in ceph_statfs()
115 buf->f_fsid.val[1] = monc->fs_cluster_id; in ceph_statfs()
117 doutc(fsc->client, "done\n"); in ceph_statfs()
124 struct ceph_client *cl = fsc->client; in ceph_sync_fs()
127 doutc(cl, "(non-blocking)\n"); in ceph_sync_fs()
128 ceph_flush_dirty_caps(fsc->mdsc); in ceph_sync_fs()
129 ceph_flush_cap_releases(fsc->mdsc); in ceph_sync_fs()
130 doutc(cl, "(non-blocking) done\n"); in ceph_sync_fs()
135 ceph_osdc_sync(&fsc->client->osdc); in ceph_sync_fs()
136 ceph_mdsc_sync(fsc->mdsc); in ceph_sync_fs()
233 * E.g. "//dir1////dir2///" --> "/dir1/dir2", "///" --> "/".
240 if (path[i] != '/' || j < 1 || path[j - 1] != '/') in canonicalize_path()
244 if (j > 1 && path[j - 1] == '/') in canonicalize_path()
245 j--; in canonicalize_path()
252 * ->mds_namespace is NULL) is treated specially, since
253 * ->mds_namespace needs to be initialized by the caller.
258 return !(fsopt->mds_namespace && in namespace_equals()
259 (strlen(fsopt->mds_namespace) != len || in namespace_equals()
260 strncmp(fsopt->mds_namespace, namespace, len))); in namespace_equals()
267 struct ceph_parse_opts_ctx *pctx = fc->fs_private; in ceph_parse_old_source()
268 struct ceph_mount_options *fsopt = pctx->opts; in ceph_parse_old_source()
273 r = ceph_parse_mon_ips(dev_name, dev_name_end - dev_name, in ceph_parse_old_source()
274 pctx->copts, fc->log.log, ','); in ceph_parse_old_source()
278 fsopt->new_dev_syntax = false; in ceph_parse_old_source()
287 struct ceph_parse_opts_ctx *pctx = fc->fs_private; in ceph_parse_new_source()
288 struct ceph_mount_options *fsopt = pctx->opts; in ceph_parse_new_source()
292 dout("separator '=' missing in source"); in ceph_parse_new_source()
293 return -EINVAL; in ceph_parse_new_source()
309 len = dev_name_end - fs_name_start; in ceph_parse_new_source()
313 kfree(fsopt->mds_namespace); in ceph_parse_new_source()
314 fsopt->mds_namespace = kstrndup(fs_name_start, len, GFP_KERNEL); in ceph_parse_new_source()
315 if (!fsopt->mds_namespace) in ceph_parse_new_source()
316 return -ENOMEM; in ceph_parse_new_source()
317 dout("file system (mds namespace) '%s'\n", fsopt->mds_namespace); in ceph_parse_new_source()
319 fsopt->new_dev_syntax = true; in ceph_parse_new_source()
343 struct ceph_parse_opts_ctx *pctx = fc->fs_private; in ceph_parse_source()
344 struct ceph_mount_options *fsopt = pctx->opts; in ceph_parse_source()
345 char *dev_name = param->string, *dev_name_end; in ceph_parse_source()
348 dout("'%s'\n", dev_name); in ceph_parse_source()
358 kfree(fsopt->server_path); in ceph_parse_source()
359 fsopt->server_path = kstrdup(dev_name_end, GFP_KERNEL); in ceph_parse_source()
360 if (!fsopt->server_path) in ceph_parse_source()
361 return -ENOMEM; in ceph_parse_source()
363 canonicalize_path(fsopt->server_path); in ceph_parse_source()
368 dev_name_end--; /* back up to separator */ in ceph_parse_source()
372 dout("device name '%.*s'\n", (int)(dev_name_end - dev_name), dev_name); in ceph_parse_source()
373 if (fsopt->server_path) in ceph_parse_source()
374 dout("server path '%s'\n", fsopt->server_path); in ceph_parse_source()
376 dout("trying new device syntax"); in ceph_parse_source()
379 if (ret != -EINVAL) in ceph_parse_source()
381 dout("trying old device syntax"); in ceph_parse_source()
387 fc->source = param->string; in ceph_parse_source()
388 param->string = NULL; in ceph_parse_source()
395 struct ceph_parse_opts_ctx *pctx = fc->fs_private; in ceph_parse_mon_addr()
396 struct ceph_mount_options *fsopt = pctx->opts; in ceph_parse_mon_addr()
398 kfree(fsopt->mon_addr); in ceph_parse_mon_addr()
399 fsopt->mon_addr = param->string; in ceph_parse_mon_addr()
400 param->string = NULL; in ceph_parse_mon_addr()
402 return ceph_parse_mon_ips(fsopt->mon_addr, strlen(fsopt->mon_addr), in ceph_parse_mon_addr()
403 pctx->copts, fc->log.log, '/'); in ceph_parse_mon_addr()
409 struct ceph_parse_opts_ctx *pctx = fc->fs_private; in ceph_parse_mount_param()
410 struct ceph_mount_options *fsopt = pctx->opts; in ceph_parse_mount_param()
415 ret = ceph_parse_param(param, pctx->copts, fc->log.log); in ceph_parse_mount_param()
416 if (ret != -ENOPARAM) in ceph_parse_mount_param()
420 dout("%s: fs_parse '%s' token %d\n",__func__, param->key, token); in ceph_parse_mount_param()
426 kfree(fsopt->snapdir_name); in ceph_parse_mount_param()
427 fsopt->snapdir_name = param->string; in ceph_parse_mount_param()
428 param->string = NULL; in ceph_parse_mount_param()
431 if (!namespace_equals(fsopt, param->string, strlen(param->string))) in ceph_parse_mount_param()
433 kfree(fsopt->mds_namespace); in ceph_parse_mount_param()
434 fsopt->mds_namespace = param->string; in ceph_parse_mount_param()
435 param->string = NULL; in ceph_parse_mount_param()
440 fsopt->flags &= ~CEPH_MOUNT_OPT_CLEANRECOVER; in ceph_parse_mount_param()
442 fsopt->flags |= CEPH_MOUNT_OPT_CLEANRECOVER; in ceph_parse_mount_param()
447 if (fc->source) in ceph_parse_mount_param()
456 fsopt->wsize = ALIGN(result.uint_32, PAGE_SIZE); in ceph_parse_mount_param()
462 fsopt->rsize = ALIGN(result.uint_32, PAGE_SIZE); in ceph_parse_mount_param()
465 fsopt->rasize = ALIGN(result.uint_32, PAGE_SIZE); in ceph_parse_mount_param()
470 fsopt->caps_wanted_delay_min = result.uint_32; in ceph_parse_mount_param()
475 fsopt->caps_wanted_delay_max = result.uint_32; in ceph_parse_mount_param()
480 fsopt->caps_max = result.int_32; in ceph_parse_mount_param()
485 fsopt->max_readdir = result.uint_32; in ceph_parse_mount_param()
490 fsopt->max_readdir_bytes = result.uint_32; in ceph_parse_mount_param()
495 fsopt->congestion_kb = result.uint_32; in ceph_parse_mount_param()
499 fsopt->flags |= CEPH_MOUNT_OPT_DIRSTAT; in ceph_parse_mount_param()
501 fsopt->flags &= ~CEPH_MOUNT_OPT_DIRSTAT; in ceph_parse_mount_param()
505 fsopt->flags |= CEPH_MOUNT_OPT_RBYTES; in ceph_parse_mount_param()
507 fsopt->flags &= ~CEPH_MOUNT_OPT_RBYTES; in ceph_parse_mount_param()
511 fsopt->flags &= ~CEPH_MOUNT_OPT_NOASYNCREADDIR; in ceph_parse_mount_param()
513 fsopt->flags |= CEPH_MOUNT_OPT_NOASYNCREADDIR; in ceph_parse_mount_param()
517 fsopt->flags |= CEPH_MOUNT_OPT_DCACHE; in ceph_parse_mount_param()
519 fsopt->flags &= ~CEPH_MOUNT_OPT_DCACHE; in ceph_parse_mount_param()
523 fsopt->flags |= CEPH_MOUNT_OPT_INO32; in ceph_parse_mount_param()
525 fsopt->flags &= ~CEPH_MOUNT_OPT_INO32; in ceph_parse_mount_param()
530 kfree(fsopt->fscache_uniq); in ceph_parse_mount_param()
531 fsopt->fscache_uniq = NULL; in ceph_parse_mount_param()
533 fsopt->flags &= ~CEPH_MOUNT_OPT_FSCACHE; in ceph_parse_mount_param()
535 fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE; in ceph_parse_mount_param()
536 fsopt->fscache_uniq = param->string; in ceph_parse_mount_param()
537 param->string = NULL; in ceph_parse_mount_param()
545 fsopt->flags &= ~CEPH_MOUNT_OPT_NOPOOLPERM; in ceph_parse_mount_param()
547 fsopt->flags |= CEPH_MOUNT_OPT_NOPOOLPERM; in ceph_parse_mount_param()
551 fsopt->flags &= ~CEPH_MOUNT_OPT_MOUNTWAIT; in ceph_parse_mount_param()
553 fsopt->flags |= CEPH_MOUNT_OPT_MOUNTWAIT; in ceph_parse_mount_param()
557 fsopt->flags &= ~CEPH_MOUNT_OPT_NOQUOTADF; in ceph_parse_mount_param()
559 fsopt->flags |= CEPH_MOUNT_OPT_NOQUOTADF; in ceph_parse_mount_param()
563 fsopt->flags &= ~CEPH_MOUNT_OPT_NOCOPYFROM; in ceph_parse_mount_param()
565 fsopt->flags |= CEPH_MOUNT_OPT_NOCOPYFROM; in ceph_parse_mount_param()
570 fc->sb_flags |= SB_POSIXACL; in ceph_parse_mount_param()
575 fc->sb_flags &= ~SB_POSIXACL; in ceph_parse_mount_param()
580 fsopt->flags &= ~CEPH_MOUNT_OPT_ASYNC_DIROPS; in ceph_parse_mount_param()
582 fsopt->flags |= CEPH_MOUNT_OPT_ASYNC_DIROPS; in ceph_parse_mount_param()
586 fsopt->flags |= CEPH_MOUNT_OPT_NOPAGECACHE; in ceph_parse_mount_param()
588 fsopt->flags &= ~CEPH_MOUNT_OPT_NOPAGECACHE; in ceph_parse_mount_param()
592 fsopt->flags &= ~CEPH_MOUNT_OPT_SPARSEREAD; in ceph_parse_mount_param()
594 fsopt->flags |= CEPH_MOUNT_OPT_SPARSEREAD; in ceph_parse_mount_param()
598 fscrypt_free_dummy_policy(&fsopt->dummy_enc_policy); in ceph_parse_mount_param()
600 &fsopt->dummy_enc_policy); in ceph_parse_mount_param()
601 if (ret == -EINVAL) { in ceph_parse_mount_param()
603 param->key); in ceph_parse_mount_param()
604 } else if (ret == -EEXIST) { in ceph_parse_mount_param()
606 ret = -EINVAL; in ceph_parse_mount_param()
613 default: in ceph_parse_mount_param()
619 return invalfc(fc, "%s out of range", param->key); in ceph_parse_mount_param()
624 dout("destroy_mount_options %p\n", args); in destroy_mount_options()
628 kfree(args->snapdir_name); in destroy_mount_options()
629 kfree(args->mds_namespace); in destroy_mount_options()
630 kfree(args->server_path); in destroy_mount_options()
631 kfree(args->fscache_uniq); in destroy_mount_options()
632 kfree(args->mon_addr); in destroy_mount_options()
633 fscrypt_free_dummy_policy(&args->dummy_enc_policy); in destroy_mount_options()
642 return -1; in strcmp_null()
653 struct ceph_mount_options *fsopt2 = fsc->mount_options; in compare_mount_options()
661 ret = strcmp_null(fsopt1->snapdir_name, fsopt2->snapdir_name); in compare_mount_options()
665 ret = strcmp_null(fsopt1->mds_namespace, fsopt2->mds_namespace); in compare_mount_options()
669 ret = strcmp_null(fsopt1->server_path, fsopt2->server_path); in compare_mount_options()
673 ret = strcmp_null(fsopt1->fscache_uniq, fsopt2->fscache_uniq); in compare_mount_options()
677 ret = strcmp_null(fsopt1->mon_addr, fsopt2->mon_addr); in compare_mount_options()
681 return ceph_compare_options(new_opt, fsc->client); in compare_mount_options()
685 * ceph_show_options - Show mount options in /proc/mounts
691 struct ceph_fs_client *fsc = ceph_sb_to_fs_client(root->d_sb); in ceph_show_options()
692 struct ceph_mount_options *fsopt = fsc->mount_options; in ceph_show_options()
698 pos = m->count; in ceph_show_options()
700 ret = ceph_print_client_options(m, fsc->client, false); in ceph_show_options()
705 if (m->count == pos) in ceph_show_options()
706 m->count--; in ceph_show_options()
708 if (fsopt->flags & CEPH_MOUNT_OPT_DIRSTAT) in ceph_show_options()
710 if ((fsopt->flags & CEPH_MOUNT_OPT_RBYTES)) in ceph_show_options()
712 if (fsopt->flags & CEPH_MOUNT_OPT_NOASYNCREADDIR) in ceph_show_options()
714 if ((fsopt->flags & CEPH_MOUNT_OPT_DCACHE) == 0) in ceph_show_options()
716 if (fsopt->flags & CEPH_MOUNT_OPT_INO32) in ceph_show_options()
718 if (fsopt->flags & CEPH_MOUNT_OPT_FSCACHE) { in ceph_show_options()
719 seq_show_option(m, "fsc", fsopt->fscache_uniq); in ceph_show_options()
721 if (fsopt->flags & CEPH_MOUNT_OPT_NOPOOLPERM) in ceph_show_options()
723 if (fsopt->flags & CEPH_MOUNT_OPT_NOQUOTADF) in ceph_show_options()
727 if (root->d_sb->s_flags & SB_POSIXACL) in ceph_show_options()
733 if ((fsopt->flags & CEPH_MOUNT_OPT_NOCOPYFROM) == 0) in ceph_show_options()
737 if (fsopt->mds_namespace && !fsopt->new_dev_syntax) in ceph_show_options()
738 seq_show_option(m, "mds_namespace", fsopt->mds_namespace); in ceph_show_options()
740 if (fsopt->mon_addr) in ceph_show_options()
741 seq_printf(m, ",mon_addr=%s", fsopt->mon_addr); in ceph_show_options()
743 if (fsopt->flags & CEPH_MOUNT_OPT_CLEANRECOVER) in ceph_show_options()
746 if (!(fsopt->flags & CEPH_MOUNT_OPT_ASYNC_DIROPS)) in ceph_show_options()
748 if (fsopt->flags & CEPH_MOUNT_OPT_NOPAGECACHE) in ceph_show_options()
750 if (fsopt->flags & CEPH_MOUNT_OPT_SPARSEREAD) in ceph_show_options()
753 fscrypt_show_test_dummy_encryption(m, ',', root->d_sb); in ceph_show_options()
755 if (fsopt->wsize != CEPH_MAX_WRITE_SIZE) in ceph_show_options()
756 seq_printf(m, ",wsize=%u", fsopt->wsize); in ceph_show_options()
757 if (fsopt->rsize != CEPH_MAX_READ_SIZE) in ceph_show_options()
758 seq_printf(m, ",rsize=%u", fsopt->rsize); in ceph_show_options()
759 if (fsopt->rasize != CEPH_RASIZE_DEFAULT) in ceph_show_options()
760 seq_printf(m, ",rasize=%u", fsopt->rasize); in ceph_show_options()
761 if (fsopt->congestion_kb != default_congestion_kb()) in ceph_show_options()
762 seq_printf(m, ",write_congestion_kb=%u", fsopt->congestion_kb); in ceph_show_options()
763 if (fsopt->caps_max) in ceph_show_options()
764 seq_printf(m, ",caps_max=%d", fsopt->caps_max); in ceph_show_options()
765 if (fsopt->caps_wanted_delay_min != CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT) in ceph_show_options()
767 fsopt->caps_wanted_delay_min); in ceph_show_options()
768 if (fsopt->caps_wanted_delay_max != CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT) in ceph_show_options()
770 fsopt->caps_wanted_delay_max); in ceph_show_options()
771 if (fsopt->max_readdir != CEPH_MAX_READDIR_DEFAULT) in ceph_show_options()
772 seq_printf(m, ",readdir_max_entries=%u", fsopt->max_readdir); in ceph_show_options()
773 if (fsopt->max_readdir_bytes != CEPH_MAX_READDIR_BYTES_DEFAULT) in ceph_show_options()
774 seq_printf(m, ",readdir_max_bytes=%u", fsopt->max_readdir_bytes); in ceph_show_options()
775 if (strcmp(fsopt->snapdir_name, CEPH_SNAPDIRNAME_DEFAULT)) in ceph_show_options()
776 seq_show_option(m, "snapdirname", fsopt->snapdir_name); in ceph_show_options()
787 struct ceph_fs_client *fsc = client->private; in extra_mon_dispatch()
788 int type = le16_to_cpu(msg->hdr.type); in extra_mon_dispatch()
792 ceph_mdsc_handle_mdsmap(fsc->mdsc, msg); in extra_mon_dispatch()
795 ceph_mdsc_handle_fsmap(fsc->mdsc, msg); in extra_mon_dispatch()
797 default: in extra_mon_dispatch()
798 return -1; in extra_mon_dispatch()
815 err = -ENOMEM; in create_fs_client()
819 fsc->client = ceph_create_client(opt, fsc); in create_fs_client()
820 if (IS_ERR(fsc->client)) { in create_fs_client()
821 err = PTR_ERR(fsc->client); in create_fs_client()
824 opt = NULL; /* fsc->client now owns this */ in create_fs_client()
826 fsc->client->extra_mon_dispatch = extra_mon_dispatch; in create_fs_client()
827 ceph_set_opt(fsc->client, ABORT_ON_FULL); in create_fs_client()
829 if (!fsopt->mds_namespace) { in create_fs_client()
830 ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP, in create_fs_client()
833 ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_FSMAP, in create_fs_client()
837 fsc->mount_options = fsopt; in create_fs_client()
839 fsc->sb = NULL; in create_fs_client()
840 fsc->mount_state = CEPH_MOUNT_MOUNTING; in create_fs_client()
841 fsc->filp_gen = 1; in create_fs_client()
842 fsc->have_copy_from2 = true; in create_fs_client()
844 atomic_long_set(&fsc->writeback_count, 0); in create_fs_client()
845 fsc->write_congested = false; in create_fs_client()
847 err = -ENOMEM; in create_fs_client()
852 fsc->inode_wq = alloc_workqueue("ceph-inode", WQ_UNBOUND, 0); in create_fs_client()
853 if (!fsc->inode_wq) in create_fs_client()
855 fsc->cap_wq = alloc_workqueue("ceph-cap", 0, 1); in create_fs_client()
856 if (!fsc->cap_wq) in create_fs_client()
859 hash_init(fsc->async_unlink_conflict); in create_fs_client()
860 spin_lock_init(&fsc->async_unlink_conflict_lock); in create_fs_client()
863 list_add_tail(&fsc->metric_wakeup, &ceph_fsc_list); in create_fs_client()
869 destroy_workqueue(fsc->inode_wq); in create_fs_client()
871 ceph_destroy_client(fsc->client); in create_fs_client()
882 flush_workqueue(fsc->inode_wq); in flush_fs_workqueues()
883 flush_workqueue(fsc->cap_wq); in flush_fs_workqueues()
888 doutc(fsc->client, "%p\n", fsc); in destroy_fs_client()
891 list_del(&fsc->metric_wakeup); in destroy_fs_client()
895 destroy_workqueue(fsc->inode_wq); in destroy_fs_client()
896 destroy_workqueue(fsc->cap_wq); in destroy_fs_client()
898 destroy_mount_options(fsc->mount_options); in destroy_fs_client()
900 ceph_destroy_client(fsc->client); in destroy_fs_client()
903 dout("%s: %p done\n", __func__, fsc); in destroy_fs_client()
922 inode_init_once(&ci->netfs.inode); in ceph_inode_init_once()
927 int error = -ENOMEM; in init_caches()
935 return -ENOMEM; in init_caches()
1012 ceph_osdc_abort_requests(&fsc->client->osdc, -EIO); in __ceph_umount_begin()
1013 ceph_mdsc_force_umount(fsc->mdsc); in __ceph_umount_begin()
1014 fsc->filp_gen++; // invalidate open files in __ceph_umount_begin()
1018 * ceph_umount_begin - initiate forced umount. Tear down the
1025 doutc(fsc->client, "starting forced umount\n"); in ceph_umount_begin()
1028 fsc->mount_state = CEPH_MOUNT_SHUTDOWN; in ceph_umount_begin()
1053 struct ceph_client *cl = fsc->client; in open_root_dentry()
1054 struct ceph_mds_client *mdsc = fsc->mdsc; in open_root_dentry()
1064 req->r_path1 = kstrdup(path, GFP_NOFS); in open_root_dentry()
1065 if (!req->r_path1) { in open_root_dentry()
1066 root = ERR_PTR(-ENOMEM); in open_root_dentry()
1070 req->r_ino1.ino = CEPH_INO_ROOT; in open_root_dentry()
1071 req->r_ino1.snap = CEPH_NOSNAP; in open_root_dentry()
1072 req->r_started = started; in open_root_dentry()
1073 req->r_timeout = fsc->client->options->mount_timeout; in open_root_dentry()
1074 req->r_args.getattr.mask = cpu_to_le32(CEPH_STAT_CAP_INODE); in open_root_dentry()
1075 req->r_num_caps = 2; in open_root_dentry()
1078 struct inode *inode = req->r_target_inode; in open_root_dentry()
1079 req->r_target_inode = NULL; in open_root_dentry()
1083 root = ERR_PTR(-ENOMEM); in open_root_dentry()
1100 struct ceph_fs_client *fsc = sb->s_fs_info; in ceph_apply_test_dummy_encryption()
1102 if (!fscrypt_is_dummy_policy_set(&fsopt->dummy_enc_policy)) in ceph_apply_test_dummy_encryption()
1106 if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE && in ceph_apply_test_dummy_encryption()
1107 !fscrypt_is_dummy_policy_set(&fsc->fsc_dummy_enc_policy)) { in ceph_apply_test_dummy_encryption()
1108 if (fscrypt_dummy_policies_equal(&fsopt->dummy_enc_policy, in ceph_apply_test_dummy_encryption()
1109 &fsc->fsc_dummy_enc_policy)) in ceph_apply_test_dummy_encryption()
1112 return -EINVAL; in ceph_apply_test_dummy_encryption()
1116 if (fscrypt_is_dummy_policy_set(&fsc->fsc_dummy_enc_policy)) { in ceph_apply_test_dummy_encryption()
1117 if (fscrypt_dummy_policies_equal(&fsopt->dummy_enc_policy, in ceph_apply_test_dummy_encryption()
1118 &fsc->fsc_dummy_enc_policy)) in ceph_apply_test_dummy_encryption()
1121 return -EINVAL; in ceph_apply_test_dummy_encryption()
1124 fsc->fsc_dummy_enc_policy = fsopt->dummy_enc_policy; in ceph_apply_test_dummy_encryption()
1125 memset(&fsopt->dummy_enc_policy, 0, sizeof(fsopt->dummy_enc_policy)); in ceph_apply_test_dummy_encryption()
1145 struct ceph_client *cl = fsc->client; in ceph_real_mount()
1151 mutex_lock(&fsc->client->mount_mutex); in ceph_real_mount()
1153 if (!fsc->sb->s_root) { in ceph_real_mount()
1154 const char *path = fsc->mount_options->server_path ? in ceph_real_mount()
1155 fsc->mount_options->server_path + 1 : ""; in ceph_real_mount()
1157 err = __ceph_open_session(fsc->client, started); in ceph_real_mount()
1162 if (fsc->mount_options->flags & CEPH_MOUNT_OPT_FSCACHE) { in ceph_real_mount()
1168 err = ceph_apply_test_dummy_encryption(fsc->sb, fc, in ceph_real_mount()
1169 fsc->mount_options); in ceph_real_mount()
1182 fsc->sb->s_root = dget(root); in ceph_real_mount()
1184 root = dget(fsc->sb->s_root); in ceph_real_mount()
1187 fsc->mount_state = CEPH_MOUNT_MOUNTED; in ceph_real_mount()
1189 mutex_unlock(&fsc->client->mount_mutex); in ceph_real_mount()
1193 mutex_unlock(&fsc->client->mount_mutex); in ceph_real_mount()
1200 struct ceph_fs_client *fsc = s->s_fs_info; in ceph_set_super()
1201 struct ceph_client *cl = fsc->client; in ceph_set_super()
1206 s->s_maxbytes = MAX_LFS_FILESIZE; in ceph_set_super()
1208 s->s_xattr = ceph_xattr_handlers; in ceph_set_super()
1209 fsc->sb = s; in ceph_set_super()
1210 fsc->max_file_size = 1ULL << 40; /* temp value until we get mdsmap */ in ceph_set_super()
1212 s->s_op = &ceph_super_ops; in ceph_set_super()
1213 s->s_d_op = &ceph_dentry_ops; in ceph_set_super()
1214 s->s_export_op = &ceph_export_ops; in ceph_set_super()
1216 s->s_time_gran = 1; in ceph_set_super()
1217 s->s_time_min = 0; in ceph_set_super()
1218 s->s_time_max = U32_MAX; in ceph_set_super()
1219 s->s_flags |= SB_NODIRATIME | SB_NOATIME; in ceph_set_super()
1225 fsc->sb = NULL; in ceph_set_super()
1234 struct ceph_fs_client *new = fc->s_fs_info; in ceph_compare_super()
1235 struct ceph_mount_options *fsopt = new->mount_options; in ceph_compare_super()
1236 struct ceph_options *opt = new->client->options; in ceph_compare_super()
1238 struct ceph_client *cl = fsc->client; in ceph_compare_super()
1246 if ((opt->flags & CEPH_OPT_FSID) && in ceph_compare_super()
1247 ceph_fsid_compare(&opt->fsid, &fsc->client->fsid)) { in ceph_compare_super()
1251 if (fc->sb_flags != (sb->s_flags & ~SB_BORN)) { in ceph_compare_super()
1256 if (fsc->blocklisted && !ceph_test_mount_opt(fsc, CLEANRECOVER)) { in ceph_compare_super()
1261 if (fsc->mount_state == CEPH_MOUNT_SHUTDOWN) { in ceph_compare_super()
1278 err = super_setup_bdi_name(sb, "ceph-%ld", in ceph_setup_bdi()
1284 sb->s_bdi->ra_pages = fsc->mount_options->rasize >> PAGE_SHIFT; in ceph_setup_bdi()
1287 sb->s_bdi->io_pages = fsc->mount_options->rsize >> PAGE_SHIFT; in ceph_setup_bdi()
1294 struct ceph_parse_opts_ctx *pctx = fc->fs_private; in ceph_get_tree()
1295 struct ceph_mount_options *fsopt = pctx->opts; in ceph_get_tree()
1303 dout("ceph_get_tree\n"); in ceph_get_tree()
1305 if (!fc->source) in ceph_get_tree()
1307 if (fsopt->new_dev_syntax && !fsopt->mon_addr) in ceph_get_tree()
1311 fsc = create_fs_client(pctx->opts, pctx->copts); in ceph_get_tree()
1312 pctx->opts = NULL; in ceph_get_tree()
1313 pctx->copts = NULL; in ceph_get_tree()
1323 if (ceph_test_opt(fsc->client, NOSHARE)) in ceph_get_tree()
1326 fc->s_fs_info = fsc; in ceph_get_tree()
1328 fc->s_fs_info = NULL; in ceph_get_tree()
1337 dout("get_sb got existing client %p\n", fsc); in ceph_get_tree()
1339 dout("get_sb using new client %p\n", fsc); in ceph_get_tree()
1351 doutc(fsc->client, "root %p inode %p ino %llx.%llx\n", res, in ceph_get_tree()
1353 fc->root = fsc->sb->s_root; in ceph_get_tree()
1357 if (!ceph_mdsmap_is_cluster_available(fsc->mdsc->mdsmap)) { in ceph_get_tree()
1359 err = -EHOSTUNREACH; in ceph_get_tree()
1362 ceph_mdsc_close_sessions(fsc->mdsc); in ceph_get_tree()
1369 dout("ceph_get_tree fail %d\n", err); in ceph_get_tree()
1375 struct ceph_parse_opts_ctx *pctx = fc->fs_private; in ceph_free_fc()
1378 destroy_mount_options(pctx->opts); in ceph_free_fc()
1379 ceph_destroy_options(pctx->copts); in ceph_free_fc()
1387 struct ceph_parse_opts_ctx *pctx = fc->fs_private; in ceph_reconfigure_fc()
1388 struct ceph_mount_options *fsopt = pctx->opts; in ceph_reconfigure_fc()
1389 struct super_block *sb = fc->root->d_sb; in ceph_reconfigure_fc()
1396 if (fsopt->flags & CEPH_MOUNT_OPT_ASYNC_DIROPS) in ceph_reconfigure_fc()
1401 if (fsopt->flags & CEPH_MOUNT_OPT_SPARSEREAD) in ceph_reconfigure_fc()
1406 if (strcmp_null(fsc->mount_options->mon_addr, fsopt->mon_addr)) { in ceph_reconfigure_fc()
1407 kfree(fsc->mount_options->mon_addr); in ceph_reconfigure_fc()
1408 fsc->mount_options->mon_addr = fsopt->mon_addr; in ceph_reconfigure_fc()
1409 fsopt->mon_addr = NULL; in ceph_reconfigure_fc()
1410 pr_notice_client(fsc->client, in ceph_reconfigure_fc()
1435 return -ENOMEM; in ceph_init_fs_context()
1437 pctx->copts = ceph_alloc_options(); in ceph_init_fs_context()
1438 if (!pctx->copts) in ceph_init_fs_context()
1441 pctx->opts = kzalloc(sizeof(*pctx->opts), GFP_KERNEL); in ceph_init_fs_context()
1442 if (!pctx->opts) in ceph_init_fs_context()
1445 fsopt = pctx->opts; in ceph_init_fs_context()
1446 fsopt->flags = CEPH_MOUNT_OPT_DEFAULT; in ceph_init_fs_context()
1448 fsopt->wsize = CEPH_MAX_WRITE_SIZE; in ceph_init_fs_context()
1449 fsopt->rsize = CEPH_MAX_READ_SIZE; in ceph_init_fs_context()
1450 fsopt->rasize = CEPH_RASIZE_DEFAULT; in ceph_init_fs_context()
1451 fsopt->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL); in ceph_init_fs_context()
1452 if (!fsopt->snapdir_name) in ceph_init_fs_context()
1455 fsopt->caps_wanted_delay_min = CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT; in ceph_init_fs_context()
1456 fsopt->caps_wanted_delay_max = CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT; in ceph_init_fs_context()
1457 fsopt->max_readdir = CEPH_MAX_READDIR_DEFAULT; in ceph_init_fs_context()
1458 fsopt->max_readdir_bytes = CEPH_MAX_READDIR_BYTES_DEFAULT; in ceph_init_fs_context()
1459 fsopt->congestion_kb = default_congestion_kb(); in ceph_init_fs_context()
1462 fc->sb_flags |= SB_POSIXACL; in ceph_init_fs_context()
1465 fc->fs_private = pctx; in ceph_init_fs_context()
1466 fc->ops = &ceph_context_ops; in ceph_init_fs_context()
1470 destroy_mount_options(pctx->opts); in ceph_init_fs_context()
1471 ceph_destroy_options(pctx->copts); in ceph_init_fs_context()
1473 return -ENOMEM; in ceph_init_fs_context()
1482 spin_lock(&mdsc->stopping_lock); in __inc_stopping_blocker()
1483 if (mdsc->stopping >= CEPH_MDSC_STOPPING_FLUSHING) { in __inc_stopping_blocker()
1484 spin_unlock(&mdsc->stopping_lock); in __inc_stopping_blocker()
1487 atomic_inc(&mdsc->stopping_blockers); in __inc_stopping_blocker()
1488 spin_unlock(&mdsc->stopping_lock); in __inc_stopping_blocker()
1494 spin_lock(&mdsc->stopping_lock); in __dec_stopping_blocker()
1495 if (!atomic_dec_return(&mdsc->stopping_blockers) && in __dec_stopping_blocker()
1496 mdsc->stopping >= CEPH_MDSC_STOPPING_FLUSHING) in __dec_stopping_blocker()
1497 complete_all(&mdsc->stopping_waiter); in __dec_stopping_blocker()
1498 spin_unlock(&mdsc->stopping_lock); in __dec_stopping_blocker()
1505 mutex_lock(&session->s_mutex); in ceph_inc_mds_stopping_blocker()
1507 mutex_unlock(&session->s_mutex); in ceph_inc_mds_stopping_blocker()
1531 struct ceph_client *cl = fsc->client; in ceph_kill_sb()
1532 struct ceph_mds_client *mdsc = fsc->mdsc; in ceph_kill_sb()
1556 spin_lock(&mdsc->stopping_lock); in ceph_kill_sb()
1557 mdsc->stopping = CEPH_MDSC_STOPPING_FLUSHING; in ceph_kill_sb()
1558 wait = !!atomic_read(&mdsc->stopping_blockers); in ceph_kill_sb()
1559 spin_unlock(&mdsc->stopping_lock); in ceph_kill_sb()
1561 if (wait && atomic_read(&mdsc->stopping_blockers)) { in ceph_kill_sb()
1563 &mdsc->stopping_waiter, in ceph_kill_sb()
1564 fsc->client->options->mount_timeout); in ceph_kill_sb()
1571 mdsc->stopping = CEPH_MDSC_STOPPING_FLUSHED; in ceph_kill_sb()
1574 fsc->client->extra_mon_dispatch = NULL; in ceph_kill_sb()
1596 fsc->mount_state = CEPH_MOUNT_RECOVER; in ceph_force_reconnect()
1601 flush_workqueue(fsc->inode_wq); in ceph_force_reconnect()
1605 ceph_reset_client_addr(fsc->client); in ceph_force_reconnect()
1607 ceph_osdc_clear_abort_err(&fsc->client->osdc); in ceph_force_reconnect()
1609 fsc->blocklisted = false; in ceph_force_reconnect()
1610 fsc->mount_state = CEPH_MOUNT_MOUNTED; in ceph_force_reconnect()
1612 if (sb->s_root) { in ceph_force_reconnect()
1613 err = __ceph_do_getattr(d_inode(sb->s_root), NULL, in ceph_force_reconnect()
1642 dout("exit_ceph\n"); in exit_ceph()
1661 metric_schedule_delayed(&fsc->mdsc->metric); in param_set_metrics()
1676 MODULE_PARM_DESC(disable_send_metrics, "Enable sending perf metrics to ceph cluster (default: on)");