Lines Matching refs:open

105 	struct nfsd4_compound_state *cstate, struct nfsd4_open *open)
109 if (open->op_create == NFS4_OPEN_CREATE) {
110 if (open->op_createmode == NFS4_CREATE_UNCHECKED
111 || open->op_createmode == NFS4_CREATE_GUARDED)
113 open->op_bmval, nfsd_attrmask);
114 else if (open->op_createmode == NFS4_CREATE_EXCLUSIVE4_1)
116 open->op_bmval, nfsd41_ex_attrmask);
123 is_create_with_attrs(struct nfsd4_open *open)
125 return open->op_create == NFS4_OPEN_CREATE
126 && (open->op_createmode == NFS4_CREATE_UNCHECKED
127 || open->op_createmode == NFS4_CREATE_GUARDED
128 || open->op_createmode == NFS4_CREATE_EXCLUSIVE4_1);
142 do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode)
145 if (open->op_truncate &&
146 !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))
151 if (open->op_share_access & NFS4_SHARE_ACCESS_READ)
153 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
155 if (open->op_share_deny & NFS4_SHARE_DENY_READ)
173 * the right thing on attempts to open something other than a
179 static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh *resfh)
183 fh_copy_shallow(&open->op_openowner->oo_owner.so_replay.rp_openfh,
195 struct nfsd4_open *open)
202 switch (open->op_share_access & NFS4_SHARE_ACCESS_BOTH) {
215 filp = dentry_create(&path, oflags, open->op_iattr.ia_mode,
220 open->op_filp = filp;
233 struct svc_fh *resfhp, struct nfsd4_open *open)
235 struct iattr *iap = &open->op_iattr;
238 .na_seclabel = &open->op_label,
246 if (isdotent(open->op_fname, open->op_fnamelen))
261 if (is_create_with_attrs(open))
262 nfsd4_acl_to_attr(NF4REG, open->op_acl, &attrs);
266 child = lookup_one_len(open->op_fname, parent, open->op_fnamelen);
284 if (nfsd4_create_is_exclusive(open->op_createmode)) {
285 u32 *verifier = (u32 *)open->op_verf.data;
307 switch (open->op_createmode) {
318 open->op_truncate = (iap->ia_valid & ATTR_SIZE) &&
328 open->op_created = true;
337 open->op_created = true;
351 status = nfsd4_vfs_create(fhp, child, open);
354 open->op_created = true;
360 if (nfsd4_create_is_exclusive(open->op_createmode)) {
373 open->op_bmval[2] &= ~FATTR4_WORD2_SECURITY_LABEL;
375 open->op_bmval[0] &= ~FATTR4_WORD0_ACL;
418 do_open_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh **resfh)
428 open->op_truncate = false;
430 if (open->op_create) {
446 current->fs->umask = open->op_umask;
447 status = nfsd4_create_file(rqstp, current_fh, *resfh, open);
455 if (nfsd4_create_is_exclusive(open->op_createmode) && status == 0)
456 open->op_bmval[1] |= (FATTR4_WORD1_TIME_ACCESS |
460 open->op_fname, open->op_fnamelen, *resfh);
473 nfsd4_set_open_owner_reply_cache(cstate, open, *resfh);
475 if (open->op_created ||
476 open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR)
478 status = do_open_permission(rqstp, *resfh, open, accmode);
479 set_change_info(&open->op_cinfo, current_fh);
485 do_open_fhandle(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_open *open)
494 memset(&open->op_cinfo, 0, sizeof(struct nfsd4_change_info));
496 nfsd4_set_open_owner_reply_cache(cstate, open, current_fh);
498 open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) &&
499 (open->op_iattr.ia_size == 0);
502 * open that it *already* performed locally, some time ago. We
505 * In the case of a CLAIM_FH open, on the other hand, the client
509 if (open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH)
512 return do_open_permission(rqstp, current_fh, open, accmode);
529 struct nfsd4_open *open = &u->open;
537 (int)open->op_fnamelen, open->op_fname,
538 open->op_openowner);
540 open->op_filp = NULL;
541 open->op_rqstp = rqstp;
544 if (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL)
547 open->op_created = false;
554 open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS)
558 copy_clientid(&open->op_clientid, cstate->session);
561 status = nfsd4_process_open1(cstate, open, nn);
563 struct nfs4_replay *rp = &open->op_openowner->oo_owner.so_replay;
576 if (open->op_xdr_error) {
577 status = open->op_xdr_error;
581 status = nfsd4_check_open_attributes(rqstp, cstate, open);
588 if (opens_in_grace(net) && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS)
591 if (!opens_in_grace(net) && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)
594 switch (open->op_claim_type) {
597 status = do_open_lookup(rqstp, cstate, open, &resfh);
605 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
610 status = do_open_fhandle(rqstp, cstate, open);
624 status = nfsd4_process_open2(rqstp, resfh, open);
625 if (status && open->op_created)
626 pr_warn("nfsd4_process_open2 failed to open newly-created file: status=%u\n",
631 if (open->op_filp) {
632 fput(open->op_filp);
633 open->op_filp = NULL;
640 nfsd4_cleanup_open_state(cstate, open);
653 struct nfsd4_open *open = &op->u.open;
659 open->op_xdr_error = op->status;