Lines Matching full:ls

157 	struct nfs4_layout_stateid *ls = layoutstateid(stid);  in nfsd4_free_layout_stateid()  local
158 struct nfs4_client *clp = ls->ls_stid.sc_client; in nfsd4_free_layout_stateid()
159 struct nfs4_file *fp = ls->ls_stid.sc_file; in nfsd4_free_layout_stateid()
161 trace_nfsd_layoutstate_free(&ls->ls_stid.sc_stateid); in nfsd4_free_layout_stateid()
164 list_del_init(&ls->ls_perclnt); in nfsd4_free_layout_stateid()
168 list_del_init(&ls->ls_perfile); in nfsd4_free_layout_stateid()
171 if (!nfsd4_layout_ops[ls->ls_layout_type]->disable_recalls) in nfsd4_free_layout_stateid()
172 vfs_setlease(ls->ls_file->nf_file, F_UNLCK, NULL, (void **)&ls); in nfsd4_free_layout_stateid()
173 nfsd_file_put(ls->ls_file); in nfsd4_free_layout_stateid()
175 if (ls->ls_recalled) in nfsd4_free_layout_stateid()
176 atomic_dec(&ls->ls_stid.sc_file->fi_lo_recalls); in nfsd4_free_layout_stateid()
178 kmem_cache_free(nfs4_layout_stateid_cache, ls); in nfsd4_free_layout_stateid()
182 nfsd4_layout_setlease(struct nfs4_layout_stateid *ls) in nfsd4_layout_setlease() argument
187 if (nfsd4_layout_ops[ls->ls_layout_type]->disable_recalls) in nfsd4_layout_setlease()
198 fl->fl_owner = ls; in nfsd4_layout_setlease()
200 fl->fl_file = ls->ls_file->nf_file; in nfsd4_layout_setlease()
217 struct nfs4_layout_stateid *ls; in nfsd4_alloc_layout_stateid() local
228 ls = layoutstateid(stp); in nfsd4_alloc_layout_stateid()
229 INIT_LIST_HEAD(&ls->ls_perclnt); in nfsd4_alloc_layout_stateid()
230 INIT_LIST_HEAD(&ls->ls_perfile); in nfsd4_alloc_layout_stateid()
231 spin_lock_init(&ls->ls_lock); in nfsd4_alloc_layout_stateid()
232 INIT_LIST_HEAD(&ls->ls_layouts); in nfsd4_alloc_layout_stateid()
233 mutex_init(&ls->ls_mutex); in nfsd4_alloc_layout_stateid()
234 ls->ls_layout_type = layout_type; in nfsd4_alloc_layout_stateid()
235 nfsd4_init_cb(&ls->ls_recall, clp, &nfsd4_cb_layout_ops, in nfsd4_alloc_layout_stateid()
239 ls->ls_file = nfsd_file_get(fp->fi_deleg_file); in nfsd4_alloc_layout_stateid()
241 ls->ls_file = find_any_file(fp); in nfsd4_alloc_layout_stateid()
242 BUG_ON(!ls->ls_file); in nfsd4_alloc_layout_stateid()
244 if (nfsd4_layout_setlease(ls)) { in nfsd4_alloc_layout_stateid()
245 nfsd_file_put(ls->ls_file); in nfsd4_alloc_layout_stateid()
247 kmem_cache_free(nfs4_layout_stateid_cache, ls); in nfsd4_alloc_layout_stateid()
253 list_add(&ls->ls_perclnt, &clp->cl_lo_states); in nfsd4_alloc_layout_stateid()
257 list_add(&ls->ls_perfile, &fp->fi_lo_states); in nfsd4_alloc_layout_stateid()
260 trace_nfsd_layoutstate_alloc(&ls->ls_stid.sc_stateid); in nfsd4_alloc_layout_stateid()
261 return ls; in nfsd4_alloc_layout_stateid()
269 struct nfs4_layout_stateid *ls; in nfsd4_preprocess_layout_stateid() local
289 ls = nfsd4_alloc_layout_stateid(cstate, stid, layout_type); in nfsd4_preprocess_layout_stateid()
293 if (!ls) in nfsd4_preprocess_layout_stateid()
295 mutex_lock(&ls->ls_mutex); in nfsd4_preprocess_layout_stateid()
297 ls = container_of(stid, struct nfs4_layout_stateid, ls_stid); in nfsd4_preprocess_layout_stateid()
300 mutex_lock(&ls->ls_mutex); in nfsd4_preprocess_layout_stateid()
303 if (layout_type != ls->ls_layout_type) in nfsd4_preprocess_layout_stateid()
307 *lsp = ls; in nfsd4_preprocess_layout_stateid()
311 mutex_unlock(&ls->ls_mutex); in nfsd4_preprocess_layout_stateid()
319 nfsd4_recall_file_layout(struct nfs4_layout_stateid *ls) in nfsd4_recall_file_layout() argument
321 spin_lock(&ls->ls_lock); in nfsd4_recall_file_layout()
322 if (ls->ls_recalled) in nfsd4_recall_file_layout()
325 ls->ls_recalled = true; in nfsd4_recall_file_layout()
326 atomic_inc(&ls->ls_stid.sc_file->fi_lo_recalls); in nfsd4_recall_file_layout()
327 if (list_empty(&ls->ls_layouts)) in nfsd4_recall_file_layout()
330 trace_nfsd_layout_recall(&ls->ls_stid.sc_stateid); in nfsd4_recall_file_layout()
332 refcount_inc(&ls->ls_stid.sc_count); in nfsd4_recall_file_layout()
333 nfsd4_run_cb(&ls->ls_recall); in nfsd4_recall_file_layout()
336 spin_unlock(&ls->ls_lock); in nfsd4_recall_file_layout()
383 nfsd4_recall_conflict(struct nfs4_layout_stateid *ls) in nfsd4_recall_conflict() argument
385 struct nfs4_file *fp = ls->ls_stid.sc_file; in nfsd4_recall_conflict()
392 if (l != ls) { in nfsd4_recall_conflict()
402 nfsd4_insert_layout(struct nfsd4_layoutget *lgp, struct nfs4_layout_stateid *ls) in nfsd4_insert_layout() argument
405 struct nfs4_file *fp = ls->ls_stid.sc_file; in nfsd4_insert_layout()
410 nfserr = nfsd4_recall_conflict(ls); in nfsd4_insert_layout()
413 spin_lock(&ls->ls_lock); in nfsd4_insert_layout()
414 list_for_each_entry(lp, &ls->ls_layouts, lo_perstate) { in nfsd4_insert_layout()
418 spin_unlock(&ls->ls_lock); in nfsd4_insert_layout()
425 new->lo_state = ls; in nfsd4_insert_layout()
428 nfserr = nfsd4_recall_conflict(ls); in nfsd4_insert_layout()
431 spin_lock(&ls->ls_lock); in nfsd4_insert_layout()
432 list_for_each_entry(lp, &ls->ls_layouts, lo_perstate) { in nfsd4_insert_layout()
437 refcount_inc(&ls->ls_stid.sc_count); in nfsd4_insert_layout()
438 list_add_tail(&new->lo_perstate, &ls->ls_layouts); in nfsd4_insert_layout()
441 nfs4_inc_and_copy_stateid(&lgp->lg_sid, &ls->ls_stid); in nfsd4_insert_layout()
442 spin_unlock(&ls->ls_lock); in nfsd4_insert_layout()
493 struct nfs4_layout_stateid *ls; in nfsd4_return_file_layouts() local
501 &ls); in nfsd4_return_file_layouts()
507 spin_lock(&ls->ls_lock); in nfsd4_return_file_layouts()
508 list_for_each_entry_safe(lp, n, &ls->ls_layouts, lo_perstate) { in nfsd4_return_file_layouts()
514 if (!list_empty(&ls->ls_layouts)) { in nfsd4_return_file_layouts()
516 nfs4_inc_and_copy_stateid(&lrp->lr_sid, &ls->ls_stid); in nfsd4_return_file_layouts()
519 trace_nfsd_layoutstate_unhash(&ls->ls_stid.sc_stateid); in nfsd4_return_file_layouts()
520 nfs4_unhash_stid(&ls->ls_stid); in nfsd4_return_file_layouts()
523 spin_unlock(&ls->ls_lock); in nfsd4_return_file_layouts()
525 mutex_unlock(&ls->ls_mutex); in nfsd4_return_file_layouts()
526 nfs4_put_stid(&ls->ls_stid); in nfsd4_return_file_layouts()
536 struct nfs4_layout_stateid *ls, *n; in nfsd4_return_client_layouts() local
544 list_for_each_entry_safe(ls, n, &clp->cl_lo_states, ls_perclnt) { in nfsd4_return_client_layouts()
545 if (ls->ls_layout_type != lrp->lr_layout_type) in nfsd4_return_client_layouts()
549 !fh_fsid_match(&ls->ls_stid.sc_file->fi_fhandle, in nfsd4_return_client_layouts()
553 spin_lock(&ls->ls_lock); in nfsd4_return_client_layouts()
554 list_for_each_entry_safe(lp, t, &ls->ls_layouts, lo_perstate) { in nfsd4_return_client_layouts()
559 spin_unlock(&ls->ls_lock); in nfsd4_return_client_layouts()
568 nfsd4_return_all_layouts(struct nfs4_layout_stateid *ls, in nfsd4_return_all_layouts() argument
571 spin_lock(&ls->ls_lock); in nfsd4_return_all_layouts()
572 list_splice_init(&ls->ls_layouts, reaplist); in nfsd4_return_all_layouts()
573 spin_unlock(&ls->ls_lock); in nfsd4_return_all_layouts()
579 struct nfs4_layout_stateid *ls, *n; in nfsd4_return_all_client_layouts() local
583 list_for_each_entry_safe(ls, n, &clp->cl_lo_states, ls_perclnt) in nfsd4_return_all_client_layouts()
584 nfsd4_return_all_layouts(ls, &reaplist); in nfsd4_return_all_client_layouts()
593 struct nfs4_layout_stateid *ls, *n; in nfsd4_return_all_file_layouts() local
597 list_for_each_entry_safe(ls, n, &fp->fi_lo_states, ls_perfile) { in nfsd4_return_all_file_layouts()
598 if (ls->ls_stid.sc_client == clp) in nfsd4_return_all_file_layouts()
599 nfsd4_return_all_layouts(ls, &reaplist); in nfsd4_return_all_file_layouts()
607 nfsd4_cb_layout_fail(struct nfs4_layout_stateid *ls) in nfsd4_cb_layout_fail() argument
609 struct nfs4_client *clp = ls->ls_stid.sc_client; in nfsd4_cb_layout_fail()
629 argv[2] = ls->ls_file->nf_file->f_path.mnt->mnt_sb->s_id; in nfsd4_cb_layout_fail()
643 struct nfs4_layout_stateid *ls = in nfsd4_cb_layout_prepare() local
646 mutex_lock(&ls->ls_mutex); in nfsd4_cb_layout_prepare()
647 nfs4_inc_and_copy_stateid(&ls->ls_recall_sid, &ls->ls_stid); in nfsd4_cb_layout_prepare()
648 mutex_unlock(&ls->ls_mutex); in nfsd4_cb_layout_prepare()
654 struct nfs4_layout_stateid *ls = in nfsd4_cb_layout_done() local
669 if (list_empty(&ls->ls_layouts)) in nfsd4_cb_layout_done()
674 nn = net_generic(ls->ls_stid.sc_client->net, nfsd_net_id); in nfsd4_cb_layout_done()
689 trace_nfsd_layout_recall_fail(&ls->ls_stid.sc_stateid); in nfsd4_cb_layout_done()
691 ops = nfsd4_layout_ops[ls->ls_layout_type]; in nfsd4_cb_layout_done()
693 ops->fence_client(ls); in nfsd4_cb_layout_done()
695 nfsd4_cb_layout_fail(ls); in nfsd4_cb_layout_done()
698 trace_nfsd_layout_recall_done(&ls->ls_stid.sc_stateid); in nfsd4_cb_layout_done()
707 struct nfs4_layout_stateid *ls = in nfsd4_cb_layout_release() local
711 trace_nfsd_layout_recall_release(&ls->ls_stid.sc_stateid); in nfsd4_cb_layout_release()
713 nfsd4_return_all_layouts(ls, &reaplist); in nfsd4_cb_layout_release()
715 nfs4_put_stid(&ls->ls_stid); in nfsd4_cb_layout_release()