From nobody Sun Dec 11 03:48:55 2022 X-Original-To: dev-commits-src-main@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 4NV9jM2ll2z4kM72; Sun, 11 Dec 2022 03:48:55 +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 4NV9jM1s1jz3LWC; Sun, 11 Dec 2022 03:48:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1670730535; 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=WszPfEJ0TZjTI3jVmZA2xcBpyJg09uxVBx+XyyBDWI0=; b=HiOA+Be3WCR7LBkjPTVQeZ4leXhh4uBwZDAC4Ot/jNCcF/Z92o0bO+Tn34ihtLzm3DxBns rchgwjUoC3ZyZtUCORlOd5ekU5liON6W2iaMU2nwrDaMglqnHqnrIOWuT69NMbE2RXpe+f 1bUATI/qjGls3s3cs7tKP18EcCpyrKeiHuAyvXV7l8EmQjN7kj0EdtU3JQAhLX27qL/FiI Ic79jhMDKJyXj5PKNfNoOCRE+TZgx1NRORYN1aTeVX4WAd+nV25o3RNTRjJvsi+KkG40UQ tYam+XO6W6+NMv3ueCkBgnNf8fFexuh37fbChbRSbWDUKUQq3PM7NpbOZF0rDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1670730535; 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=WszPfEJ0TZjTI3jVmZA2xcBpyJg09uxVBx+XyyBDWI0=; b=LzWTgtp1vp7HrY1bOo3n/lmpJTLyP6A373tfjNBxFLxHh74DF1KLpBrIhIflvhRHUhqPQ2 XZY0XsU8NelK7xMifvh+hDkwgYZAyYvkPVPRsbJWKn+NsNIriYTk7INaZg1iHZVJL8U4JI I+k+UBn4r/5eaRX6C6I9RBl1N7uB2xxkmYabuVvk4r0fVnvP7MZ3nc2iubAUVEBFMAH4fU cTAlGhRQnAemuwwgtbGRjM3mqWlgLp6njyvcNwCe5AH4R5uDJXw12ei+u0VaIvfD79r8P4 OqBH6MLBhFQikZ2qJ1gmnbh0CDnYs8KsEEFLQMh+hKHol4m/bHETLyL7sY0chw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1670730535; a=rsa-sha256; cv=none; b=Py/+Jx3yxiQ5Ah1IQHebfSPOsED2gypZ3n08NA5L1WyxwwzlGiQ8nYePeiVXzaKD/OgIuL LD8Cy1gjmKyzCmv9FsbKUB6PFEUObOkLJ41MgrR6pMKDQzqSx9xZ33teHUC9NBCnADUw7C +FKQREv2IZzfxO0GnyHvjeGicUf28L9h9QZCLSOkCpfGCgaUQZfO+2awPXBmRkwyP8S9V3 /rRqigz17cwm0N6LOAyU2V0Jiht2aLS/ataEOOLCT1DTqykKfmGDAUcerMLXAkEn3ty4DQ gl7AoV8e8iWbCEZHUbl6Tn2l1tjGN1GgIcdrecQ6Xemfv69zUyclnrEXdUE+/A== 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 4NV9jM0wN2zghG; Sun, 11 Dec 2022 03:48:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2BB3mtOP076799; Sun, 11 Dec 2022 03:48:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BB3mteV076798; Sun, 11 Dec 2022 03:48:55 GMT (envelope-from git) Date: Sun, 11 Dec 2022 03:48:55 GMT Message-Id: <202212110348.2BB3mteV076798@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: 5cec725cd32a - main - unionfs: allow recursion on covered vnode lock during mount/unmount List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5cec725cd32a7a2fbe3e4b55d0e25850164b9b0c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=5cec725cd32a7a2fbe3e4b55d0e25850164b9b0c commit 5cec725cd32a7a2fbe3e4b55d0e25850164b9b0c Author: Jason A. Harmening AuthorDate: 2022-11-20 18:25:46 +0000 Commit: Jason A. Harmening CommitDate: 2022-12-11 04:02:38 +0000 unionfs: allow recursion on covered vnode lock during mount/unmount When taking the covered vnode lock during mount and unmount operations, specify LK_CANRECURSE as the existing lock state of the covered vnode is not guaranteed (AFAIK) either by assertion or documentation for these code paths. For the mount path, this is done only for completeness as the covered vnode lock is not currently held when VFS_MOUNT() is called. For the unmount path, the covered vnode is currently held across VFS_UNMOUNT(), and the existing code only happens to work when unionfs is mounted atop FFS because FFS sets LO_RECURSABLE on its vnode locks. This of course doesn't cover a hypothetical case in which the covered vnode may be held shared, but for the mount and unmount paths such a scenario seems unlikely to materialize. Reviewed by: kib Tested by: pho Differential Revision: https://reviews.freebsd.org/D37458 --- sys/fs/unionfs/union_vfsops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index c6d668606ec9..8831397c8c5b 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -329,7 +329,7 @@ unionfs_domount(struct mount *mp) * order unionfs currently requires. */ if (!below) { - vn_lock(mp->mnt_vnodecovered, LK_EXCLUSIVE | LK_RETRY); + vn_lock(mp->mnt_vnodecovered, LK_EXCLUSIVE | LK_RETRY | LK_CANRECURSE); mp->mnt_vnodecovered->v_vflag |= VV_CROSSLOCK; VOP_UNLOCK(mp->mnt_vnodecovered); } @@ -386,7 +386,7 @@ unionfs_unmount(struct mount *mp, int mntflags) if (error) return (error); - vn_lock(mp->mnt_vnodecovered, LK_EXCLUSIVE | LK_RETRY); + vn_lock(mp->mnt_vnodecovered, LK_EXCLUSIVE | LK_RETRY | LK_CANRECURSE); mp->mnt_vnodecovered->v_vflag &= ~VV_CROSSLOCK; VOP_UNLOCK(mp->mnt_vnodecovered); vfs_unregister_upper(ump->um_lowervp->v_mount, &ump->um_lower_link);