Skip to content

Commit eeec741

Browse files
neilbrownbrauner
authored andcommitted
nfsd: fix end_creating() conversion
Avoid a double-unlock as nfs_create_locked() will have unlocked the parent and do the dput() manually. Christian Brauner <brauner@kernel.org> says: I've taken Neil's proposed fix from [1] and added a commit message. Fixes: https://lore.kernel.org/202511252132.2c621407-lkp@intel.com [1] Fixes: bd6ede8 ("VFS/nfsd/cachefiles/ovl: introduce start_removing() and end_removing()") Signed-off-by: Neil Brown <neil@brown.name> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 523ac76 commit eeec741

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

fs/nfsd/nfsproc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,9 @@ nfsd_proc_create(struct svc_rqst *rqstp)
407407
/* File doesn't exist. Create it and set attrs */
408408
resp->status = nfsd_create_locked(rqstp, dirfhp, &attrs, type,
409409
rdev, newfhp);
410+
/* nfsd_create_locked() unlocked the parent */
411+
dput(dchild);
412+
goto out_write;
410413
} else if (type == S_IFREG) {
411414
dprintk("nfsd: existing %s, valid=%x, size=%ld\n",
412415
argp->name, attr->ia_valid, (long) attr->ia_size);

fs/nfsd/vfs.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,16 +1633,14 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
16331633
return nfserrno(host_err);
16341634

16351635
err = fh_compose(resfhp, fhp->fh_export, dchild, fhp);
1636-
/*
1637-
* We unconditionally drop our ref to dchild as fh_compose will have
1638-
* already grabbed its own ref for it.
1639-
*/
16401636
if (err)
16411637
goto out_unlock;
16421638
err = fh_fill_pre_attrs(fhp);
16431639
if (err != nfs_ok)
16441640
goto out_unlock;
16451641
err = nfsd_create_locked(rqstp, fhp, attrs, type, rdev, resfhp);
1642+
/* nfsd_create_locked() unlocked the parent */
1643+
dput(dchild);
16461644
return err;
16471645

16481646
out_unlock:

0 commit comments

Comments
 (0)