Re: [PATCH 16/18] nfsd: switch nfsd4_create_file() to use vfs_lookup_open()

NeilBrown <[email protected]>
Newsgroups gmane.linux.nfs,gmane.linux.file-systems
Message-ID <[email protected]>
On Fri, 05 Jun 2026, Chuck Lever wrote:
> 
> On Sun, May 31, 2026, at 11:38 PM, NeilBrown wrote:
> > diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> > index 5bd19e5d9e34..61ecd4123817 100644
> > --- a/fs/nfsd/nfs4proc.c
> > +++ b/fs/nfsd/nfs4proc.c
> 
> > @@ -302,33 +302,18 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct 
> > svc_fh *fhp,
> >  		oflags |= O_RDONLY;
> >  	}
> > 
> > -	host_err = fh_want_write(fhp);
> 
> This fh_want_write() is removed, but ...
> 
> 
> > -	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)) {
> > -		status = nfserrno(PTR_ERR(child));
> > -		goto out_write;
> > -	}
> > -	path.dentry = child;
> > -
> > -	if (d_really_is_negative(child)) {
> > -		open->op_filp = dentry_create(&path, oflags, open->op_iattr.ia_mode,
> > -					      current_cred());
> > -		child = path.dentry;
> > -
> > -		if (IS_ERR(open->op_filp)) {
> > -			end_creating(child);
> > -			status = nfserrno(PTR_ERR(open->op_filp));
> > -			open->op_filp = NULL;
> > -			goto out_write;
> > -		}
> > -
> > -		open->op_created = open->op_filp->f_mode & FMODE_CREATED;
> > +	open->op_filp = vfs_lookup_open(&parent,
> > +					&QSTR_LEN(open->op_fname,
> > +						  open->op_fnamelen),
> > +					oflags,
> > +					open->op_iattr.ia_mode);
> > +	if (IS_ERR(open->op_filp)) {
> > +		status = nfserrno(PTR_ERR(open->op_filp));
> > +		open->op_filp = NULL;
> > +		goto out;
> >  	}
> > -	end_creating(child);
> > +	child = open->op_filp->f_path.dentry;
> > +	open->op_created = open->op_filp->f_mode & FMODE_CREATED;
> >  	fh_drop_write(fhp);
> 
>  ... the "matching" fh_drop_write remains. Harmless since nothing
> has set fhp->fh_want_write, but should be cleaned up.

Thanks for catching that!

NeilBrown


> 
> 
> > 
> >  	status = fh_compose(resfhp, fhp->fh_export, child, fhp);
> 
> 
> -- 
> Chuck Lever
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.