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_options *opts = pctx->copts; in ceph_parse_new_source()
289 struct ceph_mount_options *fsopt = pctx->opts; in ceph_parse_new_source()
294 dout("separator '=' missing in source"); in ceph_parse_new_source()
295 return -EINVAL; in ceph_parse_new_source()
301 len = fsid_start - name_start; in ceph_parse_new_source()
302 kfree(opts->name); in ceph_parse_new_source()
303 opts->name = kstrndup(name_start, len, GFP_KERNEL); in ceph_parse_new_source()
304 if (!opts->name) in ceph_parse_new_source()
305 return -ENOMEM; in ceph_parse_new_source()
306 dout("using %s entity name", opts->name); in ceph_parse_new_source()
317 len = dev_name_end - fs_name_start; in ceph_parse_new_source()
321 kfree(fsopt->mds_namespace); in ceph_parse_new_source()
322 fsopt->mds_namespace = kstrndup(fs_name_start, len, GFP_KERNEL); in ceph_parse_new_source()
323 if (!fsopt->mds_namespace) in ceph_parse_new_source()
324 return -ENOMEM; in ceph_parse_new_source()
325 dout("file system (mds namespace) '%s'\n", fsopt->mds_namespace); in ceph_parse_new_source()
327 fsopt->new_dev_syntax = true; in ceph_parse_new_source()
351 struct ceph_parse_opts_ctx *pctx = fc->fs_private; in ceph_parse_source()
352 struct ceph_mount_options *fsopt = pctx->opts; in ceph_parse_source()
353 char *dev_name = param->string, *dev_name_end; in ceph_parse_source()
356 dout("'%s'\n", dev_name); in ceph_parse_source()
366 kfree(fsopt->server_path); in ceph_parse_source()
367 fsopt->server_path = kstrdup(dev_name_end, GFP_KERNEL); in ceph_parse_source()
368 if (!fsopt->server_path) in ceph_parse_source()
369 return -ENOMEM; in ceph_parse_source()
371 canonicalize_path(fsopt->server_path); in ceph_parse_source()
376 dev_name_end--; /* back up to separator */ in ceph_parse_source()
380 dout("device name '%.*s'\n", (int)(dev_name_end - dev_name), dev_name); in ceph_parse_source()
381 if (fsopt->server_path) in ceph_parse_source()
382 dout("server path '%s'\n", fsopt->server_path); in ceph_parse_source()
384 dout("trying new device syntax"); in ceph_parse_source()
387 if (ret != -EINVAL) in ceph_parse_source()
389 dout("trying old device syntax"); in ceph_parse_source()
395 fc->source = param->string; in ceph_parse_source()
396 param->string = NULL; in ceph_parse_source()
403 struct ceph_parse_opts_ctx *pctx = fc->fs_private; in ceph_parse_mon_addr()
404 struct ceph_mount_options *fsopt = pctx->opts; in ceph_parse_mon_addr()
406 kfree(fsopt->mon_addr); in ceph_parse_mon_addr()
407 fsopt->mon_addr = param->string; in ceph_parse_mon_addr()
408 param->string = NULL; in ceph_parse_mon_addr()
410 return ceph_parse_mon_ips(fsopt->mon_addr, strlen(fsopt->mon_addr), in ceph_parse_mon_addr()
411 pctx->copts, fc->log.log, '/'); in ceph_parse_mon_addr()
417 struct ceph_parse_opts_ctx *pctx = fc->fs_private; in ceph_parse_mount_param()
418 struct ceph_mount_options *fsopt = pctx->opts; in ceph_parse_mount_param()
423 ret = ceph_parse_param(param, pctx->copts, fc->log.log); in ceph_parse_mount_param()
424 if (ret != -ENOPARAM) in ceph_parse_mount_param()
428 dout("%s: fs_parse '%s' token %d\n",__func__, param->key, token); in ceph_parse_mount_param()
434 if (strlen(param->string) > NAME_MAX) in ceph_parse_mount_param()
436 kfree(fsopt->snapdir_name); in ceph_parse_mount_param()
437 fsopt->snapdir_name = param->string; in ceph_parse_mount_param()
438 param->string = NULL; in ceph_parse_mount_param()
441 if (!namespace_equals(fsopt, param->string, strlen(param->string))) in ceph_parse_mount_param()
443 kfree(fsopt->mds_namespace); in ceph_parse_mount_param()
444 fsopt->mds_namespace = param->string; in ceph_parse_mount_param()
445 param->string = NULL; in ceph_parse_mount_param()
450 fsopt->flags &= ~CEPH_MOUNT_OPT_CLEANRECOVER; in ceph_parse_mount_param()
452 fsopt->flags |= CEPH_MOUNT_OPT_CLEANRECOVER; in ceph_parse_mount_param()
457 if (fc->source) in ceph_parse_mount_param()
466 fsopt->wsize = ALIGN(result.uint_32, PAGE_SIZE); in ceph_parse_mount_param()
472 fsopt->rsize = ALIGN(result.uint_32, PAGE_SIZE); in ceph_parse_mount_param()
475 fsopt->rasize = ALIGN(result.uint_32, PAGE_SIZE); in ceph_parse_mount_param()
480 fsopt->caps_wanted_delay_min = result.uint_32; in ceph_parse_mount_param()
485 fsopt->caps_wanted_delay_max = result.uint_32; in ceph_parse_mount_param()
490 fsopt->caps_max = result.int_32; in ceph_parse_mount_param()
495 fsopt->max_readdir = result.uint_32; in ceph_parse_mount_param()
500 fsopt->max_readdir_bytes = result.uint_32; in ceph_parse_mount_param()
505 fsopt->congestion_kb = result.uint_32; in ceph_parse_mount_param()
509 fsopt->flags |= CEPH_MOUNT_OPT_DIRSTAT; in ceph_parse_mount_param()
511 fsopt->flags &= ~CEPH_MOUNT_OPT_DIRSTAT; in ceph_parse_mount_param()
515 fsopt->flags |= CEPH_MOUNT_OPT_RBYTES; in ceph_parse_mount_param()
517 fsopt->flags &= ~CEPH_MOUNT_OPT_RBYTES; in ceph_parse_mount_param()
521 fsopt->flags &= ~CEPH_MOUNT_OPT_NOASYNCREADDIR; in ceph_parse_mount_param()
523 fsopt->flags |= CEPH_MOUNT_OPT_NOASYNCREADDIR; in ceph_parse_mount_param()
527 fsopt->flags |= CEPH_MOUNT_OPT_DCACHE; in ceph_parse_mount_param()
529 fsopt->flags &= ~CEPH_MOUNT_OPT_DCACHE; in ceph_parse_mount_param()
533 fsopt->flags |= CEPH_MOUNT_OPT_INO32; in ceph_parse_mount_param()
535 fsopt->flags &= ~CEPH_MOUNT_OPT_INO32; in ceph_parse_mount_param()
540 kfree(fsopt->fscache_uniq); in ceph_parse_mount_param()
541 fsopt->fscache_uniq = NULL; in ceph_parse_mount_param()
543 fsopt->flags &= ~CEPH_MOUNT_OPT_FSCACHE; in ceph_parse_mount_param()
545 fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE; in ceph_parse_mount_param()
546 fsopt->fscache_uniq = param->string; in ceph_parse_mount_param()
547 param->string = NULL; in ceph_parse_mount_param()
555 fsopt->flags &= ~CEPH_MOUNT_OPT_NOPOOLPERM; in ceph_parse_mount_param()
557 fsopt->flags |= CEPH_MOUNT_OPT_NOPOOLPERM; in ceph_parse_mount_param()
561 fsopt->flags &= ~CEPH_MOUNT_OPT_MOUNTWAIT; in ceph_parse_mount_param()
563 fsopt->flags |= CEPH_MOUNT_OPT_MOUNTWAIT; in ceph_parse_mount_param()
567 fsopt->flags &= ~CEPH_MOUNT_OPT_NOQUOTADF; in ceph_parse_mount_param()
569 fsopt->flags |= CEPH_MOUNT_OPT_NOQUOTADF; in ceph_parse_mount_param()
573 fsopt->flags &= ~CEPH_MOUNT_OPT_NOCOPYFROM; in ceph_parse_mount_param()
575 fsopt->flags |= CEPH_MOUNT_OPT_NOCOPYFROM; in ceph_parse_mount_param()
580 fc->sb_flags |= SB_POSIXACL; in ceph_parse_mount_param()
585 fc->sb_flags &= ~SB_POSIXACL; in ceph_parse_mount_param()
590 fsopt->flags &= ~CEPH_MOUNT_OPT_ASYNC_DIROPS; in ceph_parse_mount_param()
592 fsopt->flags |= CEPH_MOUNT_OPT_ASYNC_DIROPS; in ceph_parse_mount_param()
596 fsopt->flags |= CEPH_MOUNT_OPT_NOPAGECACHE; in ceph_parse_mount_param()
598 fsopt->flags &= ~CEPH_MOUNT_OPT_NOPAGECACHE; in ceph_parse_mount_param()
602 fsopt->flags &= ~CEPH_MOUNT_OPT_SPARSEREAD; in ceph_parse_mount_param()
604 fsopt->flags |= CEPH_MOUNT_OPT_SPARSEREAD; in ceph_parse_mount_param()
608 fscrypt_free_dummy_policy(&fsopt->dummy_enc_policy); in ceph_parse_mount_param()
610 &fsopt->dummy_enc_policy); in ceph_parse_mount_param()
611 if (ret == -EINVAL) { in ceph_parse_mount_param()
613 param->key); in ceph_parse_mount_param()
614 } else if (ret == -EEXIST) { in ceph_parse_mount_param()
616 ret = -EINVAL; in ceph_parse_mount_param()
623 default: in ceph_parse_mount_param()
629 return invalfc(fc, "%s out of range", param->key); in ceph_parse_mount_param()
634 dout("destroy_mount_options %p\n", args); in destroy_mount_options()
638 kfree(args->snapdir_name); in destroy_mount_options()
639 kfree(args->mds_namespace); in destroy_mount_options()
640 kfree(args->server_path); in destroy_mount_options()
641 kfree(args->fscache_uniq); in destroy_mount_options()
642 kfree(args->mon_addr); in destroy_mount_options()
643 fscrypt_free_dummy_policy(&args->dummy_enc_policy); in destroy_mount_options()
652 return -1; in strcmp_null()
663 struct ceph_mount_options *fsopt2 = fsc->mount_options; in compare_mount_options()
671 ret = strcmp_null(fsopt1->snapdir_name, fsopt2->snapdir_name); in compare_mount_options()
675 ret = strcmp_null(fsopt1->mds_namespace, fsopt2->mds_namespace); in compare_mount_options()
679 ret = strcmp_null(fsopt1->server_path, fsopt2->server_path); in compare_mount_options()
683 ret = strcmp_null(fsopt1->fscache_uniq, fsopt2->fscache_uniq); in compare_mount_options()
687 ret = strcmp_null(fsopt1->mon_addr, fsopt2->mon_addr); in compare_mount_options()
691 return ceph_compare_options(new_opt, fsc->client); in compare_mount_options()
695 * ceph_show_options - Show mount options in /proc/mounts
701 struct ceph_fs_client *fsc = ceph_sb_to_fs_client(root->d_sb); in ceph_show_options()
702 struct ceph_mount_options *fsopt = fsc->mount_options; in ceph_show_options()
708 pos = m->count; in ceph_show_options()
710 ret = ceph_print_client_options(m, fsc->client, false); in ceph_show_options()
715 if (m->count == pos) in ceph_show_options()
716 m->count--; in ceph_show_options()
718 if (fsopt->flags & CEPH_MOUNT_OPT_DIRSTAT) in ceph_show_options()
720 if ((fsopt->flags & CEPH_MOUNT_OPT_RBYTES)) in ceph_show_options()
722 if (fsopt->flags & CEPH_MOUNT_OPT_NOASYNCREADDIR) in ceph_show_options()
724 if ((fsopt->flags & CEPH_MOUNT_OPT_DCACHE) == 0) in ceph_show_options()
726 if (fsopt->flags & CEPH_MOUNT_OPT_INO32) in ceph_show_options()
728 if (fsopt->flags & CEPH_MOUNT_OPT_FSCACHE) { in ceph_show_options()
729 seq_show_option(m, "fsc", fsopt->fscache_uniq); in ceph_show_options()
731 if (fsopt->flags & CEPH_MOUNT_OPT_NOPOOLPERM) in ceph_show_options()
733 if (fsopt->flags & CEPH_MOUNT_OPT_NOQUOTADF) in ceph_show_options()
737 if (root->d_sb->s_flags & SB_POSIXACL) in ceph_show_options()
743 if ((fsopt->flags & CEPH_MOUNT_OPT_NOCOPYFROM) == 0) in ceph_show_options()
747 if (fsopt->mds_namespace && !fsopt->new_dev_syntax) in ceph_show_options()
748 seq_show_option(m, "mds_namespace", fsopt->mds_namespace); in ceph_show_options()
750 if (fsopt->mon_addr) in ceph_show_options()
751 seq_printf(m, ",mon_addr=%s", fsopt->mon_addr); in ceph_show_options()
753 if (fsopt->flags & CEPH_MOUNT_OPT_CLEANRECOVER) in ceph_show_options()
756 if (!(fsopt->flags & CEPH_MOUNT_OPT_ASYNC_DIROPS)) in ceph_show_options()
758 if (fsopt->flags & CEPH_MOUNT_OPT_NOPAGECACHE) in ceph_show_options()
760 if (fsopt->flags & CEPH_MOUNT_OPT_SPARSEREAD) in ceph_show_options()
763 fscrypt_show_test_dummy_encryption(m, ',', root->d_sb); in ceph_show_options()
765 if (fsopt->wsize != CEPH_MAX_WRITE_SIZE) in ceph_show_options()
766 seq_printf(m, ",wsize=%u", fsopt->wsize); in ceph_show_options()
767 if (fsopt->rsize != CEPH_MAX_READ_SIZE) in ceph_show_options()
768 seq_printf(m, ",rsize=%u", fsopt->rsize); in ceph_show_options()
769 if (fsopt->rasize != CEPH_RASIZE_DEFAULT) in ceph_show_options()
770 seq_printf(m, ",rasize=%u", fsopt->rasize); in ceph_show_options()
771 if (fsopt->congestion_kb != default_congestion_kb()) in ceph_show_options()
772 seq_printf(m, ",write_congestion_kb=%u", fsopt->congestion_kb); in ceph_show_options()
773 if (fsopt->caps_max) in ceph_show_options()
774 seq_printf(m, ",caps_max=%d", fsopt->caps_max); in ceph_show_options()
775 if (fsopt->caps_wanted_delay_min != CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT) in ceph_show_options()
777 fsopt->caps_wanted_delay_min); in ceph_show_options()
778 if (fsopt->caps_wanted_delay_max != CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT) in ceph_show_options()
780 fsopt->caps_wanted_delay_max); in ceph_show_options()
781 if (fsopt->max_readdir != CEPH_MAX_READDIR_DEFAULT) in ceph_show_options()
782 seq_printf(m, ",readdir_max_entries=%u", fsopt->max_readdir); in ceph_show_options()
783 if (fsopt->max_readdir_bytes != CEPH_MAX_READDIR_BYTES_DEFAULT) in ceph_show_options()
784 seq_printf(m, ",readdir_max_bytes=%u", fsopt->max_readdir_bytes); in ceph_show_options()
785 if (strcmp(fsopt->snapdir_name, CEPH_SNAPDIRNAME_DEFAULT)) in ceph_show_options()
786 seq_show_option(m, "snapdirname", fsopt->snapdir_name); in ceph_show_options()
797 struct ceph_fs_client *fsc = client->private; in extra_mon_dispatch()
798 int type = le16_to_cpu(msg->hdr.type); in extra_mon_dispatch()
802 ceph_mdsc_handle_mdsmap(fsc->mdsc, msg); in extra_mon_dispatch()
805 ceph_mdsc_handle_fsmap(fsc->mdsc, msg); in extra_mon_dispatch()
807 default: in extra_mon_dispatch()
808 return -1; in extra_mon_dispatch()
825 err = -ENOMEM; in create_fs_client()
829 fsc->client = ceph_create_client(opt, fsc); in create_fs_client()
830 if (IS_ERR(fsc->client)) { in create_fs_client()
831 err = PTR_ERR(fsc->client); in create_fs_client()
834 opt = NULL; /* fsc->client now owns this */ in create_fs_client()
836 fsc->client->extra_mon_dispatch = extra_mon_dispatch; in create_fs_client()
837 ceph_set_opt(fsc->client, ABORT_ON_FULL); in create_fs_client()
839 if (!fsopt->mds_namespace) { in create_fs_client()
840 ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP, in create_fs_client()
843 ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_FSMAP, in create_fs_client()
847 fsc->mount_options = fsopt; in create_fs_client()
849 fsc->sb = NULL; in create_fs_client()
850 fsc->mount_state = CEPH_MOUNT_MOUNTING; in create_fs_client()
851 fsc->filp_gen = 1; in create_fs_client()
852 fsc->have_copy_from2 = true; in create_fs_client()
854 atomic_long_set(&fsc->writeback_count, 0); in create_fs_client()
855 fsc->write_congested = false; in create_fs_client()
857 err = -ENOMEM; in create_fs_client()
862 fsc->inode_wq = alloc_workqueue("ceph-inode", WQ_UNBOUND, 0); in create_fs_client()
863 if (!fsc->inode_wq) in create_fs_client()
865 fsc->cap_wq = alloc_workqueue("ceph-cap", 0, 1); in create_fs_client()
866 if (!fsc->cap_wq) in create_fs_client()
869 hash_init(fsc->async_unlink_conflict); in create_fs_client()
870 spin_lock_init(&fsc->async_unlink_conflict_lock); in create_fs_client()
873 list_add_tail(&fsc->metric_wakeup, &ceph_fsc_list); in create_fs_client()
879 destroy_workqueue(fsc->inode_wq); in create_fs_client()
881 ceph_destroy_client(fsc->client); in create_fs_client()
892 flush_workqueue(fsc->inode_wq); in flush_fs_workqueues()
893 flush_workqueue(fsc->cap_wq); in flush_fs_workqueues()
898 doutc(fsc->client, "%p\n", fsc); in destroy_fs_client()
901 list_del(&fsc->metric_wakeup); in destroy_fs_client()
905 destroy_workqueue(fsc->inode_wq); in destroy_fs_client()
906 destroy_workqueue(fsc->cap_wq); in destroy_fs_client()
908 destroy_mount_options(fsc->mount_options); in destroy_fs_client()
910 ceph_destroy_client(fsc->client); in destroy_fs_client()
913 dout("%s: %p done\n", __func__, fsc); in destroy_fs_client()
932 inode_init_once(&ci->netfs.inode); in ceph_inode_init_once()
937 int error = -ENOMEM; in init_caches()
945 return -ENOMEM; in init_caches()
1022 ceph_osdc_abort_requests(&fsc->client->osdc, -EIO); in __ceph_umount_begin()
1023 ceph_mdsc_force_umount(fsc->mdsc); in __ceph_umount_begin()
1024 fsc->filp_gen++; // invalidate open files in __ceph_umount_begin()
1028 * ceph_umount_begin - initiate forced umount. Tear down the
1035 doutc(fsc->client, "starting forced umount\n"); in ceph_umount_begin()
1038 fsc->mount_state = CEPH_MOUNT_SHUTDOWN; in ceph_umount_begin()
1063 struct ceph_client *cl = fsc->client; in open_root_dentry()
1064 struct ceph_mds_client *mdsc = fsc->mdsc; in open_root_dentry()
1074 req->r_path1 = kstrdup(path, GFP_NOFS); in open_root_dentry()
1075 if (!req->r_path1) { in open_root_dentry()
1076 root = ERR_PTR(-ENOMEM); in open_root_dentry()
1080 req->r_ino1.ino = CEPH_INO_ROOT; in open_root_dentry()
1081 req->r_ino1.snap = CEPH_NOSNAP; in open_root_dentry()
1082 req->r_started = started; in open_root_dentry()
1083 req->r_timeout = fsc->client->options->mount_timeout; in open_root_dentry()
1084 req->r_args.getattr.mask = cpu_to_le32(CEPH_STAT_CAP_INODE); in open_root_dentry()
1085 req->r_num_caps = 2; in open_root_dentry()
1088 struct inode *inode = req->r_target_inode; in open_root_dentry()
1089 req->r_target_inode = NULL; in open_root_dentry()
1093 root = ERR_PTR(-ENOMEM); in open_root_dentry()
1110 struct ceph_fs_client *fsc = sb->s_fs_info; in ceph_apply_test_dummy_encryption()
1112 if (!fscrypt_is_dummy_policy_set(&fsopt->dummy_enc_policy)) in ceph_apply_test_dummy_encryption()
1116 if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE && in ceph_apply_test_dummy_encryption()
1117 !fscrypt_is_dummy_policy_set(&fsc->fsc_dummy_enc_policy)) { in ceph_apply_test_dummy_encryption()
1118 if (fscrypt_dummy_policies_equal(&fsopt->dummy_enc_policy, in ceph_apply_test_dummy_encryption()
1119 &fsc->fsc_dummy_enc_policy)) in ceph_apply_test_dummy_encryption()
1122 return -EINVAL; in ceph_apply_test_dummy_encryption()
1126 if (fscrypt_is_dummy_policy_set(&fsc->fsc_dummy_enc_policy)) { in ceph_apply_test_dummy_encryption()
1127 if (fscrypt_dummy_policies_equal(&fsopt->dummy_enc_policy, in ceph_apply_test_dummy_encryption()
1128 &fsc->fsc_dummy_enc_policy)) in ceph_apply_test_dummy_encryption()
1131 return -EINVAL; in ceph_apply_test_dummy_encryption()
1134 fsc->fsc_dummy_enc_policy = fsopt->dummy_enc_policy; in ceph_apply_test_dummy_encryption()
1135 memset(&fsopt->dummy_enc_policy, 0, sizeof(fsopt->dummy_enc_policy)); in ceph_apply_test_dummy_encryption()
1155 struct ceph_client *cl = fsc->client; in ceph_real_mount()
1161 mutex_lock(&fsc->client->mount_mutex); in ceph_real_mount()
1163 if (!fsc->sb->s_root) { in ceph_real_mount()
1164 const char *path = fsc->mount_options->server_path ? in ceph_real_mount()
1165 fsc->mount_options->server_path + 1 : ""; in ceph_real_mount()
1167 err = __ceph_open_session(fsc->client, started); in ceph_real_mount()
1172 if (fsc->mount_options->flags & CEPH_MOUNT_OPT_FSCACHE) { in ceph_real_mount()
1178 err = ceph_apply_test_dummy_encryption(fsc->sb, fc, in ceph_real_mount()
1179 fsc->mount_options); in ceph_real_mount()
1192 fsc->sb->s_root = dget(root); in ceph_real_mount()
1194 root = dget(fsc->sb->s_root); in ceph_real_mount()
1197 fsc->mount_state = CEPH_MOUNT_MOUNTED; in ceph_real_mount()
1199 mutex_unlock(&fsc->client->mount_mutex); in ceph_real_mount()
1203 mutex_unlock(&fsc->client->mount_mutex); in ceph_real_mount()
1210 struct ceph_fs_client *fsc = s->s_fs_info; in ceph_set_super()
1211 struct ceph_client *cl = fsc->client; in ceph_set_super()
1216 s->s_maxbytes = MAX_LFS_FILESIZE; in ceph_set_super()
1218 s->s_xattr = ceph_xattr_handlers; in ceph_set_super()
1219 fsc->sb = s; in ceph_set_super()
1220 fsc->max_file_size = 1ULL << 40; /* temp value until we get mdsmap */ in ceph_set_super()
1222 s->s_op = &ceph_super_ops; in ceph_set_super()
1223 s->s_d_op = &ceph_dentry_ops; in ceph_set_super()
1224 s->s_export_op = &ceph_export_ops; in ceph_set_super()
1226 s->s_time_gran = 1; in ceph_set_super()
1227 s->s_time_min = 0; in ceph_set_super()
1228 s->s_time_max = U32_MAX; in ceph_set_super()
1229 s->s_flags |= SB_NODIRATIME | SB_NOATIME; in ceph_set_super()
1235 fsc->sb = NULL; in ceph_set_super()
1244 struct ceph_fs_client *new = fc->s_fs_info; in ceph_compare_super()
1245 struct ceph_mount_options *fsopt = new->mount_options; in ceph_compare_super()
1246 struct ceph_options *opt = new->client->options; in ceph_compare_super()
1248 struct ceph_client *cl = fsc->client; in ceph_compare_super()
1256 if ((opt->flags & CEPH_OPT_FSID) && in ceph_compare_super()
1257 ceph_fsid_compare(&opt->fsid, &fsc->client->fsid)) { in ceph_compare_super()
1261 if (fc->sb_flags != (sb->s_flags & ~SB_BORN)) { in ceph_compare_super()
1266 if (fsc->blocklisted && !ceph_test_mount_opt(fsc, CLEANRECOVER)) { in ceph_compare_super()
1271 if (fsc->mount_state == CEPH_MOUNT_SHUTDOWN) { in ceph_compare_super()
1288 err = super_setup_bdi_name(sb, "ceph-%ld", in ceph_setup_bdi()
1294 sb->s_bdi->ra_pages = fsc->mount_options->rasize >> PAGE_SHIFT; in ceph_setup_bdi()
1297 sb->s_bdi->io_pages = fsc->mount_options->rsize >> PAGE_SHIFT; in ceph_setup_bdi()
1304 struct ceph_parse_opts_ctx *pctx = fc->fs_private; in ceph_get_tree()
1305 struct ceph_mount_options *fsopt = pctx->opts; in ceph_get_tree()
1313 dout("ceph_get_tree\n"); in ceph_get_tree()
1315 if (!fc->source) in ceph_get_tree()
1317 if (fsopt->new_dev_syntax && !fsopt->mon_addr) in ceph_get_tree()
1321 fsc = create_fs_client(pctx->opts, pctx->copts); in ceph_get_tree()
1322 pctx->opts = NULL; in ceph_get_tree()
1323 pctx->copts = NULL; in ceph_get_tree()
1333 if (ceph_test_opt(fsc->client, NOSHARE)) in ceph_get_tree()
1336 fc->s_fs_info = fsc; in ceph_get_tree()
1338 fc->s_fs_info = NULL; in ceph_get_tree()
1347 dout("get_sb got existing client %p\n", fsc); in ceph_get_tree()
1349 dout("get_sb using new client %p\n", fsc); in ceph_get_tree()
1361 doutc(fsc->client, "root %p inode %p ino %llx.%llx\n", res, in ceph_get_tree()
1363 fc->root = fsc->sb->s_root; in ceph_get_tree()
1367 if (!ceph_mdsmap_is_cluster_available(fsc->mdsc->mdsmap)) { in ceph_get_tree()
1369 err = -EHOSTUNREACH; in ceph_get_tree()
1372 ceph_mdsc_close_sessions(fsc->mdsc); in ceph_get_tree()
1379 dout("ceph_get_tree fail %d\n", err); in ceph_get_tree()
1385 struct ceph_parse_opts_ctx *pctx = fc->fs_private; in ceph_free_fc()
1388 destroy_mount_options(pctx->opts); in ceph_free_fc()
1389 ceph_destroy_options(pctx->copts); in ceph_free_fc()
1397 struct ceph_parse_opts_ctx *pctx = fc->fs_private; in ceph_reconfigure_fc()
1398 struct ceph_mount_options *fsopt = pctx->opts; in ceph_reconfigure_fc()
1399 struct super_block *sb = fc->root->d_sb; in ceph_reconfigure_fc()
1406 if (fsopt->flags & CEPH_MOUNT_OPT_ASYNC_DIROPS) in ceph_reconfigure_fc()
1411 if (fsopt->flags & CEPH_MOUNT_OPT_SPARSEREAD) in ceph_reconfigure_fc()
1416 if (strcmp_null(fsc->mount_options->mon_addr, fsopt->mon_addr)) { in ceph_reconfigure_fc()
1417 kfree(fsc->mount_options->mon_addr); in ceph_reconfigure_fc()
1418 fsc->mount_options->mon_addr = fsopt->mon_addr; in ceph_reconfigure_fc()
1419 fsopt->mon_addr = NULL; in ceph_reconfigure_fc()
1420 pr_notice_client(fsc->client, in ceph_reconfigure_fc()
1445 return -ENOMEM; in ceph_init_fs_context()
1447 pctx->copts = ceph_alloc_options(); in ceph_init_fs_context()
1448 if (!pctx->copts) in ceph_init_fs_context()
1451 pctx->opts = kzalloc(sizeof(*pctx->opts), GFP_KERNEL); in ceph_init_fs_context()
1452 if (!pctx->opts) in ceph_init_fs_context()
1455 fsopt = pctx->opts; in ceph_init_fs_context()
1456 fsopt->flags = CEPH_MOUNT_OPT_DEFAULT; in ceph_init_fs_context()
1458 fsopt->wsize = CEPH_MAX_WRITE_SIZE; in ceph_init_fs_context()
1459 fsopt->rsize = CEPH_MAX_READ_SIZE; in ceph_init_fs_context()
1460 fsopt->rasize = CEPH_RASIZE_DEFAULT; in ceph_init_fs_context()
1461 fsopt->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL); in ceph_init_fs_context()
1462 if (!fsopt->snapdir_name) in ceph_init_fs_context()
1465 fsopt->caps_wanted_delay_min = CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT; in ceph_init_fs_context()
1466 fsopt->caps_wanted_delay_max = CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT; in ceph_init_fs_context()
1467 fsopt->max_readdir = CEPH_MAX_READDIR_DEFAULT; in ceph_init_fs_context()
1468 fsopt->max_readdir_bytes = CEPH_MAX_READDIR_BYTES_DEFAULT; in ceph_init_fs_context()
1469 fsopt->congestion_kb = default_congestion_kb(); in ceph_init_fs_context()
1472 fc->sb_flags |= SB_POSIXACL; in ceph_init_fs_context()
1475 fc->fs_private = pctx; in ceph_init_fs_context()
1476 fc->ops = &ceph_context_ops; in ceph_init_fs_context()
1480 destroy_mount_options(pctx->opts); in ceph_init_fs_context()
1481 ceph_destroy_options(pctx->copts); in ceph_init_fs_context()
1483 return -ENOMEM; in ceph_init_fs_context()
1492 spin_lock(&mdsc->stopping_lock); in __inc_stopping_blocker()
1493 if (mdsc->stopping >= CEPH_MDSC_STOPPING_FLUSHING) { in __inc_stopping_blocker()
1494 spin_unlock(&mdsc->stopping_lock); in __inc_stopping_blocker()
1497 atomic_inc(&mdsc->stopping_blockers); in __inc_stopping_blocker()
1498 spin_unlock(&mdsc->stopping_lock); in __inc_stopping_blocker()
1504 spin_lock(&mdsc->stopping_lock); in __dec_stopping_blocker()
1505 if (!atomic_dec_return(&mdsc->stopping_blockers) && in __dec_stopping_blocker()
1506 mdsc->stopping >= CEPH_MDSC_STOPPING_FLUSHING) in __dec_stopping_blocker()
1507 complete_all(&mdsc->stopping_waiter); in __dec_stopping_blocker()
1508 spin_unlock(&mdsc->stopping_lock); in __dec_stopping_blocker()
1515 mutex_lock(&session->s_mutex); in ceph_inc_mds_stopping_blocker()
1517 mutex_unlock(&session->s_mutex); in ceph_inc_mds_stopping_blocker()
1541 struct ceph_client *cl = fsc->client; in ceph_kill_sb()
1542 struct ceph_mds_client *mdsc = fsc->mdsc; in ceph_kill_sb()
1566 spin_lock(&mdsc->stopping_lock); in ceph_kill_sb()
1567 mdsc->stopping = CEPH_MDSC_STOPPING_FLUSHING; in ceph_kill_sb()
1568 wait = !!atomic_read(&mdsc->stopping_blockers); in ceph_kill_sb()
1569 spin_unlock(&mdsc->stopping_lock); in ceph_kill_sb()
1571 if (wait && atomic_read(&mdsc->stopping_blockers)) { in ceph_kill_sb()
1573 &mdsc->stopping_waiter, in ceph_kill_sb()
1574 fsc->client->options->mount_timeout); in ceph_kill_sb()
1581 mdsc->stopping = CEPH_MDSC_STOPPING_FLUSHED; in ceph_kill_sb()
1584 fsc->client->extra_mon_dispatch = NULL; in ceph_kill_sb()
1606 fsc->mount_state = CEPH_MOUNT_RECOVER; in ceph_force_reconnect()
1611 flush_workqueue(fsc->inode_wq); in ceph_force_reconnect()
1615 ceph_reset_client_addr(fsc->client); in ceph_force_reconnect()
1617 ceph_osdc_clear_abort_err(&fsc->client->osdc); in ceph_force_reconnect()
1619 fsc->blocklisted = false; in ceph_force_reconnect()
1620 fsc->mount_state = CEPH_MOUNT_MOUNTED; in ceph_force_reconnect()
1622 if (sb->s_root) { in ceph_force_reconnect()
1623 err = __ceph_do_getattr(d_inode(sb->s_root), NULL, in ceph_force_reconnect()
1652 dout("exit_ceph\n"); in exit_ceph()
1671 metric_schedule_delayed(&fsc->mdsc->metric); in param_set_metrics()
1686 MODULE_PARM_DESC(disable_send_metrics, "Enable sending perf metrics to ceph cluster (default: on)");