Lines Matching refs:fc

78 void fuse_set_initialized(struct fuse_conn *fc)  in fuse_set_initialized()  argument
82 fc->initialized = 1; in fuse_set_initialized()
85 static bool fuse_block_alloc(struct fuse_conn *fc, bool for_background) in fuse_block_alloc() argument
87 return !fc->initialized || (for_background && fc->blocked); in fuse_block_alloc()
90 static void fuse_drop_waiting(struct fuse_conn *fc) in fuse_drop_waiting() argument
97 if (atomic_dec_and_test(&fc->num_waiting) && in fuse_drop_waiting()
98 !READ_ONCE(fc->connected)) { in fuse_drop_waiting()
100 wake_up_all(&fc->blocked_waitq); in fuse_drop_waiting()
108 struct fuse_conn *fc = fm->fc; in fuse_get_req() local
111 atomic_inc(&fc->num_waiting); in fuse_get_req()
113 if (fuse_block_alloc(fc, for_background)) { in fuse_get_req()
115 if (wait_event_killable_exclusive(fc->blocked_waitq, in fuse_get_req()
116 !fuse_block_alloc(fc, for_background))) in fuse_get_req()
123 if (!fc->connected) in fuse_get_req()
127 if (fc->conn_error) in fuse_get_req()
134 wake_up(&fc->blocked_waitq); in fuse_get_req()
138 req->in.h.uid = from_kuid(fc->user_ns, current_fsuid()); in fuse_get_req()
139 req->in.h.gid = from_kgid(fc->user_ns, current_fsgid()); in fuse_get_req()
140 req->in.h.pid = pid_nr_ns(task_pid(current), fc->pid_ns); in fuse_get_req()
154 fuse_drop_waiting(fc); in fuse_get_req()
160 struct fuse_conn *fc = req->fm->fc; in fuse_put_request() local
168 spin_lock(&fc->bg_lock); in fuse_put_request()
169 if (!fc->blocked) in fuse_put_request()
170 wake_up(&fc->blocked_waitq); in fuse_put_request()
171 spin_unlock(&fc->bg_lock); in fuse_put_request()
176 fuse_drop_waiting(fc); in fuse_put_request()
236 void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget, in fuse_queue_forget() argument
239 struct fuse_iqueue *fiq = &fc->iq; in fuse_queue_forget()
255 static void flush_bg_queue(struct fuse_conn *fc) in flush_bg_queue() argument
257 struct fuse_iqueue *fiq = &fc->iq; in flush_bg_queue()
259 while (fc->active_background < fc->max_background && in flush_bg_queue()
260 !list_empty(&fc->bg_queue)) { in flush_bg_queue()
263 req = list_first_entry(&fc->bg_queue, struct fuse_req, list); in flush_bg_queue()
265 fc->active_background++; in flush_bg_queue()
283 struct fuse_conn *fc = fm->fc; in fuse_request_end() local
284 struct fuse_iqueue *fiq = &fc->iq; in fuse_request_end()
302 spin_lock(&fc->bg_lock); in fuse_request_end()
304 if (fc->num_background == fc->max_background) { in fuse_request_end()
305 fc->blocked = 0; in fuse_request_end()
306 wake_up(&fc->blocked_waitq); in fuse_request_end()
307 } else if (!fc->blocked) { in fuse_request_end()
314 if (waitqueue_active(&fc->blocked_waitq)) in fuse_request_end()
315 wake_up(&fc->blocked_waitq); in fuse_request_end()
318 if (fc->num_background == fc->congestion_threshold && fm->sb) { in fuse_request_end()
322 fc->num_background--; in fuse_request_end()
323 fc->active_background--; in fuse_request_end()
324 flush_bg_queue(fc); in fuse_request_end()
325 spin_unlock(&fc->bg_lock); in fuse_request_end()
340 struct fuse_iqueue *fiq = &req->fm->fc->iq; in queue_interrupt()
370 struct fuse_conn *fc = req->fm->fc; in request_wait_answer() local
371 struct fuse_iqueue *fiq = &fc->iq; in request_wait_answer()
374 if (!fc->no_interrupt) { in request_wait_answer()
416 struct fuse_iqueue *fiq = &req->fm->fc->iq; in __fuse_request_send()
436 static void fuse_adjust_compat(struct fuse_conn *fc, struct fuse_args *args) in fuse_adjust_compat() argument
438 if (fc->minor < 4 && args->opcode == FUSE_STATFS) in fuse_adjust_compat()
441 if (fc->minor < 9) { in fuse_adjust_compat()
457 if (fc->minor < 12) { in fuse_adjust_compat()
471 struct fuse_conn *fc = req->fm->fc; in fuse_force_creds() local
473 req->in.h.uid = from_kuid_munged(fc->user_ns, current_fsuid()); in fuse_force_creds()
474 req->in.h.gid = from_kgid_munged(fc->user_ns, current_fsgid()); in fuse_force_creds()
475 req->in.h.pid = pid_nr_ns(task_pid(current), fc->pid_ns); in fuse_force_creds()
489 struct fuse_conn *fc = fm->fc; in fuse_simple_request() local
494 atomic_inc(&fc->num_waiting); in fuse_simple_request()
510 fuse_adjust_compat(fc, args); in fuse_simple_request()
529 struct fuse_conn *fc = fm->fc; in fuse_request_queue_background() local
535 atomic_inc(&fc->num_waiting); in fuse_request_queue_background()
538 spin_lock(&fc->bg_lock); in fuse_request_queue_background()
539 if (likely(fc->connected)) { in fuse_request_queue_background()
540 fc->num_background++; in fuse_request_queue_background()
541 if (fc->num_background == fc->max_background) in fuse_request_queue_background()
542 fc->blocked = 1; in fuse_request_queue_background()
543 if (fc->num_background == fc->congestion_threshold && fm->sb) { in fuse_request_queue_background()
547 list_add_tail(&req->list, &fc->bg_queue); in fuse_request_queue_background()
548 flush_bg_queue(fc); in fuse_request_queue_background()
551 spin_unlock(&fc->bg_lock); in fuse_request_queue_background()
589 struct fuse_iqueue *fiq = &fm->fc->iq; in fuse_simple_notify_reply()
1176 static int fuse_read_forget(struct fuse_conn *fc, struct fuse_iqueue *fiq, in fuse_read_forget() argument
1181 if (fc->minor < 16 || fiq->forget_list_head.next->next == NULL) in fuse_read_forget()
1200 struct fuse_conn *fc = fud->fc; in fuse_dev_do_read() local
1201 struct fuse_iqueue *fiq = &fc->iq; in fuse_dev_do_read()
1223 fc->max_write)) in fuse_dev_do_read()
1242 err = fc->aborted ? -ECONNABORTED : -ENODEV; in fuse_dev_do_read()
1254 return fuse_read_forget(fc, fiq, cs, nbytes); in fuse_dev_do_read()
1289 err = fc->aborted ? -ECONNABORTED : -ENODEV; in fuse_dev_do_read()
1404 static int fuse_notify_poll(struct fuse_conn *fc, unsigned int size, in fuse_notify_poll() argument
1418 return fuse_notify_poll_wakeup(fc, &outarg); in fuse_notify_poll()
1425 static int fuse_notify_inval_inode(struct fuse_conn *fc, unsigned int size, in fuse_notify_inval_inode() argument
1439 down_read(&fc->killsb); in fuse_notify_inval_inode()
1440 err = fuse_reverse_inval_inode(fc, outarg.ino, in fuse_notify_inval_inode()
1442 up_read(&fc->killsb); in fuse_notify_inval_inode()
1450 static int fuse_notify_inval_entry(struct fuse_conn *fc, unsigned int size, in fuse_notify_inval_entry() argument
1486 down_read(&fc->killsb); in fuse_notify_inval_entry()
1487 err = fuse_reverse_inval_entry(fc, outarg.parent, 0, &name); in fuse_notify_inval_entry()
1488 up_read(&fc->killsb); in fuse_notify_inval_entry()
1498 static int fuse_notify_delete(struct fuse_conn *fc, unsigned int size, in fuse_notify_delete() argument
1534 down_read(&fc->killsb); in fuse_notify_delete()
1535 err = fuse_reverse_inval_entry(fc, outarg.parent, outarg.child, &name); in fuse_notify_delete()
1536 up_read(&fc->killsb); in fuse_notify_delete()
1546 static int fuse_notify_store(struct fuse_conn *fc, unsigned int size, in fuse_notify_store() argument
1574 down_read(&fc->killsb); in fuse_notify_store()
1577 inode = fuse_ilookup(fc, nodeid, NULL); in fuse_notify_store()
1623 up_read(&fc->killsb); in fuse_notify_store()
1655 struct fuse_conn *fc = fm->fc; in fuse_retrieve() local
1664 num = min(outarg->size, fc->max_write); in fuse_retrieve()
1671 num_pages = min(num_pages, fc->max_pages); in fuse_retrieve()
1724 static int fuse_notify_retrieve(struct fuse_conn *fc, unsigned int size, in fuse_notify_retrieve() argument
1743 down_read(&fc->killsb); in fuse_notify_retrieve()
1747 inode = fuse_ilookup(fc, nodeid, &fm); in fuse_notify_retrieve()
1752 up_read(&fc->killsb); in fuse_notify_retrieve()
1761 static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, in fuse_notify() argument
1769 return fuse_notify_poll(fc, size, cs); in fuse_notify()
1772 return fuse_notify_inval_inode(fc, size, cs); in fuse_notify()
1775 return fuse_notify_inval_entry(fc, size, cs); in fuse_notify()
1778 return fuse_notify_store(fc, size, cs); in fuse_notify()
1781 return fuse_notify_retrieve(fc, size, cs); in fuse_notify()
1784 return fuse_notify_delete(fc, size, cs); in fuse_notify()
1837 struct fuse_conn *fc = fud->fc; in fuse_dev_do_write() local
1859 err = fuse_notify(fc, oh.error, nbytes - sizeof(oh), cs); in fuse_dev_do_write()
1887 fc->no_interrupt = 1; in fuse_dev_do_write()
2045 fiq = &fud->fc->iq; in fuse_dev_poll()
2071 static void end_polls(struct fuse_conn *fc) in end_polls() argument
2075 p = rb_first(&fc->polled_files); in end_polls()
2104 void fuse_abort_conn(struct fuse_conn *fc) in fuse_abort_conn() argument
2106 struct fuse_iqueue *fiq = &fc->iq; in fuse_abort_conn()
2108 spin_lock(&fc->lock); in fuse_abort_conn()
2109 if (fc->connected) { in fuse_abort_conn()
2116 spin_lock(&fc->bg_lock); in fuse_abort_conn()
2117 fc->connected = 0; in fuse_abort_conn()
2118 spin_unlock(&fc->bg_lock); in fuse_abort_conn()
2120 fuse_set_initialized(fc); in fuse_abort_conn()
2121 list_for_each_entry(fud, &fc->devices, entry) { in fuse_abort_conn()
2142 spin_lock(&fc->bg_lock); in fuse_abort_conn()
2143 fc->blocked = 0; in fuse_abort_conn()
2144 fc->max_background = UINT_MAX; in fuse_abort_conn()
2145 flush_bg_queue(fc); in fuse_abort_conn()
2146 spin_unlock(&fc->bg_lock); in fuse_abort_conn()
2158 end_polls(fc); in fuse_abort_conn()
2159 wake_up_all(&fc->blocked_waitq); in fuse_abort_conn()
2160 spin_unlock(&fc->lock); in fuse_abort_conn()
2164 spin_unlock(&fc->lock); in fuse_abort_conn()
2169 void fuse_wait_aborted(struct fuse_conn *fc) in fuse_wait_aborted() argument
2173 wait_event(fc->blocked_waitq, atomic_read(&fc->num_waiting) == 0); in fuse_wait_aborted()
2181 struct fuse_conn *fc = fud->fc; in fuse_dev_release() local
2195 if (atomic_dec_and_test(&fc->dev_count)) { in fuse_dev_release()
2196 WARN_ON(fc->iq.fasync != NULL); in fuse_dev_release()
2197 fuse_abort_conn(fc); in fuse_dev_release()
2213 return fasync_helper(fd, file, on, &fud->fc->iq.fasync); in fuse_dev_fasync()
2216 static int fuse_device_clone(struct fuse_conn *fc, struct file *new) in fuse_device_clone() argument
2223 fud = fuse_dev_alloc_install(fc); in fuse_device_clone()
2228 atomic_inc(&fc->dev_count); in fuse_device_clone()
2259 err = fuse_device_clone(fud->fc, file); in fuse_dev_ioctl()