Merge tag 'iommu-fix-v6.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/joro...
[platform/kernel/linux-starfive.git] / fs / nfsd / vfs.c
index 48260cf..02f5fca 100644 (file)
@@ -1788,6 +1788,12 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
        if (!flen || isdotent(fname, flen) || !tlen || isdotent(tname, tlen))
                goto out;
 
+       err = (rqstp->rq_vers == 2) ? nfserr_acces : nfserr_xdev;
+       if (ffhp->fh_export->ex_path.mnt != tfhp->fh_export->ex_path.mnt)
+               goto out;
+       if (ffhp->fh_export->ex_path.dentry != tfhp->fh_export->ex_path.dentry)
+               goto out;
+
 retry:
        host_err = fh_want_write(ffhp);
        if (host_err) {
@@ -1823,12 +1829,6 @@ retry:
        if (ndentry == trap)
                goto out_dput_new;
 
-       host_err = -EXDEV;
-       if (ffhp->fh_export->ex_path.mnt != tfhp->fh_export->ex_path.mnt)
-               goto out_dput_new;
-       if (ffhp->fh_export->ex_path.dentry != tfhp->fh_export->ex_path.dentry)
-               goto out_dput_new;
-
        if ((ndentry->d_sb->s_export_op->flags & EXPORT_OP_CLOSE_BEFORE_UNLINK) &&
            nfsd_has_cached_files(ndentry)) {
                close_cached = true;