Lines Matching refs:ls

158 	struct nfs4_layout_stateid *ls = layoutstateid(stid);
159 struct nfs4_client *clp = ls->ls_stid.sc_client;
160 struct nfs4_file *fp = ls->ls_stid.sc_file;
162 trace_nfsd_layoutstate_free(&ls->ls_stid.sc_stateid);
165 list_del_init(&ls->ls_perclnt);
169 list_del_init(&ls->ls_perfile);
172 if (!nfsd4_layout_ops[ls->ls_layout_type]->disable_recalls)
173 vfs_setlease(ls->ls_file->nf_file, F_UNLCK, NULL, (void **)&ls);
174 nfsd_file_put(ls->ls_file);
176 if (ls->ls_recalled)
177 atomic_dec(&ls->ls_stid.sc_file->fi_lo_recalls);
179 kmem_cache_free(nfs4_layout_stateid_cache, ls);
183 nfsd4_layout_setlease(struct nfs4_layout_stateid *ls)
188 if (nfsd4_layout_ops[ls->ls_layout_type]->disable_recalls)
199 fl->fl_owner = ls;
201 fl->fl_file = ls->ls_file->nf_file;
218 struct nfs4_layout_stateid *ls;
229 ls = layoutstateid(stp);
230 INIT_LIST_HEAD(&ls->ls_perclnt);
231 INIT_LIST_HEAD(&ls->ls_perfile);
232 spin_lock_init(&ls->ls_lock);
233 INIT_LIST_HEAD(&ls->ls_layouts);
234 mutex_init(&ls->ls_mutex);
235 ls->ls_layout_type = layout_type;
236 nfsd4_init_cb(&ls->ls_recall, clp, &nfsd4_cb_layout_ops,
240 ls->ls_file = nfsd_file_get(fp->fi_deleg_file);
242 ls->ls_file = find_any_file(fp);
243 BUG_ON(!ls->ls_file);
245 if (nfsd4_layout_setlease(ls)) {
246 nfsd_file_put(ls->ls_file);
248 kmem_cache_free(nfs4_layout_stateid_cache, ls);
254 list_add(&ls->ls_perclnt, &clp->cl_lo_states);
258 list_add(&ls->ls_perfile, &fp->fi_lo_states);
261 trace_nfsd_layoutstate_alloc(&ls->ls_stid.sc_stateid);
262 return ls;
270 struct nfs4_layout_stateid *ls;
290 ls = nfsd4_alloc_layout_stateid(cstate, stid, layout_type);
294 if (!ls)
296 mutex_lock(&ls->ls_mutex);
298 ls = container_of(stid, struct nfs4_layout_stateid, ls_stid);
301 mutex_lock(&ls->ls_mutex);
304 if (layout_type != ls->ls_layout_type)
308 *lsp = ls;
312 mutex_unlock(&ls->ls_mutex);
320 nfsd4_recall_file_layout(struct nfs4_layout_stateid *ls)
322 spin_lock(&ls->ls_lock);
323 if (ls->ls_recalled)
326 if (list_empty(&ls->ls_layouts))
329 ls->ls_recalled = true;
330 atomic_inc(&ls->ls_stid.sc_file->fi_lo_recalls);
331 trace_nfsd_layout_recall(&ls->ls_stid.sc_stateid);
333 refcount_inc(&ls->ls_stid.sc_count);
334 nfsd4_run_cb(&ls->ls_recall);
337 spin_unlock(&ls->ls_lock);
384 nfsd4_recall_conflict(struct nfs4_layout_stateid *ls)
386 struct nfs4_file *fp = ls->ls_stid.sc_file;
393 if (l != ls) {
403 nfsd4_insert_layout(struct nfsd4_layoutget *lgp, struct nfs4_layout_stateid *ls)
406 struct nfs4_file *fp = ls->ls_stid.sc_file;
411 nfserr = nfsd4_recall_conflict(ls);
414 spin_lock(&ls->ls_lock);
415 list_for_each_entry(lp, &ls->ls_layouts, lo_perstate) {
419 spin_unlock(&ls->ls_lock);
426 new->lo_state = ls;
429 nfserr = nfsd4_recall_conflict(ls);
432 spin_lock(&ls->ls_lock);
433 list_for_each_entry(lp, &ls->ls_layouts, lo_perstate) {
438 refcount_inc(&ls->ls_stid.sc_count);
439 list_add_tail(&new->lo_perstate, &ls->ls_layouts);
442 nfs4_inc_and_copy_stateid(&lgp->lg_sid, &ls->ls_stid);
443 spin_unlock(&ls->ls_lock);
494 struct nfs4_layout_stateid *ls;
502 &ls);
508 spin_lock(&ls->ls_lock);
509 list_for_each_entry_safe(lp, n, &ls->ls_layouts, lo_perstate) {
515 if (!list_empty(&ls->ls_layouts)) {
517 nfs4_inc_and_copy_stateid(&lrp->lr_sid, &ls->ls_stid);
520 trace_nfsd_layoutstate_unhash(&ls->ls_stid.sc_stateid);
521 nfs4_unhash_stid(&ls->ls_stid);
524 spin_unlock(&ls->ls_lock);
526 mutex_unlock(&ls->ls_mutex);
527 nfs4_put_stid(&ls->ls_stid);
537 struct nfs4_layout_stateid *ls, *n;
545 list_for_each_entry_safe(ls, n, &clp->cl_lo_states, ls_perclnt) {
546 if (ls->ls_layout_type != lrp->lr_layout_type)
550 !fh_fsid_match(&ls->ls_stid.sc_file->fi_fhandle,
554 spin_lock(&ls->ls_lock);
555 list_for_each_entry_safe(lp, t, &ls->ls_layouts, lo_perstate) {
560 spin_unlock(&ls->ls_lock);
569 nfsd4_return_all_layouts(struct nfs4_layout_stateid *ls,
572 spin_lock(&ls->ls_lock);
573 list_splice_init(&ls->ls_layouts, reaplist);
574 spin_unlock(&ls->ls_lock);
580 struct nfs4_layout_stateid *ls, *n;
584 list_for_each_entry_safe(ls, n, &clp->cl_lo_states, ls_perclnt)
585 nfsd4_return_all_layouts(ls, &reaplist);
594 struct nfs4_layout_stateid *ls, *n;
598 list_for_each_entry_safe(ls, n, &fp->fi_lo_states, ls_perfile) {
599 if (ls->ls_stid.sc_client == clp)
600 nfsd4_return_all_layouts(ls, &reaplist);
608 nfsd4_cb_layout_fail(struct nfs4_layout_stateid *ls)
610 struct nfs4_client *clp = ls->ls_stid.sc_client;
630 argv[2] = ls->ls_file->nf_file->f_path.mnt->mnt_sb->s_id;
644 struct nfs4_layout_stateid *ls =
647 mutex_lock(&ls->ls_mutex);
648 nfs4_inc_and_copy_stateid(&ls->ls_recall_sid, &ls->ls_stid);
649 mutex_unlock(&ls->ls_mutex);
655 struct nfs4_layout_stateid *ls =
661 trace_nfsd_cb_layout_done(&ls->ls_stid.sc_stateid, task);
670 if (list_empty(&ls->ls_layouts))
675 nn = net_generic(ls->ls_stid.sc_client->net, nfsd_net_id);
690 trace_nfsd_layout_recall_fail(&ls->ls_stid.sc_stateid);
692 ops = nfsd4_layout_ops[ls->ls_layout_type];
694 ops->fence_client(ls);
696 nfsd4_cb_layout_fail(ls);
699 trace_nfsd_layout_recall_done(&ls->ls_stid.sc_stateid);
708 struct nfs4_layout_stateid *ls =
712 trace_nfsd_layout_recall_release(&ls->ls_stid.sc_stateid);
714 nfsd4_return_all_layouts(ls, &reaplist);
716 nfs4_put_stid(&ls->ls_stid);