2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
5 This program can be distributed under the terms of the GNU GPL.
11 #include <linux/init.h>
12 #include <linux/module.h>
13 #include <linux/poll.h>
14 #include <linux/uio.h>
15 #include <linux/miscdevice.h>
16 #include <linux/pagemap.h>
17 #include <linux/file.h>
18 #include <linux/slab.h>
20 MODULE_ALIAS_MISCDEV(FUSE_MINOR);
22 static kmem_cache_t *fuse_req_cachep;
24 static struct fuse_conn *fuse_get_conn(struct file *file)
27 spin_lock(&fuse_lock);
28 fc = file->private_data;
29 if (fc && !fc->connected)
31 spin_unlock(&fuse_lock);
35 static void fuse_request_init(struct fuse_req *req)
37 memset(req, 0, sizeof(*req));
38 INIT_LIST_HEAD(&req->list);
39 init_waitqueue_head(&req->waitq);
40 atomic_set(&req->count, 1);
43 struct fuse_req *fuse_request_alloc(void)
45 struct fuse_req *req = kmem_cache_alloc(fuse_req_cachep, SLAB_KERNEL);
47 fuse_request_init(req);
51 void fuse_request_free(struct fuse_req *req)
53 kmem_cache_free(fuse_req_cachep, req);
56 static void block_sigs(sigset_t *oldset)
60 siginitsetinv(&mask, sigmask(SIGKILL));
61 sigprocmask(SIG_BLOCK, &mask, oldset);
64 static void restore_sigs(sigset_t *oldset)
66 sigprocmask(SIG_SETMASK, oldset, NULL);
69 void fuse_reset_request(struct fuse_req *req)
71 int preallocated = req->preallocated;
72 BUG_ON(atomic_read(&req->count) != 1);
73 fuse_request_init(req);
74 req->preallocated = preallocated;
77 static void __fuse_get_request(struct fuse_req *req)
79 atomic_inc(&req->count);
82 /* Must be called with > 1 refcount */
83 static void __fuse_put_request(struct fuse_req *req)
85 BUG_ON(atomic_read(&req->count) < 2);
86 atomic_dec(&req->count);
89 static struct fuse_req *do_get_request(struct fuse_conn *fc)
93 spin_lock(&fuse_lock);
94 BUG_ON(list_empty(&fc->unused_list));
95 req = list_entry(fc->unused_list.next, struct fuse_req, list);
96 list_del_init(&req->list);
97 spin_unlock(&fuse_lock);
98 fuse_request_init(req);
99 req->preallocated = 1;
100 req->in.h.uid = current->fsuid;
101 req->in.h.gid = current->fsgid;
102 req->in.h.pid = current->pid;
106 /* This can return NULL, but only in case it's interrupted by a SIGKILL */
107 struct fuse_req *fuse_get_request(struct fuse_conn *fc)
112 atomic_inc(&fc->num_waiting);
114 intr = down_interruptible(&fc->outstanding_sem);
115 restore_sigs(&oldset);
117 atomic_dec(&fc->num_waiting);
120 return do_get_request(fc);
123 static void fuse_putback_request(struct fuse_conn *fc, struct fuse_req *req)
125 spin_lock(&fuse_lock);
126 if (req->preallocated) {
127 atomic_dec(&fc->num_waiting);
128 list_add(&req->list, &fc->unused_list);
130 fuse_request_free(req);
132 /* If we are in debt decrease that first */
133 if (fc->outstanding_debt)
134 fc->outstanding_debt--;
136 up(&fc->outstanding_sem);
137 spin_unlock(&fuse_lock);
140 void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req)
142 if (atomic_dec_and_test(&req->count))
143 fuse_putback_request(fc, req);
146 void fuse_release_background(struct fuse_req *req)
152 spin_lock(&fuse_lock);
153 list_del(&req->bg_entry);
154 spin_unlock(&fuse_lock);
157 static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
160 struct fuse_init_out *arg = &req->misc.init_out;
162 if (req->out.h.error || arg->major != FUSE_KERNEL_VERSION)
165 fc->minor = arg->minor;
166 fc->max_write = arg->minor < 5 ? 4096 : arg->max_write;
169 /* After INIT reply is received other requests can go
170 out. So do (FUSE_MAX_OUTSTANDING - 1) number of
171 up()s on outstanding_sem. The last up() is done in
172 fuse_putback_request() */
173 for (i = 1; i < FUSE_MAX_OUTSTANDING; i++)
174 up(&fc->outstanding_sem);
178 * This function is called when a request is finished. Either a reply
179 * has arrived or it was interrupted (and not yet sent) or some error
180 * occurred during communication with userspace, or the device file
181 * was closed. In case of a background request the reference to the
182 * stored objects are released. The requester thread is woken up (if
183 * still waiting), and finally the reference to the request is
186 * Called with fuse_lock, unlocks it
188 static void request_end(struct fuse_conn *fc, struct fuse_req *req)
190 list_del(&req->list);
191 req->state = FUSE_REQ_FINISHED;
192 spin_unlock(&fuse_lock);
193 if (req->background) {
194 down_read(&fc->sbput_sem);
196 fuse_release_background(req);
197 up_read(&fc->sbput_sem);
199 wake_up(&req->waitq);
200 if (req->in.h.opcode == FUSE_INIT)
201 process_init_reply(fc, req);
202 else if (req->in.h.opcode == FUSE_RELEASE && req->inode == NULL) {
203 /* Special case for failed iget in CREATE */
204 u64 nodeid = req->in.h.nodeid;
205 fuse_reset_request(req);
206 fuse_send_forget(fc, req, nodeid, 1);
209 fuse_put_request(fc, req);
213 * Unfortunately request interruption not just solves the deadlock
214 * problem, it causes problems too. These stem from the fact, that an
215 * interrupted request is continued to be processed in userspace,
216 * while all the locks and object references (inode and file) held
217 * during the operation are released.
219 * To release the locks is exactly why there's a need to interrupt the
220 * request, so there's not a lot that can be done about this, except
221 * introduce additional locking in userspace.
223 * More important is to keep inode and file references until userspace
224 * has replied, otherwise FORGET and RELEASE could be sent while the
225 * inode/file is still used by the filesystem.
227 * For this reason the concept of "background" request is introduced.
228 * An interrupted request is backgrounded if it has been already sent
229 * to userspace. Backgrounding involves getting an extra reference to
230 * inode(s) or file used in the request, and adding the request to
231 * fc->background list. When a reply is received for a background
232 * request, the object references are released, and the request is
233 * removed from the list. If the filesystem is unmounted while there
234 * are still background requests, the list is walked and references
235 * are released as if a reply was received.
237 * There's one more use for a background request. The RELEASE message is
238 * always sent as background, since it doesn't return an error or
241 static void background_request(struct fuse_conn *fc, struct fuse_req *req)
244 list_add(&req->bg_entry, &fc->background);
246 req->inode = igrab(req->inode);
248 req->inode2 = igrab(req->inode2);
253 /* Called with fuse_lock held. Releases, and then reacquires it. */
254 static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req)
258 spin_unlock(&fuse_lock);
260 wait_event_interruptible(req->waitq, req->state == FUSE_REQ_FINISHED);
261 restore_sigs(&oldset);
262 spin_lock(&fuse_lock);
263 if (req->state == FUSE_REQ_FINISHED && !req->interrupted)
266 if (!req->interrupted) {
267 req->out.h.error = -EINTR;
268 req->interrupted = 1;
271 /* This is uninterruptible sleep, because data is
272 being copied to/from the buffers of req. During
273 locked state, there mustn't be any filesystem
274 operation (e.g. page fault), since that could lead
276 spin_unlock(&fuse_lock);
277 wait_event(req->waitq, !req->locked);
278 spin_lock(&fuse_lock);
280 if (req->state == FUSE_REQ_PENDING) {
281 list_del(&req->list);
282 __fuse_put_request(req);
283 } else if (req->state == FUSE_REQ_SENT)
284 background_request(fc, req);
287 static unsigned len_args(unsigned numargs, struct fuse_arg *args)
292 for (i = 0; i < numargs; i++)
293 nbytes += args[i].size;
298 static void queue_request(struct fuse_conn *fc, struct fuse_req *req)
301 /* zero is special */
304 req->in.h.unique = fc->reqctr;
305 req->in.h.len = sizeof(struct fuse_in_header) +
306 len_args(req->in.numargs, (struct fuse_arg *) req->in.args);
307 if (!req->preallocated) {
308 /* If request is not preallocated (either FORGET or
309 RELEASE), then still decrease outstanding_sem, so
310 user can't open infinite number of files while not
311 processing the RELEASE requests. However for
312 efficiency do it without blocking, so if down()
313 would block, just increase the debt instead */
314 if (down_trylock(&fc->outstanding_sem))
315 fc->outstanding_debt++;
317 list_add_tail(&req->list, &fc->pending);
318 req->state = FUSE_REQ_PENDING;
323 * This can only be interrupted by a SIGKILL
325 void request_send(struct fuse_conn *fc, struct fuse_req *req)
328 spin_lock(&fuse_lock);
330 req->out.h.error = -ENOTCONN;
331 else if (fc->conn_error)
332 req->out.h.error = -ECONNREFUSED;
334 queue_request(fc, req);
335 /* acquire extra reference, since request is still needed
336 after request_end() */
337 __fuse_get_request(req);
339 request_wait_answer(fc, req);
341 spin_unlock(&fuse_lock);
344 static void request_send_nowait(struct fuse_conn *fc, struct fuse_req *req)
346 spin_lock(&fuse_lock);
348 queue_request(fc, req);
349 spin_unlock(&fuse_lock);
351 req->out.h.error = -ENOTCONN;
352 request_end(fc, req);
356 void request_send_noreply(struct fuse_conn *fc, struct fuse_req *req)
359 request_send_nowait(fc, req);
362 void request_send_background(struct fuse_conn *fc, struct fuse_req *req)
365 spin_lock(&fuse_lock);
366 background_request(fc, req);
367 spin_unlock(&fuse_lock);
368 request_send_nowait(fc, req);
371 void fuse_send_init(struct fuse_conn *fc)
373 /* This is called from fuse_read_super() so there's guaranteed
374 to be exactly one request available */
375 struct fuse_req *req = fuse_get_request(fc);
376 struct fuse_init_in *arg = &req->misc.init_in;
377 arg->major = FUSE_KERNEL_VERSION;
378 arg->minor = FUSE_KERNEL_MINOR_VERSION;
379 req->in.h.opcode = FUSE_INIT;
381 req->in.args[0].size = sizeof(*arg);
382 req->in.args[0].value = arg;
383 req->out.numargs = 1;
384 /* Variable length arguement used for backward compatibility
385 with interface version < 7.5. Rest of init_out is zeroed
386 by do_get_request(), so a short reply is not a problem */
388 req->out.args[0].size = sizeof(struct fuse_init_out);
389 req->out.args[0].value = &req->misc.init_out;
390 request_send_background(fc, req);
394 * Lock the request. Up to the next unlock_request() there mustn't be
395 * anything that could cause a page-fault. If the request was already
396 * interrupted bail out.
398 static int lock_request(struct fuse_req *req)
402 spin_lock(&fuse_lock);
403 if (req->interrupted)
407 spin_unlock(&fuse_lock);
413 * Unlock request. If it was interrupted during being locked, the
414 * requester thread is currently waiting for it to be unlocked, so
417 static void unlock_request(struct fuse_req *req)
420 spin_lock(&fuse_lock);
422 if (req->interrupted)
423 wake_up(&req->waitq);
424 spin_unlock(&fuse_lock);
428 struct fuse_copy_state {
430 struct fuse_req *req;
431 const struct iovec *iov;
432 unsigned long nr_segs;
433 unsigned long seglen;
441 static void fuse_copy_init(struct fuse_copy_state *cs, int write,
442 struct fuse_req *req, const struct iovec *iov,
443 unsigned long nr_segs)
445 memset(cs, 0, sizeof(*cs));
449 cs->nr_segs = nr_segs;
452 /* Unmap and put previous page of userspace buffer */
453 static void fuse_copy_finish(struct fuse_copy_state *cs)
456 kunmap_atomic(cs->mapaddr, KM_USER0);
458 flush_dcache_page(cs->pg);
459 set_page_dirty_lock(cs->pg);
467 * Get another pagefull of userspace buffer, and map it to kernel
468 * address space, and lock request
470 static int fuse_copy_fill(struct fuse_copy_state *cs)
472 unsigned long offset;
475 unlock_request(cs->req);
476 fuse_copy_finish(cs);
478 BUG_ON(!cs->nr_segs);
479 cs->seglen = cs->iov[0].iov_len;
480 cs->addr = (unsigned long) cs->iov[0].iov_base;
484 down_read(¤t->mm->mmap_sem);
485 err = get_user_pages(current, current->mm, cs->addr, 1, cs->write, 0,
487 up_read(¤t->mm->mmap_sem);
491 offset = cs->addr % PAGE_SIZE;
492 cs->mapaddr = kmap_atomic(cs->pg, KM_USER0);
493 cs->buf = cs->mapaddr + offset;
494 cs->len = min(PAGE_SIZE - offset, cs->seglen);
495 cs->seglen -= cs->len;
498 return lock_request(cs->req);
501 /* Do as much copy to/from userspace buffer as we can */
502 static int fuse_copy_do(struct fuse_copy_state *cs, void **val, unsigned *size)
504 unsigned ncpy = min(*size, cs->len);
507 memcpy(cs->buf, *val, ncpy);
509 memcpy(*val, cs->buf, ncpy);
519 * Copy a page in the request to/from the userspace buffer. Must be
522 static int fuse_copy_page(struct fuse_copy_state *cs, struct page *page,
523 unsigned offset, unsigned count, int zeroing)
525 if (page && zeroing && count < PAGE_SIZE) {
526 void *mapaddr = kmap_atomic(page, KM_USER1);
527 memset(mapaddr, 0, PAGE_SIZE);
528 kunmap_atomic(mapaddr, KM_USER1);
532 if (!cs->len && (err = fuse_copy_fill(cs)))
535 void *mapaddr = kmap_atomic(page, KM_USER1);
536 void *buf = mapaddr + offset;
537 offset += fuse_copy_do(cs, &buf, &count);
538 kunmap_atomic(mapaddr, KM_USER1);
540 offset += fuse_copy_do(cs, NULL, &count);
542 if (page && !cs->write)
543 flush_dcache_page(page);
547 /* Copy pages in the request to/from userspace buffer */
548 static int fuse_copy_pages(struct fuse_copy_state *cs, unsigned nbytes,
552 struct fuse_req *req = cs->req;
553 unsigned offset = req->page_offset;
554 unsigned count = min(nbytes, (unsigned) PAGE_SIZE - offset);
556 for (i = 0; i < req->num_pages && (nbytes || zeroing); i++) {
557 struct page *page = req->pages[i];
558 int err = fuse_copy_page(cs, page, offset, count, zeroing);
563 count = min(nbytes, (unsigned) PAGE_SIZE);
569 /* Copy a single argument in the request to/from userspace buffer */
570 static int fuse_copy_one(struct fuse_copy_state *cs, void *val, unsigned size)
574 if (!cs->len && (err = fuse_copy_fill(cs)))
576 fuse_copy_do(cs, &val, &size);
581 /* Copy request arguments to/from userspace buffer */
582 static int fuse_copy_args(struct fuse_copy_state *cs, unsigned numargs,
583 unsigned argpages, struct fuse_arg *args,
589 for (i = 0; !err && i < numargs; i++) {
590 struct fuse_arg *arg = &args[i];
591 if (i == numargs - 1 && argpages)
592 err = fuse_copy_pages(cs, arg->size, zeroing);
594 err = fuse_copy_one(cs, arg->value, arg->size);
599 /* Wait until a request is available on the pending list */
600 static void request_wait(struct fuse_conn *fc)
602 DECLARE_WAITQUEUE(wait, current);
604 add_wait_queue_exclusive(&fc->waitq, &wait);
605 while (fc->connected && list_empty(&fc->pending)) {
606 set_current_state(TASK_INTERRUPTIBLE);
607 if (signal_pending(current))
610 spin_unlock(&fuse_lock);
612 spin_lock(&fuse_lock);
614 set_current_state(TASK_RUNNING);
615 remove_wait_queue(&fc->waitq, &wait);
619 * Read a single request into the userspace filesystem's buffer. This
620 * function waits until a request is available, then removes it from
621 * the pending list and copies request data to userspace buffer. If
622 * no reply is needed (FORGET) or request has been interrupted or
623 * there was an error during the copying then it's finished by calling
624 * request_end(). Otherwise add it to the processing list, and set
627 static ssize_t fuse_dev_readv(struct file *file, const struct iovec *iov,
628 unsigned long nr_segs, loff_t *off)
631 struct fuse_conn *fc;
632 struct fuse_req *req;
634 struct fuse_copy_state cs;
638 spin_lock(&fuse_lock);
639 fc = file->private_data;
648 if (list_empty(&fc->pending))
651 req = list_entry(fc->pending.next, struct fuse_req, list);
652 req->state = FUSE_REQ_READING;
653 list_move(&req->list, &fc->io);
657 /* If request is too large, reply with an error and restart the read */
658 if (iov_length(iov, nr_segs) < reqsize) {
659 req->out.h.error = -EIO;
660 /* SETXATTR is special, since it may contain too large data */
661 if (in->h.opcode == FUSE_SETXATTR)
662 req->out.h.error = -E2BIG;
663 request_end(fc, req);
666 spin_unlock(&fuse_lock);
667 fuse_copy_init(&cs, 1, req, iov, nr_segs);
668 err = fuse_copy_one(&cs, &in->h, sizeof(in->h));
670 err = fuse_copy_args(&cs, in->numargs, in->argpages,
671 (struct fuse_arg *) in->args, 0);
672 fuse_copy_finish(&cs);
673 spin_lock(&fuse_lock);
675 if (!err && req->interrupted)
678 if (!req->interrupted)
679 req->out.h.error = -EIO;
680 request_end(fc, req);
684 request_end(fc, req);
686 req->state = FUSE_REQ_SENT;
687 list_move_tail(&req->list, &fc->processing);
688 spin_unlock(&fuse_lock);
693 spin_unlock(&fuse_lock);
697 static ssize_t fuse_dev_read(struct file *file, char __user *buf,
698 size_t nbytes, loff_t *off)
701 iov.iov_len = nbytes;
703 return fuse_dev_readv(file, &iov, 1, off);
706 /* Look up request on processing list by unique ID */
707 static struct fuse_req *request_find(struct fuse_conn *fc, u64 unique)
709 struct list_head *entry;
711 list_for_each(entry, &fc->processing) {
712 struct fuse_req *req;
713 req = list_entry(entry, struct fuse_req, list);
714 if (req->in.h.unique == unique)
720 static int copy_out_args(struct fuse_copy_state *cs, struct fuse_out *out,
723 unsigned reqsize = sizeof(struct fuse_out_header);
726 return nbytes != reqsize ? -EINVAL : 0;
728 reqsize += len_args(out->numargs, out->args);
730 if (reqsize < nbytes || (reqsize > nbytes && !out->argvar))
732 else if (reqsize > nbytes) {
733 struct fuse_arg *lastarg = &out->args[out->numargs-1];
734 unsigned diffsize = reqsize - nbytes;
735 if (diffsize > lastarg->size)
737 lastarg->size -= diffsize;
739 return fuse_copy_args(cs, out->numargs, out->argpages, out->args,
744 * Write a single reply to a request. First the header is copied from
745 * the write buffer. The request is then searched on the processing
746 * list by the unique ID found in the header. If found, then remove
747 * it from the list and copy the rest of the buffer to the request.
748 * The request is finished by calling request_end()
750 static ssize_t fuse_dev_writev(struct file *file, const struct iovec *iov,
751 unsigned long nr_segs, loff_t *off)
754 unsigned nbytes = iov_length(iov, nr_segs);
755 struct fuse_req *req;
756 struct fuse_out_header oh;
757 struct fuse_copy_state cs;
758 struct fuse_conn *fc = fuse_get_conn(file);
762 fuse_copy_init(&cs, 0, NULL, iov, nr_segs);
763 if (nbytes < sizeof(struct fuse_out_header))
766 err = fuse_copy_one(&cs, &oh, sizeof(oh));
770 if (!oh.unique || oh.error <= -1000 || oh.error > 0 ||
774 spin_lock(&fuse_lock);
779 req = request_find(fc, oh.unique);
784 if (req->interrupted) {
785 spin_unlock(&fuse_lock);
786 fuse_copy_finish(&cs);
787 spin_lock(&fuse_lock);
788 request_end(fc, req);
791 list_move(&req->list, &fc->io);
795 spin_unlock(&fuse_lock);
797 err = copy_out_args(&cs, &req->out, nbytes);
798 fuse_copy_finish(&cs);
800 spin_lock(&fuse_lock);
803 if (req->interrupted)
805 } else if (!req->interrupted)
806 req->out.h.error = -EIO;
807 request_end(fc, req);
809 return err ? err : nbytes;
812 spin_unlock(&fuse_lock);
814 fuse_copy_finish(&cs);
818 static ssize_t fuse_dev_write(struct file *file, const char __user *buf,
819 size_t nbytes, loff_t *off)
822 iov.iov_len = nbytes;
823 iov.iov_base = (char __user *) buf;
824 return fuse_dev_writev(file, &iov, 1, off);
827 static unsigned fuse_dev_poll(struct file *file, poll_table *wait)
829 struct fuse_conn *fc = fuse_get_conn(file);
830 unsigned mask = POLLOUT | POLLWRNORM;
835 poll_wait(file, &fc->waitq, wait);
837 spin_lock(&fuse_lock);
838 if (!list_empty(&fc->pending))
839 mask |= POLLIN | POLLRDNORM;
840 spin_unlock(&fuse_lock);
846 * Abort all requests on the given list (pending or processing)
848 * This function releases and reacquires fuse_lock
850 static void end_requests(struct fuse_conn *fc, struct list_head *head)
852 while (!list_empty(head)) {
853 struct fuse_req *req;
854 req = list_entry(head->next, struct fuse_req, list);
855 req->out.h.error = -ECONNABORTED;
856 request_end(fc, req);
857 spin_lock(&fuse_lock);
862 * Abort requests under I/O
864 * The requests are set to interrupted and finished, and the request
865 * waiter is woken up. This will make request_wait_answer() wait
866 * until the request is unlocked and then return.
868 static void end_io_requests(struct fuse_conn *fc)
870 while (!list_empty(&fc->io)) {
871 struct fuse_req *req;
872 req = list_entry(fc->io.next, struct fuse_req, list);
873 req->interrupted = 1;
874 req->out.h.error = -ECONNABORTED;
875 req->state = FUSE_REQ_FINISHED;
876 list_del_init(&req->list);
877 wake_up(&req->waitq);
882 * Abort all requests.
884 * Emergency exit in case of a malicious or accidental deadlock, or
885 * just a hung filesystem.
887 * The same effect is usually achievable through killing the
888 * filesystem daemon and all users of the filesystem. The exception
889 * is the combination of an asynchronous request and the tricky
890 * deadlock (see Documentation/filesystems/fuse.txt).
892 * During the aborting, progression of requests from the pending and
893 * processing lists onto the io list, and progression of new requests
894 * onto the pending list is prevented by req->connected being false.
896 * Progression of requests under I/O to the processing list is
897 * prevented by the req->interrupted flag being true for these
898 * requests. For this reason requests on the io list must be aborted
901 void fuse_abort_conn(struct fuse_conn *fc)
903 spin_lock(&fuse_lock);
907 end_requests(fc, &fc->pending);
908 end_requests(fc, &fc->processing);
909 wake_up_all(&fc->waitq);
911 spin_unlock(&fuse_lock);
914 static int fuse_dev_release(struct inode *inode, struct file *file)
916 struct fuse_conn *fc;
918 spin_lock(&fuse_lock);
919 fc = file->private_data;
922 end_requests(fc, &fc->pending);
923 end_requests(fc, &fc->processing);
925 spin_unlock(&fuse_lock);
927 kobject_put(&fc->kobj);
932 struct file_operations fuse_dev_operations = {
933 .owner = THIS_MODULE,
935 .read = fuse_dev_read,
936 .readv = fuse_dev_readv,
937 .write = fuse_dev_write,
938 .writev = fuse_dev_writev,
939 .poll = fuse_dev_poll,
940 .release = fuse_dev_release,
943 static struct miscdevice fuse_miscdevice = {
946 .fops = &fuse_dev_operations,
949 int __init fuse_dev_init(void)
952 fuse_req_cachep = kmem_cache_create("fuse_request",
953 sizeof(struct fuse_req),
955 if (!fuse_req_cachep)
958 err = misc_register(&fuse_miscdevice);
960 goto out_cache_clean;
965 kmem_cache_destroy(fuse_req_cachep);
970 void fuse_dev_cleanup(void)
972 misc_deregister(&fuse_miscdevice);
973 kmem_cache_destroy(fuse_req_cachep);