Lines Matching refs:open
107 * the refcount on the open stateid to drop.
542 find_openstateowner_str_locked(unsigned int hashval, struct nfsd4_open *open,
553 if (same_owner_str(so, &open->op_owner))
560 find_openstateowner_str(unsigned int hashval, struct nfsd4_open *open,
566 oo = find_openstateowner_str_locked(hashval, open, clp);
702 /* hash tables for lock and open owners */
740 * new_stp: normal open, not open upgrade.
858 * Allocate a new open/delegation state counter. This is needed for
2634 seq_printf(s, ": { type: open, ");
2680 * (Same for the matter is true of open stateids.)
2684 /* XXX: open stateid? */
2804 .open = client_states_open,
4520 nfsd4_find_existing_open(struct nfs4_file *fp, struct nfsd4_open *open)
4523 struct nfs4_openowner *oo = open->op_openowner;
4575 nfsd4_find_and_lock_existing_open(struct nfs4_file *fp, struct nfsd4_open *open)
4580 stp = nfsd4_find_existing_open(fp, open);
4590 alloc_init_open_stateowner(unsigned int strhashval, struct nfsd4_open *open,
4596 oo = alloc_stateowner(openowner_slab, &open->op_owner, clp);
4601 oo->oo_owner.so_seqid = open->op_seqid;
4609 ret = find_openstateowner_str_locked(strhashval, open, clp);
4621 init_open_stateid(struct nfs4_file *fp, struct nfsd4_open *open)
4624 struct nfs4_openowner *oo = open->op_openowner;
4628 stp = open->op_stp;
4637 retstp = nfsd4_find_existing_open(fp, open);
4641 open->op_stp = NULL;
4883 * Race: client probably got cb_recall before open reply
5044 struct nfsd4_open *open, struct nfsd_net *nn)
5046 clientid_t *clientid = &open->op_clientid;
5056 open->op_file = nfsd4_alloc_file();
5057 if (open->op_file == NULL)
5065 strhashval = ownerstr_hashval(&open->op_owner);
5066 oo = find_openstateowner_str(strhashval, open, clp);
5067 open->op_openowner = oo;
5074 open->op_openowner = NULL;
5077 status = nfsd4_check_seqid(cstate, &oo->oo_owner, open->op_seqid);
5082 oo = alloc_init_open_stateowner(strhashval, open, cstate);
5085 open->op_openowner = oo;
5087 open->op_stp = nfs4_alloc_open_stateid(clp);
5088 if (!open->op_stp)
5093 open->op_odstate = alloc_clnt_odstate(clp);
5094 if (!open->op_odstate)
5126 static bool nfsd4_is_deleg_cur(struct nfsd4_open *open)
5128 return open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR ||
5129 open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH;
5133 nfs4_check_deleg(struct nfs4_client *cl, struct nfsd4_open *open,
5140 deleg = find_deleg_stateid(cl, &open->op_delegate_stateid);
5149 flags = share_access_to_flags(open->op_share_access);
5157 if (!nfsd4_is_deleg_cur(open))
5161 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
5178 struct nfsd4_open *open)
5187 if (!open->op_truncate)
5189 if (!(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))
5196 struct nfsd4_open *open, bool new_stp)
5200 int oflag = nfs4_access_to_omode(open->op_share_access);
5201 int access = nfs4_access_to_access(open->op_share_access);
5210 status = nfs4_file_check_deny(fp, open->op_share_deny);
5217 stp, open->op_share_deny, false))
5224 status = nfs4_file_get_access(fp, open->op_share_access);
5231 stp, open->op_share_access, true))
5239 set_access(open->op_share_access, stp);
5243 set_deny(open->op_share_deny, stp);
5244 fp->fi_share_deny |= (open->op_share_deny & NFS4_SHARE_DENY_BOTH);
5250 open->op_filp, &nf);
5269 status = nfsd4_truncate(rqstp, cur_fh, open);
5276 nfs4_file_put_access(fp, open->op_share_access);
5284 struct nfsd4_open *open)
5289 if (!test_access(open->op_share_access, stp))
5290 return nfs4_get_vfs_file(rqstp, fp, cur_fh, stp, open, false);
5294 status = nfs4_file_check_deny(fp, open->op_share_deny);
5297 set_deny(open->op_share_deny, stp);
5299 (open->op_share_deny & NFS4_SHARE_DENY_BOTH);
5303 stp, open->op_share_deny, false))
5312 status = nfsd4_truncate(rqstp, cur_fh, open);
5391 if (st->st_openstp == NULL /* it's an open */ &&
5401 * NFSv4 open. However, any open that hasn't added itself to
5414 nfsd4_verify_deleg_dentry(struct nfsd4_open *open, struct nfs4_file *fp,
5421 err = nfsd_lookup_dentry(open->op_rqstp, parent,
5422 open->op_fname, open->op_fnamelen,
5440 * on setuid/setgid files when the client is requesting an open for write.
5443 nfsd4_verify_setuid_write(struct nfsd4_open *open, struct nfsd_file *nf)
5447 if ((open->op_share_access & NFS4_SHARE_ACCESS_WRITE) &&
5454 nfs4_set_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,
5483 * Offer a write delegation in the case of a BOTH open, and ensure
5486 if ((open->op_share_access & NFS4_SHARE_ACCESS_BOTH) == NFS4_SHARE_ACCESS_BOTH) {
5495 if (!nf && (open->op_share_access & NFS4_SHARE_ACCESS_READ)) {
5507 else if (nfsd4_verify_setuid_write(open, nf))
5540 status = nfsd4_verify_deleg_dentry(open, fp, parent);
5553 status = nfsd4_verify_setuid_write(open, fp->fi_deleg_file);
5581 static void nfsd4_open_deleg_none_ext(struct nfsd4_open *open, int status)
5583 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
5585 open->op_why_no_deleg = WND4_CONTENTION;
5587 open->op_why_no_deleg = WND4_RESOURCE;
5588 switch (open->op_deleg_want) {
5594 open->op_why_no_deleg = WND4_CANCELLED;
5624 * open or lock state.
5627 nfs4_open_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,
5638 open->op_recall = 0;
5639 switch (open->op_claim_type) {
5642 open->op_recall = 1;
5657 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE &&
5664 dp = nfs4_set_delegation(open, stp, parent);
5668 memcpy(&open->op_delegate_stateid, &dp->dl_stid.sc_stateid, sizeof(dp->dl_stid.sc_stateid));
5670 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) {
5671 open->op_delegate_type = NFS4_OPEN_DELEGATE_WRITE;
5674 open->op_delegate_type = NFS4_OPEN_DELEGATE_READ;
5680 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE;
5681 if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS &&
5682 open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE) {
5684 open->op_recall = 1;
5688 if (open->op_deleg_want)
5689 nfsd4_open_deleg_none_ext(open, status);
5693 static void nfsd4_deleg_xgrade_none_ext(struct nfsd4_open *open,
5696 if (open->op_deleg_want == NFS4_SHARE_WANT_READ_DELEG &&
5698 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
5699 open->op_why_no_deleg = WND4_NOT_SUPP_DOWNGRADE;
5700 } else if (open->op_deleg_want == NFS4_SHARE_WANT_WRITE_DELEG &&
5702 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
5703 open->op_why_no_deleg = WND4_NOT_SUPP_UPGRADE;
5712 * nfsd4_process_open2 - finish open processing
5715 * @open: OPEN arguments
5717 * If successful, (1) truncate the file if open->op_truncate was
5718 * set, (2) set open->op_stateid, (3) set open->op_delegation.
5724 nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
5727 struct nfs4_client *cl = open->op_openowner->oo_owner.so_client;
5735 * Lookup file; if found, lookup stateid and check open request,
5739 fp = nfsd4_file_hash_insert(open->op_file, current_fh);
5742 if (fp != open->op_file) {
5743 status = nfs4_check_deleg(cl, open, &dp);
5746 stp = nfsd4_find_and_lock_existing_open(fp, open);
5748 open->op_file = NULL;
5750 if (nfsd4_is_deleg_cur(open))
5755 stp = init_open_stateid(fp, open);
5756 if (!open->op_stp)
5768 status = nfs4_upgrade_open(rqstp, fp, current_fh, stp, open);
5774 status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp, open, true);
5783 open->op_odstate);
5784 if (stp->st_clnt_odstate == open->op_odstate)
5785 open->op_odstate = NULL;
5788 nfs4_inc_and_copy_stateid(&open->op_stateid, &stp->st_stid);
5792 if (open->op_deleg_want & NFS4_SHARE_WANT_NO_DELEG) {
5793 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
5794 open->op_why_no_deleg = WND4_NOT_WANTED;
5803 nfs4_open_delegation(open, stp, &resp->cstate.current_fh);
5809 if (open->op_delegate_type == NFS4_OPEN_DELEGATE_NONE && dp &&
5810 open->op_deleg_want)
5811 nfsd4_deleg_xgrade_none_ext(open, dp);
5815 if (status == 0 && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)
5816 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
5818 * To finish the open response, we just need to set the rflags.
5820 open->op_rflags = NFS4_OPEN_RESULT_LOCKTYPE_POSIX;
5822 open->op_rflags |= NFS4_OPEN_RESULT_MAY_NOTIFY_LOCK;
5823 else if (!(open->op_openowner->oo_flags & NFS4_OO_CONFIRMED))
5824 open->op_rflags |= NFS4_OPEN_RESULT_CONFIRM;
5835 struct nfsd4_open *open)
5837 if (open->op_openowner) {
5838 struct nfs4_stateowner *so = &open->op_openowner->oo_owner;
5843 if (open->op_file)
5844 kmem_cache_free(file_slab, open->op_file);
5845 if (open->op_stp)
5846 nfs4_put_stid(&open->op_stp->st_stid);
5847 if (open->op_odstate)
5848 kmem_cache_free(odstate_slab, open->op_odstate);
6315 /* For lock stateid's, we test the parent open, not the lock: */
7518 /* validate and update open stateid and open seqid */
7709 * so we do a temporary open here just to get an open file to pass to
8088 * Since the lifetime of a delegation isn't limited to that of an open, a
8328 put_stateid(cstate, &u->open.op_stateid);