mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 08:15:07 -04:00
nfsd: unify cleanups in nfsd_cross_mnt() exits
Instead of having a separate path_put() on each failure exit, as well as on the normal path, let's move all of those past the point where these codepaths join. We want to keep the ordering between path_put() and exp_put(), so move that one as well. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Jeff Layton <jlayton@kernel.org> Link: https://patch.msgid.link/20260602-nfsd-testing-v2-9-e4ea62e3cd5c@kernel.org Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
@@ -137,20 +137,19 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
|
||||
follow_flags = LOOKUP_AUTOMOUNT;
|
||||
|
||||
err = follow_down(&path, follow_flags);
|
||||
if (err < 0) {
|
||||
path_put(&path);
|
||||
if (err < 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (path.mnt == exp->ex_path.mnt && path.dentry == dentry &&
|
||||
nfsd_mountpoint(dentry, exp) == 2) {
|
||||
/* This is only a mountpoint in some other namespace */
|
||||
path_put(&path);
|
||||
goto out;
|
||||
}
|
||||
|
||||
exp2 = rqst_exp_get_by_name(rqstp, &path);
|
||||
if (IS_ERR(exp2)) {
|
||||
err = PTR_ERR(exp2);
|
||||
exp2 = NULL;
|
||||
/*
|
||||
* We normally allow NFS clients to continue
|
||||
* "underneath" a mountpoint that is not exported.
|
||||
@@ -160,10 +159,7 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
|
||||
*/
|
||||
if (err == -ENOENT && !(exp->ex_flags & NFSEXP_V4ROOT))
|
||||
err = 0;
|
||||
path_put(&path);
|
||||
goto out;
|
||||
}
|
||||
if (nfsd_v4client(rqstp) ||
|
||||
} else if (nfsd_v4client(rqstp) ||
|
||||
(exp->ex_flags & NFSEXP_CROSSMOUNT) || EX_NOHIDE(exp2)) {
|
||||
/* successfully crossed mount point */
|
||||
/*
|
||||
@@ -177,9 +173,10 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
|
||||
*expp = exp2;
|
||||
exp2 = exp;
|
||||
}
|
||||
path_put(&path);
|
||||
exp_put(exp2);
|
||||
out:
|
||||
path_put(&path);
|
||||
if (exp2)
|
||||
exp_put(exp2);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user