From nobody Mon Nov 20 01:41:44 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SYVbr5ztgz51gWK; Mon, 20 Nov 2023 01:41:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SYVbr59b0z4GLB; Mon, 20 Nov 2023 01:41:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700444504; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JCbK3pRCHynAnCz+0tsCWtWAxvZiVAV0BcG0wAssUG0=; b=WYGcPg0Xxgsakkm3GIbJJd0MxLl7clAQEJkj8NXwirmsd00qjQGWhLfREuQJZEUjxOnLsf ihYZdmpFDxJblC63YawZhM2iYKNgPePf7PlDy1l/WZHSbdm0w7RTigsot8ywkMTyMlJNXO ARpv5MjNWyc7ASaSGkR1C2u3a0Iiyt5ykeyKWINVoST5bDt6g64AzTYATmoRODbUJUqr8T z65jO7PZTWsWYP5OeD5+pdaCmUdjVxU8B873MRXTwDrgND3i9cuxPfxVSM7YsTD6IdGhya CbdEGHDluG8AHAlRcr1h8BO6yBz7sKE6Apd26P/IwfRIyKmQsl/OPN96qkP1IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700444504; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JCbK3pRCHynAnCz+0tsCWtWAxvZiVAV0BcG0wAssUG0=; b=rdsfJwwQ1aWXc5tHZ7Z5iXfGnI5PjW75v8dk1CkJ17pTGH+Yx2upY6V2AKhq8oMPla7FiI P9XoRa9SOfgJUdAICZePI1P0AqXahZsTrvWSZnTIPalC9zsefTbgb91hiQMh0VVnTY9DzH F82BmORLNu6SRNBXpChVGeSCCEC/uHMYzrXBsTaKBZYYhG8hEMgJ1NW5oBoR2S37utk+EN mMNEx3Kiqjs2I2rrA4+7dHiYY6nTGD1oIm5RI1EOAuDP18yOakH8Q4kiOJ7ZpzoY85Qu+1 CDF1bgDtVwDz9HPXSzHZusi0RGu7OkgtOyUAgpdtUH6122YDzuhGnZbL9cklzg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700444504; a=rsa-sha256; cv=none; b=T5DGnSZDolgBrKVRtjq5tawlWZD8Ch2HfbNRM73+gdGcHyiajkv/oqmsilProN2Hr7lak1 uuJAHYuBqeu22dov2EHhzfbknIVgdvmhb8pVQ5S+1eghegzg4W0Xg/NyW01SLGEouNcWiQ JJ3c/tEzHyKEWrf3CxW19e2/GtoDczQSyFA2dtZ9GHvSDdCurM8lci3Uc9O61zcdC1BB8A Y8IUD5f8NWOcssKqTddjqB/r8zykwePGzqduFk6l76Wml2xV4KPxN4N5/wMCRfP6qo6VhE wn2YP3Lx/lDj3RV7TmGwPam9K5y4kq05XsM0l+rlnKLcNYQGeD00V0aPaHrmpQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SYVbr4C54zYjd; Mon, 20 Nov 2023 01:41:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3AK1fiLd050852; Mon, 20 Nov 2023 01:41:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AK1fioZ050849; Mon, 20 Nov 2023 01:41:44 GMT (envelope-from git) Date: Mon, 20 Nov 2023 01:41:44 GMT Message-Id: <202311200141.3AK1fioZ050849@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 11f0b96a9745 - stable/13 - vn_copy_file_range(): busy both in and out mp around call to VOP_COPY_FILE_RANGE() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 11f0b96a974513628d4b8d2257d921fca4b9c5cf Auto-Submitted: auto-generated The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=11f0b96a974513628d4b8d2257d921fca4b9c5cf commit 11f0b96a974513628d4b8d2257d921fca4b9c5cf Author: Konstantin Belousov AuthorDate: 2023-11-12 18:37:29 +0000 Commit: Konstantin Belousov CommitDate: 2023-11-20 01:40:34 +0000 vn_copy_file_range(): busy both in and out mp around call to VOP_COPY_FILE_RANGE() (cherry picked from commit 23210f538a008788b2e16b9eddafa4f598a21663) --- sys/kern/vfs_vnops.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 5194d708f250..7af4df16252c 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -3058,6 +3058,29 @@ vn_copy_file_range(struct vnode *invp, off_t *inoffp, struct vnode *outvp, inmp = invp->v_mount; outmp = outvp->v_mount; + if (inmp == NULL || outmp == NULL) { + error = EBADF; + goto out; + } + + for (;;) { + error = vfs_busy(inmp, 0); + if (error != 0) + goto out; + if (inmp == outmp) + break; + error = vfs_busy(outmp, MBF_NOWAIT); + if (error != 0) { + vfs_unbusy(inmp); + error = vfs_busy(outmp, 0); + if (error == 0) { + vfs_unbusy(outmp); + continue; + } + goto out; + } + break; + } /* * If the two vnode are for the same file system, call @@ -3071,6 +3094,9 @@ vn_copy_file_range(struct vnode *invp, off_t *inoffp, struct vnode *outvp, else error = vn_generic_copy_file_range(invp, inoffp, outvp, outoffp, lenp, flags, incred, outcred, fsize_td); + vfs_unbusy(outmp); + if (inmp != outmp) + vfs_unbusy(inmp); out: return (error); }