[PATCH 07/10] nfsd: reduce range of directory lock in nfsd4_create_file()
NeilBrown <[email protected]>
| Newsgroups | gmane.linux.nfs |
|---|---|
| Message-ID | <[email protected]> |
From: NeilBrown <neil-+NVA1uvv1dVBDLzU/[email protected]> We only need to hold the lock taken by start_creating() until the create has been attempted. Holding for longer can serve no purpose. The lock is currently held across the setattr call. This might be the intent but it serves no purpose. Holding the lock prevents the name from being removed or renamed, but it doesn't prevent a GETATTR or a racing SETATTR or an OPEN. Signed-off-by: NeilBrown <neil-+NVA1uvv1dVBDLzU/[email protected]> --- fs/nfsd/nfs4proc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 4f730ac83cf8..9dfdeb6dc379 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -331,10 +331,11 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, if (d_really_is_negative(child)) { status = nfsd4_vfs_create(fhp, &child, open); - if (status != nfs_ok) - goto out; open->op_created = open->op_filp->f_mode & FMODE_CREATED; } + end_creating(child); + if (status != nfs_ok) + goto out; status = fh_compose(resfhp, fhp->fh_export, child, fhp); if (status != nfs_ok) @@ -387,7 +388,6 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, open->op_bmval[2] &= ~FATTR4_WORD2_POSIX_ACCESS_ACL; } out: - end_creating(child); fh_drop_write(fhp); out_free: nfsd_attrs_free(&attrs); -- 2.50.0.107.gf914562f5916.dirty