Skip to content

Commit

Permalink
nfsd: Fix error cleanup path in nfsd_rename()
Browse files Browse the repository at this point in the history
Commit a8b0026 ("rename(): avoid a deadlock in the case of parents
having no common ancestor") added an error bail out path. However this
path does not drop the remount protection that has been acquired. Fix
the cleanup path to properly drop the remount protection.

Fixes: a8b0026 ("rename(): avoid a deadlock in the case of parents having no common ancestor")
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
  • Loading branch information
Jan Kara authored and Chuck Lever committed Mar 22, 2024
1 parent 9b350d3 commit 9fe6e9e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/nfsd/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
trap = lock_rename(tdentry, fdentry);
if (IS_ERR(trap)) {
err = (rqstp->rq_vers == 2) ? nfserr_acces : nfserr_xdev;
goto out;
goto out_want_write;
}
err = fh_fill_pre_attrs(ffhp);
if (err != nfs_ok)
Expand Down Expand Up @@ -1923,6 +1923,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
}
out_unlock:
unlock_rename(tdentry, fdentry);
out_want_write:
fh_drop_write(ffhp);

/*
Expand Down

0 comments on commit 9fe6e9e

Please sign in to comment.