Lines Matching refs:fc
125 struct fuse_conn *fc = get_fuse_conn(inode); in fuse_evict_inode() local
130 fuse_queue_forget(fc, fi->forget, fi->nodeid, in fuse_evict_inode()
141 static int fuse_reconfigure(struct fs_context *fc) in fuse_reconfigure() argument
143 struct super_block *sb = fc->root->d_sb; in fuse_reconfigure()
146 if (fc->sb_flags & SB_MANDLOCK) in fuse_reconfigure()
167 struct fuse_conn *fc = get_fuse_conn(inode); in fuse_change_attributes_common() local
172 fi->attr_version = atomic64_inc_return(&fc->attr_version); in fuse_change_attributes_common()
179 inode->i_uid = make_kuid(fc->user_ns, attr->uid); in fuse_change_attributes_common()
180 inode->i_gid = make_kgid(fc->user_ns, attr->gid); in fuse_change_attributes_common()
185 if (!fc->writeback_cache || !S_ISREG(inode->i_mode)) { in fuse_change_attributes_common()
203 if (!fc->default_permissions) in fuse_change_attributes_common()
212 struct fuse_conn *fc = get_fuse_conn(inode); in fuse_change_attributes() local
214 bool is_wb = fc->writeback_cache; in fuse_change_attributes()
243 if (!fc->explicit_inval_data) in fuse_change_attributes()
245 } else if (fc->auto_inval_data) { in fuse_change_attributes()
310 struct fuse_conn *fc = get_fuse_conn_super(sb); in fuse_iget() local
319 if (fc->auto_submounts && (attr->flags & FUSE_ATTR_SUBMOUNT) && in fuse_iget()
338 if (!fc->writeback_cache || !S_ISREG(attr->mode)) in fuse_iget()
359 struct inode *fuse_ilookup(struct fuse_conn *fc, u64 nodeid, in fuse_ilookup() argument
365 WARN_ON(!rwsem_is_locked(&fc->killsb)); in fuse_ilookup()
366 list_for_each_entry(fm_iter, &fc->mounts, fc_entry) { in fuse_ilookup()
381 int fuse_reverse_inval_inode(struct fuse_conn *fc, u64 nodeid, in fuse_reverse_inval_inode() argument
389 inode = fuse_ilookup(fc, nodeid, NULL); in fuse_reverse_inval_inode()
395 fi->attr_version = atomic64_inc_return(&fc->attr_version); in fuse_reverse_inval_inode()
433 struct fuse_conn *fc = get_fuse_conn_super(sb); in fuse_umount_begin() local
435 if (!fc->no_force_umount) in fuse_umount_begin()
436 fuse_abort_conn(fc); in fuse_umount_begin()
441 if (fm->fc->conn_init) { in fuse_send_destroy()
480 if (!fuse_allow_current_process(fm->fc)) { in fuse_statfs()
526 static int fuse_parse_param(struct fs_context *fc, struct fs_parameter *param) in fuse_parse_param() argument
529 struct fuse_fs_context *ctx = fc->fs_private; in fuse_parse_param()
532 if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) { in fuse_parse_param()
537 if (fc->oldapi) in fuse_parse_param()
540 return invalfc(fc, "No changes allowed in reconfigure"); in fuse_parse_param()
543 opt = fs_parse(fc, fuse_fs_parameters, param, &result); in fuse_parse_param()
549 if (fc->source) in fuse_parse_param()
550 return invalfc(fc, "Multiple sources specified"); in fuse_parse_param()
551 fc->source = param->string; in fuse_parse_param()
557 return invalfc(fc, "Multiple subtypes specified"); in fuse_parse_param()
569 return invalfc(fc, "Invalid rootmode"); in fuse_parse_param()
575 ctx->user_id = make_kuid(fc->user_ns, result.uint_32); in fuse_parse_param()
577 return invalfc(fc, "Invalid user_id"); in fuse_parse_param()
582 ctx->group_id = make_kgid(fc->user_ns, result.uint_32); in fuse_parse_param()
584 return invalfc(fc, "Invalid group_id"); in fuse_parse_param()
602 return invalfc(fc, "blksize only supported for fuseblk"); in fuse_parse_param()
613 static void fuse_free_fc(struct fs_context *fc) in fuse_free_fc() argument
615 struct fuse_fs_context *ctx = fc->fs_private; in fuse_free_fc()
626 struct fuse_conn *fc = get_fuse_conn_super(sb); in fuse_show_options() local
628 if (fc->legacy_opts_show) { in fuse_show_options()
630 from_kuid_munged(fc->user_ns, fc->user_id)); in fuse_show_options()
632 from_kgid_munged(fc->user_ns, fc->group_id)); in fuse_show_options()
633 if (fc->default_permissions) in fuse_show_options()
635 if (fc->allow_other) in fuse_show_options()
637 if (fc->max_read != ~0) in fuse_show_options()
638 seq_printf(m, ",max_read=%u", fc->max_read); in fuse_show_options()
643 if (fc->dax) in fuse_show_options()
676 void fuse_conn_init(struct fuse_conn *fc, struct fuse_mount *fm, in fuse_conn_init() argument
680 memset(fc, 0, sizeof(*fc)); in fuse_conn_init()
681 spin_lock_init(&fc->lock); in fuse_conn_init()
682 spin_lock_init(&fc->bg_lock); in fuse_conn_init()
683 init_rwsem(&fc->killsb); in fuse_conn_init()
684 refcount_set(&fc->count, 1); in fuse_conn_init()
685 atomic_set(&fc->dev_count, 1); in fuse_conn_init()
686 init_waitqueue_head(&fc->blocked_waitq); in fuse_conn_init()
687 fuse_iqueue_init(&fc->iq, fiq_ops, fiq_priv); in fuse_conn_init()
688 INIT_LIST_HEAD(&fc->bg_queue); in fuse_conn_init()
689 INIT_LIST_HEAD(&fc->entry); in fuse_conn_init()
690 INIT_LIST_HEAD(&fc->devices); in fuse_conn_init()
691 atomic_set(&fc->num_waiting, 0); in fuse_conn_init()
692 fc->max_background = FUSE_DEFAULT_MAX_BACKGROUND; in fuse_conn_init()
693 fc->congestion_threshold = FUSE_DEFAULT_CONGESTION_THRESHOLD; in fuse_conn_init()
694 atomic64_set(&fc->khctr, 0); in fuse_conn_init()
695 fc->polled_files = RB_ROOT; in fuse_conn_init()
696 fc->blocked = 0; in fuse_conn_init()
697 fc->initialized = 0; in fuse_conn_init()
698 fc->connected = 1; in fuse_conn_init()
699 atomic64_set(&fc->attr_version, 1); in fuse_conn_init()
700 get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key)); in fuse_conn_init()
701 fc->pid_ns = get_pid_ns(task_active_pid_ns(current)); in fuse_conn_init()
702 fc->user_ns = get_user_ns(user_ns); in fuse_conn_init()
703 fc->max_pages = FUSE_DEFAULT_MAX_PAGES_PER_REQ; in fuse_conn_init()
705 INIT_LIST_HEAD(&fc->mounts); in fuse_conn_init()
706 list_add(&fm->fc_entry, &fc->mounts); in fuse_conn_init()
707 fm->fc = fc; in fuse_conn_init()
712 void fuse_conn_put(struct fuse_conn *fc) in fuse_conn_put() argument
714 if (refcount_dec_and_test(&fc->count)) { in fuse_conn_put()
715 struct fuse_iqueue *fiq = &fc->iq; in fuse_conn_put()
718 fuse_dax_conn_free(fc); in fuse_conn_put()
721 put_pid_ns(fc->pid_ns); in fuse_conn_put()
722 put_user_ns(fc->user_ns); in fuse_conn_put()
723 fc->release(fc); in fuse_conn_put()
728 struct fuse_conn *fuse_conn_get(struct fuse_conn *fc) in fuse_conn_get() argument
730 refcount_inc(&fc->count); in fuse_conn_get()
731 return fc; in fuse_conn_get()
738 if (fm->fc) in fuse_mount_put()
739 fuse_conn_put(fm->fc); in fuse_mount_put()
771 struct fuse_conn *fc = get_fuse_conn_super(sb); in fuse_get_dentry() local
784 if (!fc->export_support) in fuse_get_dentry()
878 struct fuse_conn *fc = get_fuse_conn(child_inode); in fuse_get_parent() local
885 if (!fc->export_support) in fuse_get_parent()
948 static void process_init_limits(struct fuse_conn *fc, struct fuse_init_out *arg) in process_init_limits() argument
958 spin_lock(&fc->bg_lock); in process_init_limits()
960 fc->max_background = arg->max_background; in process_init_limits()
962 if (!cap_sys_admin && fc->max_background > max_user_bgreq) in process_init_limits()
963 fc->max_background = max_user_bgreq; in process_init_limits()
966 fc->congestion_threshold = arg->congestion_threshold; in process_init_limits()
969 fc->congestion_threshold > max_user_congthresh) in process_init_limits()
970 fc->congestion_threshold = max_user_congthresh; in process_init_limits()
972 spin_unlock(&fc->bg_lock); in process_init_limits()
984 struct fuse_conn *fc = fm->fc; in process_init_reply() local
994 process_init_limits(fc, arg); in process_init_reply()
999 fc->async_read = 1; in process_init_reply()
1001 fc->no_lock = 1; in process_init_reply()
1004 fc->no_flock = 1; in process_init_reply()
1007 fc->no_flock = 1; in process_init_reply()
1010 fc->atomic_o_trunc = 1; in process_init_reply()
1014 fc->export_support = 1; in process_init_reply()
1017 fc->big_writes = 1; in process_init_reply()
1019 fc->dont_mask = 1; in process_init_reply()
1021 fc->auto_inval_data = 1; in process_init_reply()
1023 fc->explicit_inval_data = 1; in process_init_reply()
1025 fc->do_readdirplus = 1; in process_init_reply()
1027 fc->readdirplus_auto = 1; in process_init_reply()
1030 fc->async_dio = 1; in process_init_reply()
1032 fc->writeback_cache = 1; in process_init_reply()
1034 fc->parallel_dirops = 1; in process_init_reply()
1036 fc->handle_killpriv = 1; in process_init_reply()
1040 fc->default_permissions = 1; in process_init_reply()
1041 fc->posix_acl = 1; in process_init_reply()
1045 fc->cache_symlinks = 1; in process_init_reply()
1047 fc->abort_err = 1; in process_init_reply()
1049 fc->max_pages = in process_init_reply()
1055 !fuse_dax_check_alignment(fc, arg->map_alignment)) { in process_init_reply()
1059 ra_pages = fc->max_read / PAGE_SIZE; in process_init_reply()
1060 fc->no_lock = 1; in process_init_reply()
1061 fc->no_flock = 1; in process_init_reply()
1066 fc->minor = arg->minor; in process_init_reply()
1067 fc->max_write = arg->minor < 5 ? 4096 : arg->max_write; in process_init_reply()
1068 fc->max_write = max_t(unsigned, 4096, fc->max_write); in process_init_reply()
1069 fc->conn_init = 1; in process_init_reply()
1074 fc->conn_init = 0; in process_init_reply()
1075 fc->conn_error = 1; in process_init_reply()
1078 fuse_set_initialized(fc); in process_init_reply()
1079 wake_up_all(&fc->blocked_waitq); in process_init_reply()
1102 if (fm->fc->dax) in fuse_send_init()
1105 if (fm->fc->auto_submounts) in fuse_send_init()
1128 void fuse_free_conn(struct fuse_conn *fc) in fuse_free_conn() argument
1130 WARN_ON(!list_empty(&fc->devices)); in fuse_free_conn()
1131 kfree_rcu(fc, rcu); in fuse_free_conn()
1135 static int fuse_bdi_init(struct fuse_conn *fc, struct super_block *sb) in fuse_bdi_init() argument
1149 err = super_setup_bdi_name(sb, "%u:%u%s", MAJOR(fc->dev), in fuse_bdi_init()
1150 MINOR(fc->dev), suffix); in fuse_bdi_init()
1197 void fuse_dev_install(struct fuse_dev *fud, struct fuse_conn *fc) in fuse_dev_install() argument
1199 fud->fc = fuse_conn_get(fc); in fuse_dev_install()
1200 spin_lock(&fc->lock); in fuse_dev_install()
1201 list_add_tail(&fud->entry, &fc->devices); in fuse_dev_install()
1202 spin_unlock(&fc->lock); in fuse_dev_install()
1206 struct fuse_dev *fuse_dev_alloc_install(struct fuse_conn *fc) in fuse_dev_alloc_install() argument
1214 fuse_dev_install(fud, fc); in fuse_dev_alloc_install()
1221 struct fuse_conn *fc = fud->fc; in fuse_dev_free() local
1223 if (fc) { in fuse_dev_free()
1224 spin_lock(&fc->lock); in fuse_dev_free()
1226 spin_unlock(&fc->lock); in fuse_dev_free()
1228 fuse_conn_put(fc); in fuse_dev_free()
1320 struct fuse_conn *fc = fm->fc; in fuse_fill_super_common() local
1345 err = fuse_dax_conn_alloc(fc, ctx->dax_dev); in fuse_fill_super_common()
1352 fud = fuse_dev_alloc_install(fc); in fuse_fill_super_common()
1357 fc->dev = sb->s_dev; in fuse_fill_super_common()
1359 err = fuse_bdi_init(fc, sb); in fuse_fill_super_common()
1365 fc->dont_mask = 1; in fuse_fill_super_common()
1368 fc->default_permissions = ctx->default_permissions; in fuse_fill_super_common()
1369 fc->allow_other = ctx->allow_other; in fuse_fill_super_common()
1370 fc->user_id = ctx->user_id; in fuse_fill_super_common()
1371 fc->group_id = ctx->group_id; in fuse_fill_super_common()
1372 fc->legacy_opts_show = ctx->legacy_opts_show; in fuse_fill_super_common()
1373 fc->max_read = max_t(unsigned int, 4096, ctx->max_read); in fuse_fill_super_common()
1374 fc->destroy = ctx->destroy; in fuse_fill_super_common()
1375 fc->no_control = ctx->no_control; in fuse_fill_super_common()
1376 fc->no_force_umount = ctx->no_force_umount; in fuse_fill_super_common()
1392 err = fuse_ctl_add_conn(fc); in fuse_fill_super_common()
1396 list_add_tail(&fc->entry, &fuse_conn_list); in fuse_fill_super_common()
1411 fuse_dax_conn_free(fc); in fuse_fill_super_common()
1422 struct fuse_conn *fc; in fuse_fill_super() local
1439 fc = kmalloc(sizeof(*fc), GFP_KERNEL); in fuse_fill_super()
1441 if (!fc) in fuse_fill_super()
1446 kfree(fc); in fuse_fill_super()
1450 fuse_conn_init(fc, fm, sb->s_user_ns, &fuse_dev_fiq_ops, NULL); in fuse_fill_super()
1451 fc->release = fuse_free_conn; in fuse_fill_super()
1476 static int fuse_get_tree(struct fs_context *fc) in fuse_get_tree() argument
1478 struct fuse_fs_context *ctx = fc->fs_private; in fuse_get_tree()
1486 return get_tree_bdev(fc, fuse_fill_super); in fuse_get_tree()
1489 return get_tree_nodev(fc, fuse_fill_super); in fuse_get_tree()
1502 static int fuse_init_fs_context(struct fs_context *fc) in fuse_init_fs_context() argument
1515 if (fc->fs_type == &fuseblk_fs_type) { in fuse_init_fs_context()
1521 fc->fs_private = ctx; in fuse_init_fs_context()
1522 fc->ops = &fuse_context_ops; in fuse_init_fs_context()
1528 struct fuse_conn *fc = fm->fc; in fuse_mount_remove() local
1531 down_write(&fc->killsb); in fuse_mount_remove()
1533 if (list_empty(&fc->mounts)) in fuse_mount_remove()
1535 up_write(&fc->killsb); in fuse_mount_remove()
1543 struct fuse_conn *fc = fm->fc; in fuse_conn_destroy() local
1545 if (fc->destroy) in fuse_conn_destroy()
1548 fuse_abort_conn(fc); in fuse_conn_destroy()
1549 fuse_wait_aborted(fc); in fuse_conn_destroy()
1551 if (!list_empty(&fc->entry)) { in fuse_conn_destroy()
1553 list_del(&fc->entry); in fuse_conn_destroy()
1554 fuse_ctl_remove_conn(fc); in fuse_conn_destroy()