[PATCH 07/18] nfsd: move fh_want_write() after preamble in nfsd4_create_file()
NeilBrown <[email protected]>
| Newsgroups | gmane.linux.file-systems,gmane.linux.nfs |
|---|---|
| Message-ID | <[email protected]> |
From: NeilBrown <[email protected]> As part of separating the nfsd-specific code from the VFS interaction code in nfsd4_create_file(), move fh_want_write() to just before we need it. Also restructure the "if" statement in that preamble to only test is_create_with_attrs() once. Signed-off-by: NeilBrown <[email protected]> --- fs/nfsd/nfs4proc.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index f642be31b239..5235db3d6a96 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -270,22 +270,18 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, parent = fhp->fh_dentry; inode = d_inode(parent); - host_err = fh_want_write(fhp); - if (host_err) - return nfserrno(host_err); - - if (open->op_acl) { + if (!is_create_with_attrs(open)) { + /* No attrs to check */ + } else if (open->op_acl) { if (open->op_dpacl || open->op_pacl) { - status = nfserr_inval; - goto out; + /* Cannot specify both NFSv4 and Posix ACLs */ + return nfserr_inval; } - if (is_create_with_attrs(open)) { - status = nfsd4_acl_to_attr(NF4REG, open->op_acl, + status = nfsd4_acl_to_attr(NF4REG, open->op_acl, &attrs); - if (status) - goto out; - } - } else if (is_create_with_attrs(open)) { + if (status) + goto out; + } else { /* The dpacl and pacl will get released by nfsd_attrs_free(). */ attrs.na_dpacl = open->op_dpacl; attrs.na_pacl = open->op_pacl; @@ -293,6 +289,10 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, open->op_pacl = NULL; } + host_err = fh_want_write(fhp); + if (host_err) + return nfserrno(host_err); + child = start_creating(&nop_mnt_idmap, parent, &QSTR_LEN(open->op_fname, open->op_fnamelen)); if (IS_ERR(child)) { -- 2.50.0.107.gf914562f5916.dirty