Lines Matching refs:fc

79 void fuse_set_initialized(struct fuse_conn *fc)  in fuse_set_initialized()  argument
83 fc->initialized = 1; in fuse_set_initialized()
86 static bool fuse_block_alloc(struct fuse_conn *fc, bool for_background) in fuse_block_alloc() argument
88 return !fc->initialized || (for_background && fc->blocked); in fuse_block_alloc()
91 static void fuse_drop_waiting(struct fuse_conn *fc) in fuse_drop_waiting() argument
98 if (atomic_dec_and_test(&fc->num_waiting) && in fuse_drop_waiting()
99 !READ_ONCE(fc->connected)) { in fuse_drop_waiting()
101 wake_up_all(&fc->blocked_waitq); in fuse_drop_waiting()
109 struct fuse_conn *fc = fm->fc; in fuse_get_req() local
112 atomic_inc(&fc->num_waiting); in fuse_get_req()
114 if (fuse_block_alloc(fc, for_background)) { in fuse_get_req()
116 if (wait_event_killable_exclusive(fc->blocked_waitq, in fuse_get_req()
117 !fuse_block_alloc(fc, for_background))) in fuse_get_req()
124 if (!fc->connected) in fuse_get_req()
128 if (fc->conn_error) in fuse_get_req()
135 wake_up(&fc->blocked_waitq); in fuse_get_req()
139 req->in.h.uid = from_kuid(fc->user_ns, current_fsuid()); in fuse_get_req()
140 req->in.h.gid = from_kgid(fc->user_ns, current_fsgid()); in fuse_get_req()
141 req->in.h.pid = pid_nr_ns(task_pid(current), fc->pid_ns); in fuse_get_req()
155 fuse_drop_waiting(fc); in fuse_get_req()
161 struct fuse_conn *fc = req->fm->fc; in fuse_put_request() local
169 spin_lock(&fc->bg_lock); in fuse_put_request()
170 if (!fc->blocked) in fuse_put_request()
171 wake_up(&fc->blocked_waitq); in fuse_put_request()
172 spin_unlock(&fc->bg_lock); in fuse_put_request()
177 fuse_drop_waiting(fc); in fuse_put_request()
240 void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget, in fuse_queue_forget() argument
243 struct fuse_iqueue *fiq = &fc->iq; in fuse_queue_forget()
259 static void flush_bg_queue(struct fuse_conn *fc) in flush_bg_queue() argument
261 struct fuse_iqueue *fiq = &fc->iq; in flush_bg_queue()
263 while (fc->active_background < fc->max_background && in flush_bg_queue()
264 !list_empty(&fc->bg_queue)) { in flush_bg_queue()
267 req = list_first_entry(&fc->bg_queue, struct fuse_req, list); in flush_bg_queue()
269 fc->active_background++; in flush_bg_queue()
287 struct fuse_conn *fc = fm->fc; in fuse_request_end() local
288 struct fuse_iqueue *fiq = &fc->iq; in fuse_request_end()
306 spin_lock(&fc->bg_lock); in fuse_request_end()
308 if (fc->num_background == fc->max_background) { in fuse_request_end()
309 fc->blocked = 0; in fuse_request_end()
310 wake_up(&fc->blocked_waitq); in fuse_request_end()
311 } else if (!fc->blocked) { in fuse_request_end()
318 if (waitqueue_active(&fc->blocked_waitq)) in fuse_request_end()
319 wake_up(&fc->blocked_waitq); in fuse_request_end()
322 if (fc->num_background == fc->congestion_threshold && fm->sb) { in fuse_request_end()
326 fc->num_background--; in fuse_request_end()
327 fc->active_background--; in fuse_request_end()
328 flush_bg_queue(fc); in fuse_request_end()
329 spin_unlock(&fc->bg_lock); in fuse_request_end()
344 struct fuse_iqueue *fiq = &req->fm->fc->iq; in queue_interrupt()
374 struct fuse_conn *fc = req->fm->fc; in request_wait_answer() local
375 struct fuse_iqueue *fiq = &fc->iq; in request_wait_answer()
378 if (!fc->no_interrupt) { in request_wait_answer()
420 struct fuse_iqueue *fiq = &req->fm->fc->iq; in __fuse_request_send()
440 static void fuse_adjust_compat(struct fuse_conn *fc, struct fuse_args *args) in fuse_adjust_compat() argument
442 if (fc->minor < 4 && args->opcode == FUSE_STATFS) in fuse_adjust_compat()
445 if (fc->minor < 9) { in fuse_adjust_compat()
461 if (fc->minor < 12) { in fuse_adjust_compat()
475 struct fuse_conn *fc = req->fm->fc; in fuse_force_creds() local
477 req->in.h.uid = from_kuid_munged(fc->user_ns, current_fsuid()); in fuse_force_creds()
478 req->in.h.gid = from_kgid_munged(fc->user_ns, current_fsgid()); in fuse_force_creds()
479 req->in.h.pid = pid_nr_ns(task_pid(current), fc->pid_ns); in fuse_force_creds()
493 struct fuse_conn *fc = fm->fc; in fuse_simple_request() local
498 atomic_inc(&fc->num_waiting); in fuse_simple_request()
514 fuse_adjust_compat(fc, args); in fuse_simple_request()
533 struct fuse_conn *fc = fm->fc; in fuse_request_queue_background() local
539 atomic_inc(&fc->num_waiting); in fuse_request_queue_background()
542 spin_lock(&fc->bg_lock); in fuse_request_queue_background()
543 if (likely(fc->connected)) { in fuse_request_queue_background()
544 fc->num_background++; in fuse_request_queue_background()
545 if (fc->num_background == fc->max_background) in fuse_request_queue_background()
546 fc->blocked = 1; in fuse_request_queue_background()
547 if (fc->num_background == fc->congestion_threshold && fm->sb) { in fuse_request_queue_background()
551 list_add_tail(&req->list, &fc->bg_queue); in fuse_request_queue_background()
552 flush_bg_queue(fc); in fuse_request_queue_background()
555 spin_unlock(&fc->bg_lock); in fuse_request_queue_background()
593 struct fuse_iqueue *fiq = &fm->fc->iq; in fuse_simple_notify_reply()
1201 static int fuse_read_forget(struct fuse_conn *fc, struct fuse_iqueue *fiq, in fuse_read_forget() argument
1206 if (fc->minor < 16 || fiq->forget_list_head.next->next == NULL) in fuse_read_forget()
1225 struct fuse_conn *fc = fud->fc; in fuse_dev_do_read() local
1226 struct fuse_iqueue *fiq = &fc->iq; in fuse_dev_do_read()
1248 fc->max_write)) in fuse_dev_do_read()
1267 err = fc->aborted ? -ECONNABORTED : -ENODEV; in fuse_dev_do_read()
1279 return fuse_read_forget(fc, fiq, cs, nbytes); in fuse_dev_do_read()
1323 err = fc->aborted ? -ECONNABORTED : -ENODEV; in fuse_dev_do_read()
1438 static int fuse_notify_poll(struct fuse_conn *fc, unsigned int size, in fuse_notify_poll() argument
1452 return fuse_notify_poll_wakeup(fc, &outarg); in fuse_notify_poll()
1459 static int fuse_notify_inval_inode(struct fuse_conn *fc, unsigned int size, in fuse_notify_inval_inode() argument
1473 down_read(&fc->killsb); in fuse_notify_inval_inode()
1474 err = fuse_reverse_inval_inode(fc, outarg.ino, in fuse_notify_inval_inode()
1476 up_read(&fc->killsb); in fuse_notify_inval_inode()
1484 static int fuse_notify_inval_entry(struct fuse_conn *fc, unsigned int size, in fuse_notify_inval_entry() argument
1520 down_read(&fc->killsb); in fuse_notify_inval_entry()
1521 err = fuse_reverse_inval_entry(fc, outarg.parent, 0, &name); in fuse_notify_inval_entry()
1522 up_read(&fc->killsb); in fuse_notify_inval_entry()
1532 static int fuse_notify_delete(struct fuse_conn *fc, unsigned int size, in fuse_notify_delete() argument
1568 down_read(&fc->killsb); in fuse_notify_delete()
1569 err = fuse_reverse_inval_entry(fc, outarg.parent, outarg.child, &name); in fuse_notify_delete()
1570 up_read(&fc->killsb); in fuse_notify_delete()
1580 static int fuse_notify_store(struct fuse_conn *fc, unsigned int size, in fuse_notify_store() argument
1608 down_read(&fc->killsb); in fuse_notify_store()
1611 inode = fuse_ilookup(fc, nodeid, NULL); in fuse_notify_store()
1657 up_read(&fc->killsb); in fuse_notify_store()
1689 struct fuse_conn *fc = fm->fc; in fuse_retrieve() local
1698 num = min(outarg->size, fc->max_write); in fuse_retrieve()
1705 num_pages = min(num_pages, fc->max_pages); in fuse_retrieve()
1758 static int fuse_notify_retrieve(struct fuse_conn *fc, unsigned int size, in fuse_notify_retrieve() argument
1777 down_read(&fc->killsb); in fuse_notify_retrieve()
1781 inode = fuse_ilookup(fc, nodeid, &fm); in fuse_notify_retrieve()
1786 up_read(&fc->killsb); in fuse_notify_retrieve()
1795 static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, in fuse_notify() argument
1803 return fuse_notify_poll(fc, size, cs); in fuse_notify()
1806 return fuse_notify_inval_inode(fc, size, cs); in fuse_notify()
1809 return fuse_notify_inval_entry(fc, size, cs); in fuse_notify()
1812 return fuse_notify_store(fc, size, cs); in fuse_notify()
1815 return fuse_notify_retrieve(fc, size, cs); in fuse_notify()
1818 return fuse_notify_delete(fc, size, cs); in fuse_notify()
1871 struct fuse_conn *fc = fud->fc; in fuse_dev_do_write() local
1893 err = fuse_notify(fc, oh.error, nbytes - sizeof(oh), cs); in fuse_dev_do_write()
1921 fc->no_interrupt = 1; in fuse_dev_do_write()
2091 fiq = &fud->fc->iq; in fuse_dev_poll()
2117 static void end_polls(struct fuse_conn *fc) in end_polls() argument
2121 p = rb_first(&fc->polled_files); in end_polls()
2150 void fuse_abort_conn(struct fuse_conn *fc) in fuse_abort_conn() argument
2152 struct fuse_iqueue *fiq = &fc->iq; in fuse_abort_conn()
2154 spin_lock(&fc->lock); in fuse_abort_conn()
2155 if (fc->connected) { in fuse_abort_conn()
2162 spin_lock(&fc->bg_lock); in fuse_abort_conn()
2163 fc->connected = 0; in fuse_abort_conn()
2164 spin_unlock(&fc->bg_lock); in fuse_abort_conn()
2166 fuse_set_initialized(fc); in fuse_abort_conn()
2167 list_for_each_entry(fud, &fc->devices, entry) { in fuse_abort_conn()
2188 spin_lock(&fc->bg_lock); in fuse_abort_conn()
2189 fc->blocked = 0; in fuse_abort_conn()
2190 fc->max_background = UINT_MAX; in fuse_abort_conn()
2191 flush_bg_queue(fc); in fuse_abort_conn()
2192 spin_unlock(&fc->bg_lock); in fuse_abort_conn()
2204 end_polls(fc); in fuse_abort_conn()
2205 wake_up_all(&fc->blocked_waitq); in fuse_abort_conn()
2206 spin_unlock(&fc->lock); in fuse_abort_conn()
2210 spin_unlock(&fc->lock); in fuse_abort_conn()
2215 void fuse_wait_aborted(struct fuse_conn *fc) in fuse_wait_aborted() argument
2219 wait_event(fc->blocked_waitq, atomic_read(&fc->num_waiting) == 0); in fuse_wait_aborted()
2227 struct fuse_conn *fc = fud->fc; in fuse_dev_release() local
2241 if (atomic_dec_and_test(&fc->dev_count)) { in fuse_dev_release()
2242 WARN_ON(fc->iq.fasync != NULL); in fuse_dev_release()
2243 fuse_abort_conn(fc); in fuse_dev_release()
2259 return fasync_helper(fd, file, on, &fud->fc->iq.fasync); in fuse_dev_fasync()
2262 static int fuse_device_clone(struct fuse_conn *fc, struct file *new) in fuse_device_clone() argument
2269 fud = fuse_dev_alloc_install(fc); in fuse_device_clone()
2274 atomic_inc(&fc->dev_count); in fuse_device_clone()
2305 res = fuse_device_clone(fud->fc, file); in fuse_dev_ioctl()