Lines Matching refs:open
341 find_openstateowner_str_locked(unsigned int hashval, struct nfsd4_open *open, in find_openstateowner_str_locked() argument
352 if (same_owner_str(so, &open->op_owner)) in find_openstateowner_str_locked()
359 find_openstateowner_str(unsigned int hashval, struct nfsd4_open *open, in find_openstateowner_str() argument
365 oo = find_openstateowner_str_locked(hashval, open, clp); in find_openstateowner_str()
3549 nfsd4_find_existing_open(struct nfs4_file *fp, struct nfsd4_open *open) in nfsd4_find_existing_open() argument
3552 struct nfs4_openowner *oo = open->op_openowner; in nfsd4_find_existing_open()
3603 nfsd4_find_and_lock_existing_open(struct nfs4_file *fp, struct nfsd4_open *open) in nfsd4_find_and_lock_existing_open() argument
3608 stp = nfsd4_find_existing_open(fp, open); in nfsd4_find_and_lock_existing_open()
3618 alloc_init_open_stateowner(unsigned int strhashval, struct nfsd4_open *open, in alloc_init_open_stateowner() argument
3624 oo = alloc_stateowner(openowner_slab, &open->op_owner, clp); in alloc_init_open_stateowner()
3629 oo->oo_owner.so_seqid = open->op_seqid; in alloc_init_open_stateowner()
3637 ret = find_openstateowner_str_locked(strhashval, open, clp); in alloc_init_open_stateowner()
3649 init_open_stateid(struct nfs4_file *fp, struct nfsd4_open *open) in init_open_stateid() argument
3652 struct nfs4_openowner *oo = open->op_openowner; in init_open_stateid()
3656 stp = open->op_stp; in init_open_stateid()
3665 retstp = nfsd4_find_existing_open(fp, open); in init_open_stateid()
3669 open->op_stp = NULL; in init_open_stateid()
3990 struct nfsd4_open *open, struct nfsd_net *nn) in nfsd4_process_open1() argument
3992 clientid_t *clientid = &open->op_clientid; in nfsd4_process_open1()
3998 if (STALE_CLIENTID(&open->op_clientid, nn)) in nfsd4_process_open1()
4004 open->op_file = nfsd4_alloc_file(); in nfsd4_process_open1()
4005 if (open->op_file == NULL) in nfsd4_process_open1()
4013 strhashval = ownerstr_hashval(&open->op_owner); in nfsd4_process_open1()
4014 oo = find_openstateowner_str(strhashval, open, clp); in nfsd4_process_open1()
4015 open->op_openowner = oo; in nfsd4_process_open1()
4022 open->op_openowner = NULL; in nfsd4_process_open1()
4025 status = nfsd4_check_seqid(cstate, &oo->oo_owner, open->op_seqid); in nfsd4_process_open1()
4030 oo = alloc_init_open_stateowner(strhashval, open, cstate); in nfsd4_process_open1()
4033 open->op_openowner = oo; in nfsd4_process_open1()
4035 open->op_stp = nfs4_alloc_open_stateid(clp); in nfsd4_process_open1()
4036 if (!open->op_stp) in nfsd4_process_open1()
4041 open->op_odstate = alloc_clnt_odstate(clp); in nfsd4_process_open1()
4042 if (!open->op_odstate) in nfsd4_process_open1()
4074 static bool nfsd4_is_deleg_cur(struct nfsd4_open *open) in nfsd4_is_deleg_cur() argument
4076 return open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR || in nfsd4_is_deleg_cur()
4077 open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH; in nfsd4_is_deleg_cur()
4081 nfs4_check_deleg(struct nfs4_client *cl, struct nfsd4_open *open, in nfs4_check_deleg() argument
4088 deleg = find_deleg_stateid(cl, &open->op_delegate_stateid); in nfs4_check_deleg()
4097 flags = share_access_to_flags(open->op_share_access); in nfs4_check_deleg()
4105 if (!nfsd4_is_deleg_cur(open)) in nfs4_check_deleg()
4109 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; in nfs4_check_deleg()
4126 struct nfsd4_open *open) in nfsd4_truncate() argument
4132 if (!open->op_truncate) in nfsd4_truncate()
4134 if (!(open->op_share_access & NFS4_SHARE_ACCESS_WRITE)) in nfsd4_truncate()
4141 struct nfsd4_open *open) in nfs4_get_vfs_file() argument
4145 int oflag = nfs4_access_to_omode(open->op_share_access); in nfs4_get_vfs_file()
4146 int access = nfs4_access_to_access(open->op_share_access); in nfs4_get_vfs_file()
4155 status = nfs4_file_check_deny(fp, open->op_share_deny); in nfs4_get_vfs_file()
4162 status = nfs4_file_get_access(fp, open->op_share_access); in nfs4_get_vfs_file()
4170 set_access(open->op_share_access, stp); in nfs4_get_vfs_file()
4174 set_deny(open->op_share_deny, stp); in nfs4_get_vfs_file()
4175 fp->fi_share_deny |= (open->op_share_deny & NFS4_SHARE_DENY_BOTH); in nfs4_get_vfs_file()
4192 status = nfsd4_truncate(rqstp, cur_fh, open); in nfs4_get_vfs_file()
4199 nfs4_file_put_access(fp, open->op_share_access); in nfs4_get_vfs_file()
4205 … struct nfs4_file *fp, struct svc_fh *cur_fh, struct nfs4_ol_stateid *stp, struct nfsd4_open *open) in nfs4_upgrade_open() argument
4210 if (!test_access(open->op_share_access, stp)) in nfs4_upgrade_open()
4211 return nfs4_get_vfs_file(rqstp, fp, cur_fh, stp, open); in nfs4_upgrade_open()
4215 status = nfs4_file_check_deny(fp, open->op_share_deny); in nfs4_upgrade_open()
4217 set_deny(open->op_share_deny, stp); in nfs4_upgrade_open()
4219 (open->op_share_deny & NFS4_SHARE_DENY_BOTH); in nfs4_upgrade_open()
4226 status = nfsd4_truncate(rqstp, cur_fh, open); in nfs4_upgrade_open()
4376 static void nfsd4_open_deleg_none_ext(struct nfsd4_open *open, int status) in nfsd4_open_deleg_none_ext() argument
4378 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT; in nfsd4_open_deleg_none_ext()
4380 open->op_why_no_deleg = WND4_CONTENTION; in nfsd4_open_deleg_none_ext()
4382 open->op_why_no_deleg = WND4_RESOURCE; in nfsd4_open_deleg_none_ext()
4383 switch (open->op_deleg_want) { in nfsd4_open_deleg_none_ext()
4389 open->op_why_no_deleg = WND4_CANCELLED; in nfsd4_open_deleg_none_ext()
4404 nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, in nfs4_open_delegation() argument
4414 open->op_recall = 0; in nfs4_open_delegation()
4415 switch (open->op_claim_type) { in nfs4_open_delegation()
4418 open->op_recall = 1; in nfs4_open_delegation()
4419 if (open->op_delegate_type != NFS4_OPEN_DELEGATE_READ) in nfs4_open_delegation()
4440 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) in nfs4_open_delegation()
4442 if (open->op_create == NFS4_OPEN_CREATE) in nfs4_open_delegation()
4452 memcpy(&open->op_delegate_stateid, &dp->dl_stid.sc_stateid, sizeof(dp->dl_stid.sc_stateid)); in nfs4_open_delegation()
4456 open->op_delegate_type = NFS4_OPEN_DELEGATE_READ; in nfs4_open_delegation()
4460 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE; in nfs4_open_delegation()
4461 if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS && in nfs4_open_delegation()
4462 open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE) { in nfs4_open_delegation()
4464 open->op_recall = 1; in nfs4_open_delegation()
4468 if (open->op_deleg_want) in nfs4_open_delegation()
4469 nfsd4_open_deleg_none_ext(open, status); in nfs4_open_delegation()
4473 static void nfsd4_deleg_xgrade_none_ext(struct nfsd4_open *open, in nfsd4_deleg_xgrade_none_ext() argument
4476 if (open->op_deleg_want == NFS4_SHARE_WANT_READ_DELEG && in nfsd4_deleg_xgrade_none_ext()
4478 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT; in nfsd4_deleg_xgrade_none_ext()
4479 open->op_why_no_deleg = WND4_NOT_SUPP_DOWNGRADE; in nfsd4_deleg_xgrade_none_ext()
4480 } else if (open->op_deleg_want == NFS4_SHARE_WANT_WRITE_DELEG && in nfsd4_deleg_xgrade_none_ext()
4482 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT; in nfsd4_deleg_xgrade_none_ext()
4483 open->op_why_no_deleg = WND4_NOT_SUPP_UPGRADE; in nfsd4_deleg_xgrade_none_ext()
4492 nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) in nfsd4_process_open2() argument
4495 struct nfs4_client *cl = open->op_openowner->oo_owner.so_client; in nfsd4_process_open2()
4507 fp = find_or_add_file(open->op_file, ¤t_fh->fh_handle); in nfsd4_process_open2()
4508 if (fp != open->op_file) { in nfsd4_process_open2()
4509 status = nfs4_check_deleg(cl, open, &dp); in nfsd4_process_open2()
4512 stp = nfsd4_find_and_lock_existing_open(fp, open); in nfsd4_process_open2()
4514 open->op_file = NULL; in nfsd4_process_open2()
4516 if (nfsd4_is_deleg_cur(open)) in nfsd4_process_open2()
4521 stp = init_open_stateid(fp, open); in nfsd4_process_open2()
4522 if (!open->op_stp) in nfsd4_process_open2()
4534 status = nfs4_upgrade_open(rqstp, fp, current_fh, stp, open); in nfsd4_process_open2()
4540 status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp, open); in nfsd4_process_open2()
4549 open->op_odstate); in nfsd4_process_open2()
4550 if (stp->st_clnt_odstate == open->op_odstate) in nfsd4_process_open2()
4551 open->op_odstate = NULL; in nfsd4_process_open2()
4554 nfs4_inc_and_copy_stateid(&open->op_stateid, &stp->st_stid); in nfsd4_process_open2()
4558 if (open->op_deleg_want & NFS4_SHARE_WANT_NO_DELEG) { in nfsd4_process_open2()
4559 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT; in nfsd4_process_open2()
4560 open->op_why_no_deleg = WND4_NOT_WANTED; in nfsd4_process_open2()
4569 nfs4_open_delegation(current_fh, open, stp); in nfsd4_process_open2()
4577 if (open->op_delegate_type == NFS4_OPEN_DELEGATE_NONE && dp && in nfsd4_process_open2()
4578 open->op_deleg_want) in nfsd4_process_open2()
4579 nfsd4_deleg_xgrade_none_ext(open, dp); in nfsd4_process_open2()
4583 if (status == 0 && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS) in nfsd4_process_open2()
4584 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; in nfsd4_process_open2()
4588 open->op_rflags = NFS4_OPEN_RESULT_LOCKTYPE_POSIX; in nfsd4_process_open2()
4590 open->op_rflags |= NFS4_OPEN_RESULT_MAY_NOTIFY_LOCK; in nfsd4_process_open2()
4591 else if (!(open->op_openowner->oo_flags & NFS4_OO_CONFIRMED)) in nfsd4_process_open2()
4592 open->op_rflags |= NFS4_OPEN_RESULT_CONFIRM; in nfsd4_process_open2()
4603 struct nfsd4_open *open) in nfsd4_cleanup_open_state() argument
4605 if (open->op_openowner) { in nfsd4_cleanup_open_state()
4606 struct nfs4_stateowner *so = &open->op_openowner->oo_owner; in nfsd4_cleanup_open_state()
4611 if (open->op_file) in nfsd4_cleanup_open_state()
4612 kmem_cache_free(file_slab, open->op_file); in nfsd4_cleanup_open_state()
4613 if (open->op_stp) in nfsd4_cleanup_open_state()
4614 nfs4_put_stid(&open->op_stp->st_stid); in nfsd4_cleanup_open_state()
4615 if (open->op_odstate) in nfsd4_cleanup_open_state()
4616 kmem_cache_free(odstate_slab, open->op_odstate); in nfsd4_cleanup_open_state()
7227 nfsd4_set_openstateid(struct nfsd4_compound_state *cstate, struct nfsd4_open *open) in nfsd4_set_openstateid() argument
7229 put_stateid(cstate, &open->op_stateid); in nfsd4_set_openstateid()