Lines Matching defs:open

102  * the refcount on the open stateid to drop.
371 find_openstateowner_str_locked(unsigned int hashval, struct nfsd4_open *open,
382 if (same_owner_str(so, &open->op_owner))
389 find_openstateowner_str(unsigned int hashval, struct nfsd4_open *open,
395 oo = find_openstateowner_str_locked(hashval, open, clp);
539 /* hash tables for lock and open owners */
645 * Allocate a new open/delegation state counter. This is needed for
2396 .open = client_info_open,
2484 seq_printf(s, ": { type: open, ");
2530 * (Same for the matter is true of open stateids.)
2534 /* XXX: open stateid? */
2654 .open = client_states_open,
4258 nfsd4_find_existing_open(struct nfs4_file *fp, struct nfsd4_open *open)
4261 struct nfs4_openowner *oo = open->op_openowner;
4313 nfsd4_find_and_lock_existing_open(struct nfs4_file *fp, struct nfsd4_open *open)
4318 stp = nfsd4_find_existing_open(fp, open);
4328 alloc_init_open_stateowner(unsigned int strhashval, struct nfsd4_open *open,
4334 oo = alloc_stateowner(openowner_slab, &open->op_owner, clp);
4339 oo->oo_owner.so_seqid = open->op_seqid;
4347 ret = find_openstateowner_str_locked(strhashval, open, clp);
4359 init_open_stateid(struct nfs4_file *fp, struct nfsd4_open *open)
4362 struct nfs4_openowner *oo = open->op_openowner;
4366 stp = open->op_stp;
4375 retstp = nfsd4_find_existing_open(fp, open);
4379 open->op_stp = NULL;
4564 * Race: client probably got cb_recall before open reply
4717 struct nfsd4_open *open, struct nfsd_net *nn)
4719 clientid_t *clientid = &open->op_clientid;
4725 if (STALE_CLIENTID(&open->op_clientid, nn))
4731 open->op_file = nfsd4_alloc_file();
4732 if (open->op_file == NULL)
4740 strhashval = ownerstr_hashval(&open->op_owner);
4741 oo = find_openstateowner_str(strhashval, open, clp);
4742 open->op_openowner = oo;
4749 open->op_openowner = NULL;
4752 status = nfsd4_check_seqid(cstate, &oo->oo_owner, open->op_seqid);
4757 oo = alloc_init_open_stateowner(strhashval, open, cstate);
4760 open->op_openowner = oo;
4762 open->op_stp = nfs4_alloc_open_stateid(clp);
4763 if (!open->op_stp)
4768 open->op_odstate = alloc_clnt_odstate(clp);
4769 if (!open->op_odstate)
4801 static bool nfsd4_is_deleg_cur(struct nfsd4_open *open)
4803 return open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR ||
4804 open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH;
4808 nfs4_check_deleg(struct nfs4_client *cl, struct nfsd4_open *open,
4815 deleg = find_deleg_stateid(cl, &open->op_delegate_stateid);
4824 flags = share_access_to_flags(open->op_share_access);
4832 if (!nfsd4_is_deleg_cur(open))
4836 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
4853 struct nfsd4_open *open)
4859 if (!open->op_truncate)
4861 if (!(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))
4868 struct nfsd4_open *open)
4872 int oflag = nfs4_access_to_omode(open->op_share_access);
4873 int access = nfs4_access_to_access(open->op_share_access);
4882 status = nfs4_file_check_deny(fp, open->op_share_deny);
4889 status = nfs4_file_get_access(fp, open->op_share_access);
4897 set_access(open->op_share_access, stp);
4901 set_deny(open->op_share_deny, stp);
4902 fp->fi_share_deny |= (open->op_share_deny & NFS4_SHARE_DENY_BOTH);
4924 status = nfsd4_truncate(rqstp, cur_fh, open);
4931 nfs4_file_put_access(fp, open->op_share_access);
4937 nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp, struct svc_fh *cur_fh, struct nfs4_ol_stateid *stp, struct nfsd4_open *open)
4942 if (!test_access(open->op_share_access, stp))
4943 return nfs4_get_vfs_file(rqstp, fp, cur_fh, stp, open);
4947 status = nfs4_file_check_deny(fp, open->op_share_deny);
4949 set_deny(open->op_share_deny, stp);
4951 (open->op_share_deny & NFS4_SHARE_DENY_BOTH);
4958 status = nfsd4_truncate(rqstp, cur_fh, open);
5075 static void nfsd4_open_deleg_none_ext(struct nfsd4_open *open, int status)
5077 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
5079 open->op_why_no_deleg = WND4_CONTENTION;
5081 open->op_why_no_deleg = WND4_RESOURCE;
5082 switch (open->op_deleg_want) {
5088 open->op_why_no_deleg = WND4_CANCELLED;
5103 nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open,
5113 open->op_recall = 0;
5114 switch (open->op_claim_type) {
5117 open->op_recall = 1;
5118 if (open->op_delegate_type != NFS4_OPEN_DELEGATE_READ)
5139 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
5141 if (open->op_create == NFS4_OPEN_CREATE)
5151 memcpy(&open->op_delegate_stateid, &dp->dl_stid.sc_stateid, sizeof(dp->dl_stid.sc_stateid));
5154 open->op_delegate_type = NFS4_OPEN_DELEGATE_READ;
5158 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE;
5159 if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS &&
5160 open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE) {
5162 open->op_recall = 1;
5166 if (open->op_deleg_want)
5167 nfsd4_open_deleg_none_ext(open, status);
5171 static void nfsd4_deleg_xgrade_none_ext(struct nfsd4_open *open,
5174 if (open->op_deleg_want == NFS4_SHARE_WANT_READ_DELEG &&
5176 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
5177 open->op_why_no_deleg = WND4_NOT_SUPP_DOWNGRADE;
5178 } else if (open->op_deleg_want == NFS4_SHARE_WANT_WRITE_DELEG &&
5180 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
5181 open->op_why_no_deleg = WND4_NOT_SUPP_UPGRADE;
5190 nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
5193 struct nfs4_client *cl = open->op_openowner->oo_owner.so_client;
5201 * Lookup file; if found, lookup stateid and check open request,
5205 fp = find_or_add_file(open->op_file, &current_fh->fh_handle);
5206 if (fp != open->op_file) {
5207 status = nfs4_check_deleg(cl, open, &dp);
5210 stp = nfsd4_find_and_lock_existing_open(fp, open);
5212 open->op_file = NULL;
5214 if (nfsd4_is_deleg_cur(open))
5219 stp = init_open_stateid(fp, open);
5220 if (!open->op_stp)
5232 status = nfs4_upgrade_open(rqstp, fp, current_fh, stp, open);
5238 status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp, open);
5247 open->op_odstate);
5248 if (stp->st_clnt_odstate == open->op_odstate)
5249 open->op_odstate = NULL;
5252 nfs4_inc_and_copy_stateid(&open->op_stateid, &stp->st_stid);
5256 if (open->op_deleg_want & NFS4_SHARE_WANT_NO_DELEG) {
5257 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
5258 open->op_why_no_deleg = WND4_NOT_WANTED;
5267 nfs4_open_delegation(current_fh, open, stp);
5273 if (open->op_delegate_type == NFS4_OPEN_DELEGATE_NONE && dp &&
5274 open->op_deleg_want)
5275 nfsd4_deleg_xgrade_none_ext(open, dp);
5279 if (status == 0 && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)
5280 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
5282 * To finish the open response, we just need to set the rflags.
5284 open->op_rflags = NFS4_OPEN_RESULT_LOCKTYPE_POSIX;
5286 open->op_rflags |= NFS4_OPEN_RESULT_MAY_NOTIFY_LOCK;
5287 else if (!(open->op_openowner->oo_flags & NFS4_OO_CONFIRMED))
5288 open->op_rflags |= NFS4_OPEN_RESULT_CONFIRM;
5299 struct nfsd4_open *open)
5301 if (open->op_openowner) {
5302 struct nfs4_stateowner *so = &open->op_openowner->oo_owner;
5307 if (open->op_file)
5308 kmem_cache_free(file_slab, open->op_file);
5309 if (open->op_stp)
5310 nfs4_put_stid(&open->op_stp->st_stid);
5311 if (open->op_odstate)
5312 kmem_cache_free(odstate_slab, open->op_odstate);
5564 /* For lock stateid's, we test the parent open, not the lock: */
6729 /* validate and update open stateid and open seqid */
6900 * so we do a temporary open here just to get an open file to pass to
7284 * Since the lifetime of a delegation isn't limited to that of an open, a
7513 put_stateid(cstate, &u->open.op_stateid);