Lines Matching refs:ls

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