Lines Matching refs:open

108  * the refcount on the open stateid to drop.
544 find_openstateowner_str(unsigned int hashval, struct nfsd4_open *open,
555 if (same_owner_str(so, &open->op_owner))
692 /* hash tables for lock and open owners */
730 * new_stp: normal open, not open upgrade.
848 * Allocate a new open/delegation state counter. This is needed for
1708 * All nfs4 states (open, lock, delegation, layout) held by the server instance
2780 seq_puts(s, ": { type: open, ");
2830 * (Same for the matter is true of open stateids.)
2834 /* XXX: open stateid? */
2964 .open = client_states_open,
4757 nfsd4_find_existing_open(struct nfs4_file *fp, struct nfsd4_open *open)
4760 struct nfs4_openowner *oo = open->op_openowner;
4870 nfsd4_find_and_lock_existing_open(struct nfs4_file *fp, struct nfsd4_open *open)
4875 stp = nfsd4_find_existing_open(fp, open);
4885 find_or_alloc_open_stateowner(unsigned int strhashval, struct nfsd4_open *open,
4893 oo = find_openstateowner_str(strhashval, open, clp);
4912 new = alloc_stateowner(openowner_slab, &open->op_owner, clp);
4917 new->oo_owner.so_seqid = open->op_seqid;
4928 init_open_stateid(struct nfs4_file *fp, struct nfsd4_open *open)
4931 struct nfs4_openowner *oo = open->op_openowner;
4935 stp = open->op_stp;
4944 retstp = nfsd4_find_existing_open(fp, open);
4948 open->op_stp = NULL;
5194 * Race: client probably got cb_recall before open reply
5355 struct nfsd4_open *open, struct nfsd_net *nn)
5357 clientid_t *clientid = &open->op_clientid;
5367 open->op_file = nfsd4_alloc_file();
5368 if (open->op_file == NULL)
5376 strhashval = ownerstr_hashval(&open->op_owner);
5378 oo = find_or_alloc_open_stateowner(strhashval, open, cstate);
5379 open->op_openowner = oo;
5386 status = nfsd4_check_seqid(cstate, &oo->oo_owner, open->op_seqid);
5390 open->op_stp = nfs4_alloc_open_stateid(clp);
5391 if (!open->op_stp)
5396 open->op_odstate = alloc_clnt_odstate(clp);
5397 if (!open->op_odstate)
5429 static bool nfsd4_is_deleg_cur(struct nfsd4_open *open)
5431 return open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR ||
5432 open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH;
5436 nfs4_check_deleg(struct nfs4_client *cl, struct nfsd4_open *open,
5443 deleg = find_deleg_stateid(cl, &open->op_delegate_stateid);
5453 nfsd40_drop_revoked_stid(cl, &open->op_delegate_stateid);
5457 flags = share_access_to_flags(open->op_share_access);
5465 if (!nfsd4_is_deleg_cur(open))
5469 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
5486 struct nfsd4_open *open)
5495 if (!open->op_truncate)
5497 if (!(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))
5504 struct nfsd4_open *open, bool new_stp)
5508 int oflag = nfs4_access_to_omode(open->op_share_access);
5509 int access = nfs4_access_to_access(open->op_share_access);
5518 status = nfs4_file_check_deny(fp, open->op_share_deny);
5525 stp, open->op_share_deny, false))
5532 status = nfs4_file_get_access(fp, open->op_share_access);
5539 stp, open->op_share_access, true))
5547 set_access(open->op_share_access, stp);
5551 set_deny(open->op_share_deny, stp);
5552 fp->fi_share_deny |= (open->op_share_deny & NFS4_SHARE_DENY_BOTH);
5558 open->op_filp, &nf);
5577 status = nfsd4_truncate(rqstp, cur_fh, open);
5584 nfs4_file_put_access(fp, open->op_share_access);
5592 struct nfsd4_open *open)
5597 if (!test_access(open->op_share_access, stp))
5598 return nfs4_get_vfs_file(rqstp, fp, cur_fh, stp, open, false);
5602 status = nfs4_file_check_deny(fp, open->op_share_deny);
5605 set_deny(open->op_share_deny, stp);
5607 (open->op_share_deny & NFS4_SHARE_DENY_BOTH);
5611 stp, open->op_share_deny, false))
5620 status = nfsd4_truncate(rqstp, cur_fh, open);
5698 if (st->st_openstp == NULL /* it's an open */ &&
5708 * NFSv4 open. However, any open that hasn't added itself to
5721 nfsd4_verify_deleg_dentry(struct nfsd4_open *open, struct nfs4_file *fp,
5728 err = nfsd_lookup_dentry(open->op_rqstp, parent,
5729 open->op_fname, open->op_fnamelen,
5747 * on setuid/setgid files when the client is requesting an open for write.
5750 nfsd4_verify_setuid_write(struct nfsd4_open *open, struct nfsd_file *nf)
5754 if ((open->op_share_access & NFS4_SHARE_ACCESS_WRITE) &&
5761 nfs4_set_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,
5790 * Offer a write delegation in the case of a BOTH open, and ensure
5793 if ((open->op_share_access & NFS4_SHARE_ACCESS_BOTH) == NFS4_SHARE_ACCESS_BOTH) {
5802 if (!nf && (open->op_share_access & NFS4_SHARE_ACCESS_READ)) {
5814 else if (nfsd4_verify_setuid_write(open, nf))
5848 status = nfsd4_verify_deleg_dentry(open, fp, parent);
5861 status = nfsd4_verify_setuid_write(open, fp->fi_deleg_file);
5891 static void nfsd4_open_deleg_none_ext(struct nfsd4_open *open, int status)
5893 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
5895 open->op_why_no_deleg = WND4_CONTENTION;
5897 open->op_why_no_deleg = WND4_RESOURCE;
5898 switch (open->op_deleg_want) {
5904 open->op_why_no_deleg = WND4_CANCELLED;
5934 * open or lock state.
5937 nfs4_open_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,
5950 open->op_recall = false;
5951 switch (open->op_claim_type) {
5954 open->op_recall = true;
5969 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE &&
5976 dp = nfs4_set_delegation(open, stp, parent);
5980 memcpy(&open->op_delegate_stateid, &dp->dl_stid.sc_stateid, sizeof(dp->dl_stid.sc_stateid));
5982 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) {
5983 open->op_delegate_type = NFS4_OPEN_DELEGATE_WRITE;
5998 open->op_delegate_type = NFS4_OPEN_DELEGATE_READ;
6004 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE;
6005 if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS &&
6006 open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE) {
6008 open->op_recall = true;
6012 if (open->op_deleg_want)
6013 nfsd4_open_deleg_none_ext(open, status);
6017 static void nfsd4_deleg_xgrade_none_ext(struct nfsd4_open *open,
6020 if (open->op_deleg_want == NFS4_SHARE_WANT_READ_DELEG &&
6022 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
6023 open->op_why_no_deleg = WND4_NOT_SUPP_DOWNGRADE;
6024 } else if (open->op_deleg_want == NFS4_SHARE_WANT_WRITE_DELEG &&
6026 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
6027 open->op_why_no_deleg = WND4_NOT_SUPP_UPGRADE;
6036 * nfsd4_process_open2 - finish open processing
6039 * @open: OPEN arguments
6041 * If successful, (1) truncate the file if open->op_truncate was
6042 * set, (2) set open->op_stateid, (3) set open->op_delegation.
6048 nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
6051 struct nfs4_client *cl = open->op_openowner->oo_owner.so_client;
6059 * Lookup file; if found, lookup stateid and check open request,
6063 fp = nfsd4_file_hash_insert(open->op_file, current_fh);
6066 if (fp != open->op_file) {
6067 status = nfs4_check_deleg(cl, open, &dp);
6070 stp = nfsd4_find_and_lock_existing_open(fp, open);
6072 open->op_file = NULL;
6074 if (nfsd4_is_deleg_cur(open))
6079 stp = init_open_stateid(fp, open);
6080 if (!open->op_stp)
6092 status = nfs4_upgrade_open(rqstp, fp, current_fh, stp, open);
6098 status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp, open, true);
6106 open->op_odstate);
6107 if (stp->st_clnt_odstate == open->op_odstate)
6108 open->op_odstate = NULL;
6111 nfs4_inc_and_copy_stateid(&open->op_stateid, &stp->st_stid);
6115 if (open->op_deleg_want & NFS4_SHARE_WANT_NO_DELEG) {
6116 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
6117 open->op_why_no_deleg = WND4_NOT_WANTED;
6126 nfs4_open_delegation(open, stp, &resp->cstate.current_fh);
6132 if (open->op_delegate_type == NFS4_OPEN_DELEGATE_NONE && dp &&
6133 open->op_deleg_want)
6134 nfsd4_deleg_xgrade_none_ext(open, dp);
6138 if (status == 0 && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)
6139 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
6141 * To finish the open response, we just need to set the rflags.
6143 open->op_rflags = NFS4_OPEN_RESULT_LOCKTYPE_POSIX;
6145 open->op_rflags |= NFS4_OPEN_RESULT_MAY_NOTIFY_LOCK;
6146 else if (!(open->op_openowner->oo_flags & NFS4_OO_CONFIRMED))
6147 open->op_rflags |= NFS4_OPEN_RESULT_CONFIRM;
6158 struct nfsd4_open *open)
6160 if (open->op_openowner)
6161 nfs4_put_stateowner(&open->op_openowner->oo_owner);
6162 if (open->op_file)
6163 kmem_cache_free(file_slab, open->op_file);
6164 if (open->op_stp)
6165 nfs4_put_stid(&open->op_stp->st_stid);
6166 if (open->op_odstate)
6167 kmem_cache_free(odstate_slab, open->op_odstate);
6677 /* For lock stateid's, we test the parent open, not the lock: */
7909 /* validate and update open stateid and open seqid */
8111 * so we do a temporary open here just to get an open file to pass to
8498 * Since the lifetime of a delegation isn't limited to that of an open, a
8735 put_stateid(cstate, &u->open.op_stateid);