The branch main has been updated by asomers:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=17a82e6af8e2bde543c9c2fbe3ce296d5b24ddc9

commit 17a82e6af8e2bde543c9c2fbe3ce296d5b24ddc9
Author:     Alan Somers <[email protected]>
AuthorDate: 2021-01-01 20:49:30 +0000
Commit:     Alan Somers <[email protected]>
CommitDate: 2021-01-03 18:16:20 +0000

    Fix vnode locking bug in fuse_vnop_copy_file_range
    
    MFC-With:       92bbfe1f0d1f1c4436d1f064a16e5aaf682526ba
    Reviewed by:    cem
    Differential Revision:  https://reviews.freebsd.org/D27938
---
 sys/fs/fuse/fuse_vnops.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c
index f26f96b8be99..5bbde1e278c9 100644
--- a/sys/fs/fuse/fuse_vnops.c
+++ b/sys/fs/fuse/fuse_vnops.c
@@ -664,14 +664,6 @@ fuse_vnop_copy_file_range(struct vop_copy_file_range_args 
*ap)
                td = ap->a_fsizetd;
        pid = td->td_proc->p_pid;
 
-       err = fuse_filehandle_getrw(invp, FREAD, &infufh, incred, pid);
-       if (err)
-               return (err);
-
-       err = fuse_filehandle_getrw(outvp, FWRITE, &outfufh, outcred, pid);
-       if (err)
-               return (err);
-
        /* Lock both vnodes, avoiding risk of deadlock. */
        do {
                err = vn_lock(outvp, LK_EXCLUSIVE);
@@ -690,6 +682,14 @@ fuse_vnop_copy_file_range(struct vop_copy_file_range_args 
*ap)
        if (err != 0)
                return (err);
 
+       err = fuse_filehandle_getrw(invp, FREAD, &infufh, incred, pid);
+       if (err)
+               goto unlock;
+
+       err = fuse_filehandle_getrw(outvp, FWRITE, &outfufh, outcred, pid);
+       if (err)
+               goto unlock;
+
        if (ap->a_fsizetd) {
                io.uio_offset = *ap->a_outoffp;
                io.uio_resid = *ap->a_lenp;
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to