Lines Matching refs:open

491 find_openstateowner_str_locked(unsigned int hashval, struct nfsd4_open *open,  in find_openstateowner_str_locked()  argument
502 if (same_owner_str(so, &open->op_owner)) in find_openstateowner_str_locked()
509 find_openstateowner_str(unsigned int hashval, struct nfsd4_open *open, in find_openstateowner_str() argument
515 oo = find_openstateowner_str_locked(hashval, open, clp); in find_openstateowner_str()
2422 .open = client_info_open,
2676 .open = client_states_open,
4309 nfsd4_find_existing_open(struct nfs4_file *fp, struct nfsd4_open *open) in nfsd4_find_existing_open() argument
4312 struct nfs4_openowner *oo = open->op_openowner; in nfsd4_find_existing_open()
4364 nfsd4_find_and_lock_existing_open(struct nfs4_file *fp, struct nfsd4_open *open) in nfsd4_find_and_lock_existing_open() argument
4369 stp = nfsd4_find_existing_open(fp, open); in nfsd4_find_and_lock_existing_open()
4379 alloc_init_open_stateowner(unsigned int strhashval, struct nfsd4_open *open, in alloc_init_open_stateowner() argument
4385 oo = alloc_stateowner(openowner_slab, &open->op_owner, clp); in alloc_init_open_stateowner()
4390 oo->oo_owner.so_seqid = open->op_seqid; in alloc_init_open_stateowner()
4398 ret = find_openstateowner_str_locked(strhashval, open, clp); in alloc_init_open_stateowner()
4410 init_open_stateid(struct nfs4_file *fp, struct nfsd4_open *open) in init_open_stateid() argument
4413 struct nfs4_openowner *oo = open->op_openowner; in init_open_stateid()
4417 stp = open->op_stp; in init_open_stateid()
4426 retstp = nfsd4_find_existing_open(fp, open); in init_open_stateid()
4430 open->op_stp = NULL; in init_open_stateid()
4773 struct nfsd4_open *open, struct nfsd_net *nn) in nfsd4_process_open1() argument
4775 clientid_t *clientid = &open->op_clientid; in nfsd4_process_open1()
4785 open->op_file = nfsd4_alloc_file(); in nfsd4_process_open1()
4786 if (open->op_file == NULL) in nfsd4_process_open1()
4794 strhashval = ownerstr_hashval(&open->op_owner); in nfsd4_process_open1()
4795 oo = find_openstateowner_str(strhashval, open, clp); in nfsd4_process_open1()
4796 open->op_openowner = oo; in nfsd4_process_open1()
4803 open->op_openowner = NULL; in nfsd4_process_open1()
4806 status = nfsd4_check_seqid(cstate, &oo->oo_owner, open->op_seqid); in nfsd4_process_open1()
4811 oo = alloc_init_open_stateowner(strhashval, open, cstate); in nfsd4_process_open1()
4814 open->op_openowner = oo; in nfsd4_process_open1()
4816 open->op_stp = nfs4_alloc_open_stateid(clp); in nfsd4_process_open1()
4817 if (!open->op_stp) in nfsd4_process_open1()
4822 open->op_odstate = alloc_clnt_odstate(clp); in nfsd4_process_open1()
4823 if (!open->op_odstate) in nfsd4_process_open1()
4855 static bool nfsd4_is_deleg_cur(struct nfsd4_open *open) in nfsd4_is_deleg_cur() argument
4857 return open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR || in nfsd4_is_deleg_cur()
4858 open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH; in nfsd4_is_deleg_cur()
4862 nfs4_check_deleg(struct nfs4_client *cl, struct nfsd4_open *open, in nfs4_check_deleg() argument
4869 deleg = find_deleg_stateid(cl, &open->op_delegate_stateid); in nfs4_check_deleg()
4878 flags = share_access_to_flags(open->op_share_access); in nfs4_check_deleg()
4886 if (!nfsd4_is_deleg_cur(open)) in nfs4_check_deleg()
4890 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; in nfs4_check_deleg()
4907 struct nfsd4_open *open) in nfsd4_truncate() argument
4913 if (!open->op_truncate) in nfsd4_truncate()
4915 if (!(open->op_share_access & NFS4_SHARE_ACCESS_WRITE)) in nfsd4_truncate()
4922 struct nfsd4_open *open) in nfs4_get_vfs_file() argument
4926 int oflag = nfs4_access_to_omode(open->op_share_access); in nfs4_get_vfs_file()
4927 int access = nfs4_access_to_access(open->op_share_access); in nfs4_get_vfs_file()
4936 status = nfs4_file_check_deny(fp, open->op_share_deny); in nfs4_get_vfs_file()
4943 status = nfs4_file_get_access(fp, open->op_share_access); in nfs4_get_vfs_file()
4951 set_access(open->op_share_access, stp); in nfs4_get_vfs_file()
4955 set_deny(open->op_share_deny, stp); in nfs4_get_vfs_file()
4956 fp->fi_share_deny |= (open->op_share_deny & NFS4_SHARE_DENY_BOTH); in nfs4_get_vfs_file()
4978 status = nfsd4_truncate(rqstp, cur_fh, open); in nfs4_get_vfs_file()
4985 nfs4_file_put_access(fp, open->op_share_access); in nfs4_get_vfs_file()
4991 … struct nfs4_file *fp, struct svc_fh *cur_fh, struct nfs4_ol_stateid *stp, struct nfsd4_open *open) in nfs4_upgrade_open() argument
4996 if (!test_access(open->op_share_access, stp)) in nfs4_upgrade_open()
4997 return nfs4_get_vfs_file(rqstp, fp, cur_fh, stp, open); in nfs4_upgrade_open()
5001 status = nfs4_file_check_deny(fp, open->op_share_deny); in nfs4_upgrade_open()
5003 set_deny(open->op_share_deny, stp); in nfs4_upgrade_open()
5005 (open->op_share_deny & NFS4_SHARE_DENY_BOTH); in nfs4_upgrade_open()
5012 status = nfsd4_truncate(rqstp, cur_fh, open); in nfs4_upgrade_open()
5194 static void nfsd4_open_deleg_none_ext(struct nfsd4_open *open, int status) in nfsd4_open_deleg_none_ext() argument
5196 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT; in nfsd4_open_deleg_none_ext()
5198 open->op_why_no_deleg = WND4_CONTENTION; in nfsd4_open_deleg_none_ext()
5200 open->op_why_no_deleg = WND4_RESOURCE; in nfsd4_open_deleg_none_ext()
5201 switch (open->op_deleg_want) { in nfsd4_open_deleg_none_ext()
5207 open->op_why_no_deleg = WND4_CANCELLED; in nfsd4_open_deleg_none_ext()
5222 nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, in nfs4_open_delegation() argument
5232 open->op_recall = 0; in nfs4_open_delegation()
5233 switch (open->op_claim_type) { in nfs4_open_delegation()
5236 open->op_recall = 1; in nfs4_open_delegation()
5237 if (open->op_delegate_type != NFS4_OPEN_DELEGATE_READ) in nfs4_open_delegation()
5259 memcpy(&open->op_delegate_stateid, &dp->dl_stid.sc_stateid, sizeof(dp->dl_stid.sc_stateid)); in nfs4_open_delegation()
5262 open->op_delegate_type = NFS4_OPEN_DELEGATE_READ; in nfs4_open_delegation()
5266 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE; in nfs4_open_delegation()
5267 if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS && in nfs4_open_delegation()
5268 open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE) { in nfs4_open_delegation()
5270 open->op_recall = 1; in nfs4_open_delegation()
5274 if (open->op_deleg_want) in nfs4_open_delegation()
5275 nfsd4_open_deleg_none_ext(open, status); in nfs4_open_delegation()
5279 static void nfsd4_deleg_xgrade_none_ext(struct nfsd4_open *open, in nfsd4_deleg_xgrade_none_ext() argument
5282 if (open->op_deleg_want == NFS4_SHARE_WANT_READ_DELEG && in nfsd4_deleg_xgrade_none_ext()
5284 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT; in nfsd4_deleg_xgrade_none_ext()
5285 open->op_why_no_deleg = WND4_NOT_SUPP_DOWNGRADE; in nfsd4_deleg_xgrade_none_ext()
5286 } else if (open->op_deleg_want == NFS4_SHARE_WANT_WRITE_DELEG && in nfsd4_deleg_xgrade_none_ext()
5288 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT; in nfsd4_deleg_xgrade_none_ext()
5289 open->op_why_no_deleg = WND4_NOT_SUPP_UPGRADE; in nfsd4_deleg_xgrade_none_ext()
5298 nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) in nfsd4_process_open2() argument
5301 struct nfs4_client *cl = open->op_openowner->oo_owner.so_client; in nfsd4_process_open2()
5313 fp = find_or_add_file(open->op_file, current_fh); in nfsd4_process_open2()
5314 if (fp != open->op_file) { in nfsd4_process_open2()
5315 status = nfs4_check_deleg(cl, open, &dp); in nfsd4_process_open2()
5318 stp = nfsd4_find_and_lock_existing_open(fp, open); in nfsd4_process_open2()
5320 open->op_file = NULL; in nfsd4_process_open2()
5322 if (nfsd4_is_deleg_cur(open)) in nfsd4_process_open2()
5327 stp = init_open_stateid(fp, open); in nfsd4_process_open2()
5328 if (!open->op_stp) in nfsd4_process_open2()
5340 status = nfs4_upgrade_open(rqstp, fp, current_fh, stp, open); in nfsd4_process_open2()
5346 status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp, open); in nfsd4_process_open2()
5355 open->op_odstate); in nfsd4_process_open2()
5356 if (stp->st_clnt_odstate == open->op_odstate) in nfsd4_process_open2()
5357 open->op_odstate = NULL; in nfsd4_process_open2()
5360 nfs4_inc_and_copy_stateid(&open->op_stateid, &stp->st_stid); in nfsd4_process_open2()
5364 if (open->op_deleg_want & NFS4_SHARE_WANT_NO_DELEG) { in nfsd4_process_open2()
5365 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT; in nfsd4_process_open2()
5366 open->op_why_no_deleg = WND4_NOT_WANTED; in nfsd4_process_open2()
5375 nfs4_open_delegation(current_fh, open, stp); in nfsd4_process_open2()
5381 if (open->op_delegate_type == NFS4_OPEN_DELEGATE_NONE && dp && in nfsd4_process_open2()
5382 open->op_deleg_want) in nfsd4_process_open2()
5383 nfsd4_deleg_xgrade_none_ext(open, dp); in nfsd4_process_open2()
5387 if (status == 0 && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS) in nfsd4_process_open2()
5388 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; in nfsd4_process_open2()
5392 open->op_rflags = NFS4_OPEN_RESULT_LOCKTYPE_POSIX; in nfsd4_process_open2()
5394 open->op_rflags |= NFS4_OPEN_RESULT_MAY_NOTIFY_LOCK; in nfsd4_process_open2()
5395 else if (!(open->op_openowner->oo_flags & NFS4_OO_CONFIRMED)) in nfsd4_process_open2()
5396 open->op_rflags |= NFS4_OPEN_RESULT_CONFIRM; in nfsd4_process_open2()
5407 struct nfsd4_open *open) in nfsd4_cleanup_open_state() argument
5409 if (open->op_openowner) { in nfsd4_cleanup_open_state()
5410 struct nfs4_stateowner *so = &open->op_openowner->oo_owner; in nfsd4_cleanup_open_state()
5415 if (open->op_file) in nfsd4_cleanup_open_state()
5416 kmem_cache_free(file_slab, open->op_file); in nfsd4_cleanup_open_state()
5417 if (open->op_stp) in nfsd4_cleanup_open_state()
5418 nfs4_put_stid(&open->op_stp->st_stid); in nfsd4_cleanup_open_state()
5419 if (open->op_odstate) in nfsd4_cleanup_open_state()
5420 kmem_cache_free(odstate_slab, open->op_odstate); in nfsd4_cleanup_open_state()
7653 put_stateid(cstate, &u->open.op_stateid); in nfsd4_set_openstateid()