• Home
  • Raw
  • Download

Lines Matching full:nf

85 	struct nfsd_file *nf = container_of(rcu, struct nfsd_file, nf_rcu);  in nfsd_file_slab_free()  local
87 put_cred(nf->nf_cred); in nfsd_file_slab_free()
88 kmem_cache_free(nfsd_file_slab, nf); in nfsd_file_slab_free()
118 nfsd_file_mark_find_or_create(struct nfsd_file *nf) in nfsd_file_mark_find_or_create() argument
123 struct inode *inode = nf->nf_inode; in nfsd_file_mark_find_or_create()
176 struct nfsd_file *nf; in nfsd_file_alloc() local
178 nf = kmem_cache_alloc(nfsd_file_slab, GFP_KERNEL); in nfsd_file_alloc()
179 if (nf) { in nfsd_file_alloc()
180 INIT_HLIST_NODE(&nf->nf_node); in nfsd_file_alloc()
181 INIT_LIST_HEAD(&nf->nf_lru); in nfsd_file_alloc()
182 nf->nf_file = NULL; in nfsd_file_alloc()
183 nf->nf_cred = get_current_cred(); in nfsd_file_alloc()
184 nf->nf_net = net; in nfsd_file_alloc()
185 nf->nf_flags = 0; in nfsd_file_alloc()
186 nf->nf_inode = inode; in nfsd_file_alloc()
187 nf->nf_hashval = hashval; in nfsd_file_alloc()
188 refcount_set(&nf->nf_ref, 1); in nfsd_file_alloc()
189 nf->nf_may = may & NFSD_FILE_MAY_MASK; in nfsd_file_alloc()
192 __set_bit(NFSD_FILE_BREAK_WRITE, &nf->nf_flags); in nfsd_file_alloc()
194 __set_bit(NFSD_FILE_BREAK_READ, &nf->nf_flags); in nfsd_file_alloc()
196 nf->nf_mark = NULL; in nfsd_file_alloc()
197 trace_nfsd_file_alloc(nf); in nfsd_file_alloc()
199 return nf; in nfsd_file_alloc()
203 nfsd_file_free(struct nfsd_file *nf) in nfsd_file_free() argument
207 trace_nfsd_file_put_final(nf); in nfsd_file_free()
208 if (nf->nf_mark) in nfsd_file_free()
209 nfsd_file_mark_put(nf->nf_mark); in nfsd_file_free()
210 if (nf->nf_file) { in nfsd_file_free()
211 get_file(nf->nf_file); in nfsd_file_free()
212 filp_close(nf->nf_file, NULL); in nfsd_file_free()
213 fput(nf->nf_file); in nfsd_file_free()
216 call_rcu(&nf->nf_rcu, nfsd_file_slab_free); in nfsd_file_free()
221 nfsd_file_check_writeback(struct nfsd_file *nf) in nfsd_file_check_writeback() argument
223 struct file *file = nf->nf_file; in nfsd_file_check_writeback()
234 nfsd_file_check_write_error(struct nfsd_file *nf) in nfsd_file_check_write_error() argument
236 struct file *file = nf->nf_file; in nfsd_file_check_write_error()
244 nfsd_file_do_unhash(struct nfsd_file *nf) in nfsd_file_do_unhash() argument
246 lockdep_assert_held(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock); in nfsd_file_do_unhash()
248 trace_nfsd_file_unhash(nf); in nfsd_file_do_unhash()
250 if (nfsd_file_check_write_error(nf)) in nfsd_file_do_unhash()
251 nfsd_reset_boot_verifier(net_generic(nf->nf_net, nfsd_net_id)); in nfsd_file_do_unhash()
252 --nfsd_file_hashtbl[nf->nf_hashval].nfb_count; in nfsd_file_do_unhash()
253 hlist_del_rcu(&nf->nf_node); in nfsd_file_do_unhash()
258 nfsd_file_unhash(struct nfsd_file *nf) in nfsd_file_unhash() argument
260 if (test_and_clear_bit(NFSD_FILE_HASHED, &nf->nf_flags)) { in nfsd_file_unhash()
261 nfsd_file_do_unhash(nf); in nfsd_file_unhash()
262 if (!list_empty(&nf->nf_lru)) in nfsd_file_unhash()
263 list_lru_del(&nfsd_file_lru, &nf->nf_lru); in nfsd_file_unhash()
273 nfsd_file_unhash_and_release_locked(struct nfsd_file *nf, struct list_head *dispose) in nfsd_file_unhash_and_release_locked() argument
275 lockdep_assert_held(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock); in nfsd_file_unhash_and_release_locked()
277 trace_nfsd_file_unhash_and_release_locked(nf); in nfsd_file_unhash_and_release_locked()
278 if (!nfsd_file_unhash(nf)) in nfsd_file_unhash_and_release_locked()
281 if (refcount_dec_not_one(&nf->nf_ref)) in nfsd_file_unhash_and_release_locked()
284 list_add(&nf->nf_lru, dispose); in nfsd_file_unhash_and_release_locked()
289 nfsd_file_put_noref(struct nfsd_file *nf) in nfsd_file_put_noref() argument
291 trace_nfsd_file_put(nf); in nfsd_file_put_noref()
293 if (refcount_dec_and_test(&nf->nf_ref)) { in nfsd_file_put_noref()
294 WARN_ON(test_bit(NFSD_FILE_HASHED, &nf->nf_flags)); in nfsd_file_put_noref()
295 nfsd_file_free(nf); in nfsd_file_put_noref()
300 nfsd_file_put(struct nfsd_file *nf) in nfsd_file_put() argument
304 set_bit(NFSD_FILE_REFERENCED, &nf->nf_flags); in nfsd_file_put()
305 if (refcount_read(&nf->nf_ref) > 2 || !nf->nf_file) { in nfsd_file_put()
306 nfsd_file_put_noref(nf); in nfsd_file_put()
310 filemap_flush(nf->nf_file->f_mapping); in nfsd_file_put()
311 is_hashed = test_bit(NFSD_FILE_HASHED, &nf->nf_flags) != 0; in nfsd_file_put()
312 nfsd_file_put_noref(nf); in nfsd_file_put()
320 nfsd_file_get(struct nfsd_file *nf) in nfsd_file_get() argument
322 if (likely(refcount_inc_not_zero(&nf->nf_ref))) in nfsd_file_get()
323 return nf; in nfsd_file_get()
330 struct nfsd_file *nf; in nfsd_file_dispose_list() local
333 nf = list_first_entry(dispose, struct nfsd_file, nf_lru); in nfsd_file_dispose_list()
334 list_del(&nf->nf_lru); in nfsd_file_dispose_list()
335 nfsd_file_put_noref(nf); in nfsd_file_dispose_list()
343 struct nfsd_file *nf; in nfsd_file_dispose_list_sync() local
346 nf = list_first_entry(dispose, struct nfsd_file, nf_lru); in nfsd_file_dispose_list_sync()
347 list_del(&nf->nf_lru); in nfsd_file_dispose_list_sync()
348 if (!refcount_dec_and_test(&nf->nf_ref)) in nfsd_file_dispose_list_sync()
350 if (nfsd_file_free(nf)) in nfsd_file_dispose_list_sync()
388 struct nfsd_file *nf, *tmp; in nfsd_file_list_add_pernet() local
390 list_for_each_entry_safe(nf, tmp, src, nf_lru) { in nfsd_file_list_add_pernet()
391 if (nf->nf_net == net) in nfsd_file_list_add_pernet()
392 list_move_tail(&nf->nf_lru, dst); in nfsd_file_list_add_pernet()
400 struct nfsd_file *nf; in nfsd_file_dispose_list_delayed() local
403 nf = list_first_entry(dispose, struct nfsd_file, nf_lru); in nfsd_file_dispose_list_delayed()
404 nfsd_file_list_add_pernet(&list, dispose, nf->nf_net); in nfsd_file_dispose_list_delayed()
405 nfsd_file_list_add_disposal(&list, nf->nf_net); in nfsd_file_dispose_list_delayed()
419 struct nfsd_file *nf = list_entry(item, struct nfsd_file, nf_lru); in nfsd_file_lru_cb() local
431 if (refcount_read(&nf->nf_ref) > 1) in nfsd_file_lru_cb()
438 if (nfsd_file_check_writeback(nf)) in nfsd_file_lru_cb()
441 if (test_and_clear_bit(NFSD_FILE_REFERENCED, &nf->nf_flags)) in nfsd_file_lru_cb()
444 if (!test_and_clear_bit(NFSD_FILE_HASHED, &nf->nf_flags)) in nfsd_file_lru_cb()
447 list_lru_isolate_move(lru, &nf->nf_lru, head); in nfsd_file_lru_cb()
457 struct nfsd_file *nf; in nfsd_file_lru_walk_list() local
467 list_for_each_entry(nf, &head, nf_lru) { in nfsd_file_lru_walk_list()
468 spin_lock(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock); in nfsd_file_lru_walk_list()
469 nfsd_file_do_unhash(nf); in nfsd_file_lru_walk_list()
470 spin_unlock(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock); in nfsd_file_lru_walk_list()
511 struct nfsd_file *nf; in __nfsd_file_close_inode() local
515 hlist_for_each_entry_safe(nf, tmp, &nfsd_file_hashtbl[hashval].nfb_head, nf_node) { in __nfsd_file_close_inode()
516 if (inode == nf->nf_inode) in __nfsd_file_close_inode()
517 nfsd_file_unhash_and_release_locked(nf, dispose); in __nfsd_file_close_inode()
724 struct nfsd_file *nf; in nfsd_file_cache_purge() local
736 hlist_for_each_entry_safe(nf, next, &nfb->nfb_head, nf_node) { in nfsd_file_cache_purge()
737 if (net && nf->nf_net != net) in nfsd_file_cache_purge()
739 del = nfsd_file_unhash_and_release_locked(nf, &dispose); in nfsd_file_cache_purge()
886 struct nfsd_file *nf; in nfsd_file_find_locked() local
889 hlist_for_each_entry_rcu(nf, &nfsd_file_hashtbl[hashval].nfb_head, in nfsd_file_find_locked()
891 if (nf->nf_may != need) in nfsd_file_find_locked()
893 if (nf->nf_inode != inode) in nfsd_file_find_locked()
895 if (nf->nf_net != net) in nfsd_file_find_locked()
897 if (!nfsd_match_cred(nf->nf_cred, current_cred())) in nfsd_file_find_locked()
899 if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags)) in nfsd_file_find_locked()
901 if (nfsd_file_get(nf) != NULL) in nfsd_file_find_locked()
902 return nf; in nfsd_file_find_locked()
918 struct nfsd_file *nf; in nfsd_file_is_cached() local
924 hlist_for_each_entry_rcu(nf, &nfsd_file_hashtbl[hashval].nfb_head, in nfsd_file_is_cached()
926 if (inode == nf->nf_inode) { in nfsd_file_is_cached()
942 struct nfsd_file *nf, *new; in nfsd_file_acquire() local
957 nf = nfsd_file_find_locked(inode, may_flags, hashval, net); in nfsd_file_acquire()
959 if (nf) in nfsd_file_acquire()
970 nf = nfsd_file_find_locked(inode, may_flags, hashval, net); in nfsd_file_acquire()
971 if (nf == NULL) in nfsd_file_acquire()
977 wait_on_bit(&nf->nf_flags, NFSD_FILE_PENDING, TASK_UNINTERRUPTIBLE); in nfsd_file_acquire()
980 if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags)) { in nfsd_file_acquire()
986 nfsd_file_put_noref(nf); in nfsd_file_acquire()
995 if (test_bit(NFSD_FILE_BREAK_READ, &nf->nf_flags) || in nfsd_file_acquire()
996 (test_bit(NFSD_FILE_BREAK_WRITE, &nf->nf_flags) && write)) { in nfsd_file_acquire()
998 file_inode(nf->nf_file), may_flags)); in nfsd_file_acquire()
1000 clear_bit(NFSD_FILE_BREAK_READ, &nf->nf_flags); in nfsd_file_acquire()
1003 &nf->nf_flags); in nfsd_file_acquire()
1009 *pnf = nf; in nfsd_file_acquire()
1011 nfsd_file_put(nf); in nfsd_file_acquire()
1012 nf = NULL; in nfsd_file_acquire()
1015 trace_nfsd_file_acquire(rqstp, hashval, inode, may_flags, nf, status); in nfsd_file_acquire()
1018 nf = new; in nfsd_file_acquire()
1020 refcount_inc(&nf->nf_ref); in nfsd_file_acquire()
1021 __set_bit(NFSD_FILE_HASHED, &nf->nf_flags); in nfsd_file_acquire()
1022 __set_bit(NFSD_FILE_PENDING, &nf->nf_flags); in nfsd_file_acquire()
1023 list_lru_add(&nfsd_file_lru, &nf->nf_lru); in nfsd_file_acquire()
1024 hlist_add_head_rcu(&nf->nf_node, &nfsd_file_hashtbl[hashval].nfb_head); in nfsd_file_acquire()
1032 nf->nf_mark = nfsd_file_mark_find_or_create(nf); in nfsd_file_acquire()
1033 if (nf->nf_mark) in nfsd_file_acquire()
1035 may_flags, &nf->nf_file); in nfsd_file_acquire()
1045 do_free = nfsd_file_unhash(nf); in nfsd_file_acquire()
1048 nfsd_file_put_noref(nf); in nfsd_file_acquire()
1050 clear_bit_unlock(NFSD_FILE_PENDING, &nf->nf_flags); in nfsd_file_acquire()
1052 wake_up_bit(&nf->nf_flags, NFSD_FILE_PENDING); in nfsd_file_acquire()