Lines Matching full:open
67 * XXX: We should really fail the whole open, but we may in nfsd4_security_inode_setsecctx()
119 struct nfsd4_compound_state *cstate, struct nfsd4_open *open) in nfsd4_check_open_attributes() argument
123 if (open->op_create == NFS4_OPEN_CREATE) { in nfsd4_check_open_attributes()
124 if (open->op_createmode == NFS4_CREATE_UNCHECKED in nfsd4_check_open_attributes()
125 || open->op_createmode == NFS4_CREATE_GUARDED) in nfsd4_check_open_attributes()
127 open->op_bmval, nfsd_attrmask); in nfsd4_check_open_attributes()
128 else if (open->op_createmode == NFS4_CREATE_EXCLUSIVE4_1) in nfsd4_check_open_attributes()
130 open->op_bmval, nfsd41_ex_attrmask); in nfsd4_check_open_attributes()
137 is_create_with_attrs(struct nfsd4_open *open) in is_create_with_attrs() argument
139 return open->op_create == NFS4_OPEN_CREATE in is_create_with_attrs()
140 && (open->op_createmode == NFS4_CREATE_UNCHECKED in is_create_with_attrs()
141 || open->op_createmode == NFS4_CREATE_GUARDED in is_create_with_attrs()
142 || open->op_createmode == NFS4_CREATE_EXCLUSIVE4_1); in is_create_with_attrs()
158 * We should probably fail the whole open at this point, in do_set_nfs4_acl()
176 do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int … in do_open_permission() argument
180 if (open->op_truncate && in do_open_permission()
181 !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE)) in do_open_permission()
186 if (open->op_share_access & NFS4_SHARE_ACCESS_READ) in do_open_permission()
188 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) in do_open_permission()
190 if (open->op_share_deny & NFS4_SHARE_DENY_READ) in do_open_permission()
210 * the right thing on attempts to open something other than a in nfsd_check_obj_isreg()
216 …owner_reply_cache(struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh *res… in nfsd4_set_open_owner_reply_cache() argument
220 fh_copy_shallow(&open->op_openowner->oo_owner.so_replay.rp_openfh, in nfsd4_set_open_owner_reply_cache()
225 do_open_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_open *open… in do_open_lookup() argument
235 open->op_truncate = 0; in do_open_lookup()
237 if (open->op_create) { in do_open_lookup()
257 current->fs->umask = open->op_umask; in do_open_lookup()
258 status = do_nfsd_create(rqstp, current_fh, open->op_fname.data, in do_open_lookup()
259 open->op_fname.len, &open->op_iattr, in do_open_lookup()
260 *resfh, open->op_createmode, in do_open_lookup()
261 (u32 *)open->op_verf.data, in do_open_lookup()
262 &open->op_truncate, &open->op_created); in do_open_lookup()
265 if (!status && open->op_label.len) in do_open_lookup()
266 nfsd4_security_inode_setsecctx(*resfh, &open->op_label, open->op_bmval); in do_open_lookup()
273 if (nfsd_create_is_exclusive(open->op_createmode) && status == 0) in do_open_lookup()
274 open->op_bmval[1] |= (FATTR4_WORD1_TIME_ACCESS | in do_open_lookup()
284 open->op_fname.data, open->op_fname.len, *resfh); in do_open_lookup()
291 if (is_create_with_attrs(open) && open->op_acl != NULL) in do_open_lookup()
292 do_set_nfs4_acl(rqstp, *resfh, open->op_acl, open->op_bmval); in do_open_lookup()
294 nfsd4_set_open_owner_reply_cache(cstate, open, *resfh); in do_open_lookup()
296 if (open->op_created || in do_open_lookup()
297 open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR) in do_open_lookup()
299 status = do_open_permission(rqstp, *resfh, open, accmode); in do_open_lookup()
300 set_change_info(&open->op_cinfo, current_fh); in do_open_lookup()
306 …_open_fhandle(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_open *open) in do_open_fhandle() argument
316 memset(&open->op_cinfo, 0, sizeof(struct nfsd4_change_info)); in do_open_fhandle()
318 nfsd4_set_open_owner_reply_cache(cstate, open, current_fh); in do_open_fhandle()
320 open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) && in do_open_fhandle()
321 (open->op_iattr.ia_size == 0); in do_open_fhandle()
324 * open that it *already* performed locally, some time ago. We in do_open_fhandle()
327 * In the case of a CLAIM_FH open, on the other hand, the client in do_open_fhandle()
331 if (open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH) in do_open_fhandle()
334 status = do_open_permission(rqstp, current_fh, open, accmode); in do_open_fhandle()
353 struct nfsd4_open *open = &u->open; in nfsd4_open() local
361 (int)open->op_fname.len, open->op_fname.data, in nfsd4_open()
362 open->op_openowner); in nfsd4_open()
365 if (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL) in nfsd4_open()
368 open->op_created = 0; in nfsd4_open()
376 open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS) in nfsd4_open()
380 copy_clientid(&open->op_clientid, cstate->session); in nfsd4_open()
383 status = nfsd4_process_open1(cstate, open, nn); in nfsd4_open()
385 struct nfs4_replay *rp = &open->op_openowner->oo_owner.so_replay; in nfsd4_open()
398 if (open->op_xdr_error) { in nfsd4_open()
399 status = open->op_xdr_error; in nfsd4_open()
403 status = nfsd4_check_open_attributes(rqstp, cstate, open); in nfsd4_open()
410 if (opens_in_grace(net) && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS) in nfsd4_open()
413 if (!opens_in_grace(net) && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS) in nfsd4_open()
416 switch (open->op_claim_type) { in nfsd4_open()
419 status = do_open_lookup(rqstp, cstate, open, &resfh); in nfsd4_open()
424 status = nfs4_check_open_reclaim(&open->op_clientid, in nfsd4_open()
428 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; in nfsd4_open()
433 status = do_open_fhandle(rqstp, cstate, open); in nfsd4_open()
440 dprintk("NFSD: unsupported OPEN claim type %d\n", in nfsd4_open()
441 open->op_claim_type); in nfsd4_open()
445 dprintk("NFSD: Invalid OPEN claim type %d\n", in nfsd4_open()
446 open->op_claim_type); in nfsd4_open()
452 * successful, it (1) truncates the file if open->op_truncate was in nfsd4_open()
453 * set, (2) sets open->op_stateid, (3) sets open->op_delegation. in nfsd4_open()
455 status = nfsd4_process_open2(rqstp, resfh, open); in nfsd4_open()
456 WARN(status && open->op_created, in nfsd4_open()
457 "nfsd4_process_open2 failed to open newly-created file! status=%u\n", in nfsd4_open()
467 nfsd4_cleanup_open_state(cstate, open); in nfsd4_open()
473 * OPEN is the only seqid-mutating operation whose decoding can fail
480 struct nfsd4_open *open = &op->u.open; in nfsd4_open_omfg() local
486 open->op_xdr_error = op->status; in nfsd4_open_omfg()