static int fuse_fill_super(struct super_block *sb, void *data, int silent) { struct fuse_conn *fc; struct inode *root; struct fuse_mount_data d; struct file *file; int err; if (!parse_fuse_opt((char *) data, &d)) return -EINVAL; sb->s_blocksize = PAGE_CACHE_SIZE; sb->s_blocksize_bits = PAGE_CACHE_SHIFT; sb->s_magic = FUSE_SUPER_MAGIC; sb->s_op = &fuse_super_operations; sb->s_maxbytes = MAX_LFS_FILESIZE; #ifndef FUSE_MAINLINE #ifdef KERNEL_2_6 sb->s_export_op = &fuse_export_operations; #endif #endif file = fget(d.fd); if (!file) return -EINVAL; fc = get_conn(file, sb); fput(file); if (IS_ERR(fc)) return PTR_ERR(fc); fc->flags = d.flags; fc->user_id = d.user_id; fc->group_id = d.group_id; fc->max_read = d.max_read; #ifdef KERNEL_2_6 if (fc->max_read / PAGE_CACHE_SIZE < fc->bdi.ra_pages) fc->bdi.ra_pages = fc->max_read / PAGE_CACHE_SIZE; #endif err = -ENOMEM; root = get_root_inode(sb, d.rootmode); if (root == NULL) goto err; sb->s_root = d_alloc_root(root); if (!sb->s_root) { iput(root); goto err; } fuse_send_init(fc); return 0; err: spin_lock(&fuse_lock); fuse_release_conn(fc); spin_unlock(&fuse_lock); return err; }
static void fuse_put_super(struct super_block *sb) { struct fuse_conn *fc = sb->u.generic_sbp; spin_lock(&fuse_lock); fc->sb = NULL; fc->uid = 0; fc->flags = 0; /* Flush all readers on this fs */ wake_up_all(&fc->waitq); fuse_release_conn(fc); sb->u.generic_sbp = NULL; spin_unlock(&fuse_lock); }
static void fuse_put_super(struct super_block *sb) { struct fuse_conn *fc = get_fuse_conn_super(sb); down_write(&fc->sbput_sem); while (!list_empty(&fc->background)) fuse_release_background(list_entry(fc->background.next, struct fuse_req, bg_entry)); spin_lock(&fuse_lock); fc->mounted = 0; fc->user_id = 0; fc->group_id = 0; fc->flags = 0; /* Flush all readers on this fs */ wake_up_all(&fc->waitq); up_write(&fc->sbput_sem); fuse_release_conn(fc); spin_unlock(&fuse_lock); }