Lines Matching refs:open

69 		 * XXX: We should really fail the whole open, but we may
121 struct nfsd4_compound_state *cstate, struct nfsd4_open *open)
125 if (open->op_create == NFS4_OPEN_CREATE) {
126 if (open->op_createmode == NFS4_CREATE_UNCHECKED
127 || open->op_createmode == NFS4_CREATE_GUARDED)
129 open->op_bmval, nfsd_attrmask);
130 else if (open->op_createmode == NFS4_CREATE_EXCLUSIVE4_1)
132 open->op_bmval, nfsd41_ex_attrmask);
139 is_create_with_attrs(struct nfsd4_open *open)
141 return open->op_create == NFS4_OPEN_CREATE
142 && (open->op_createmode == NFS4_CREATE_UNCHECKED
143 || open->op_createmode == NFS4_CREATE_GUARDED
144 || open->op_createmode == NFS4_CREATE_EXCLUSIVE4_1);
160 * We should probably fail the whole open at this point,
178 do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode)
182 if (open->op_truncate &&
183 !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))
188 if (open->op_share_access & NFS4_SHARE_ACCESS_READ)
190 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
192 if (open->op_share_deny & NFS4_SHARE_DENY_READ)
212 * the right thing on attempts to open something other than a
218 static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh *resfh)
222 fh_copy_shallow(&open->op_openowner->oo_owner.so_replay.rp_openfh,
227 do_open_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh **resfh)
237 open->op_truncate = false;
239 if (open->op_create) {
259 current->fs->umask = open->op_umask;
260 status = do_nfsd_create(rqstp, current_fh, open->op_fname.data,
261 open->op_fname.len, &open->op_iattr,
262 *resfh, open->op_createmode,
263 (u32 *)open->op_verf.data,
264 &open->op_truncate, &open->op_created);
267 if (!status && open->op_label.len)
268 nfsd4_security_inode_setsecctx(*resfh, &open->op_label, open->op_bmval);
275 if (nfsd_create_is_exclusive(open->op_createmode) && status == 0)
276 open->op_bmval[1] |= (FATTR4_WORD1_TIME_ACCESS |
286 open->op_fname.data, open->op_fname.len, *resfh);
293 if (is_create_with_attrs(open) && open->op_acl != NULL)
294 do_set_nfs4_acl(rqstp, *resfh, open->op_acl, open->op_bmval);
296 nfsd4_set_open_owner_reply_cache(cstate, open, *resfh);
298 if (open->op_created ||
299 open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR)
301 status = do_open_permission(rqstp, *resfh, open, accmode);
302 set_change_info(&open->op_cinfo, current_fh);
308 do_open_fhandle(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_open *open)
318 memset(&open->op_cinfo, 0, sizeof(struct nfsd4_change_info));
320 nfsd4_set_open_owner_reply_cache(cstate, open, current_fh);
322 open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) &&
323 (open->op_iattr.ia_size == 0);
326 * open that it *already* performed locally, some time ago. We
329 * In the case of a CLAIM_FH open, on the other hand, the client
333 if (open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH)
336 status = do_open_permission(rqstp, current_fh, open, accmode);
355 struct nfsd4_open *open = &u->open;
363 (int)open->op_fname.len, open->op_fname.data,
364 open->op_openowner);
367 if (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL)
370 open->op_created = false;
378 open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS)
382 copy_clientid(&open->op_clientid, cstate->session);
385 status = nfsd4_process_open1(cstate, open, nn);
387 struct nfs4_replay *rp = &open->op_openowner->oo_owner.so_replay;
400 if (open->op_xdr_error) {
401 status = open->op_xdr_error;
405 status = nfsd4_check_open_attributes(rqstp, cstate, open);
412 if (opens_in_grace(net) && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS)
415 if (!opens_in_grace(net) && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)
418 switch (open->op_claim_type) {
421 status = do_open_lookup(rqstp, cstate, open, &resfh);
426 status = nfs4_check_open_reclaim(&open->op_clientid,
430 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
435 status = do_open_fhandle(rqstp, cstate, open);
443 open->op_claim_type);
448 open->op_claim_type);
454 * successful, it (1) truncates the file if open->op_truncate was
455 * set, (2) sets open->op_stateid, (3) sets open->op_delegation.
457 status = nfsd4_process_open2(rqstp, resfh, open);
458 WARN(status && open->op_created,
459 "nfsd4_process_open2 failed to open newly-created file! status=%u\n",
469 nfsd4_cleanup_open_state(cstate, open);
482 struct nfsd4_open *open = &op->u.open;
488 open->op_xdr_error = op->status;