From nobody Mon Jan 31 02:46:57 2022 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 31F4E197F75B; Mon, 31 Jan 2022 02:46:59 +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 4JnCBp2g73z3FHQ; Mon, 31 Jan 2022 02:46:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643597219; 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=bS4wPD6Exv+uWgAdB3zxCeNa+939ltvccVL5Cpc2do8=; b=du4euhleCFQ0vUFfylthP9YFekwmAnVYQ/jbgHq9cSGJJkhhTX8jib1/Rx+SRFlZkPgJJX L8duOLnjnhHGohBLDxl/l62kzJyuqJW6i2Gag4Dj4mpq3Swi7WXEdgwgYNcFQ70nYOiboC phWOaeI7Dtu5n305hFTJ83VTCgMRLN3HxL6JEc4IC+egWu6dFkjA7uBuSZQ4Cq/tlo86Yp pIAY5dqZ7+Bv0Gj7u6sv3MZ0XmP2BzJzd7pax4DI5KXbcFZS8lL2+3P4whmWB0piRbxXc0 r7ySjOMjtW6xMfe6ew1JjgHxbMkR1Ko9Qw4Sb+xAcno5Yr8wPAb+7bN20z+4rg== 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 075B914A80; Mon, 31 Jan 2022 02:46:58 +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 20V2kvUR009139; Mon, 31 Jan 2022 02:46:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20V2kv3R009138; Mon, 31 Jan 2022 02:46:57 GMT (envelope-from git) Date: Mon, 31 Jan 2022 02:46:57 GMT Message-Id: <202201310246.20V2kv3R009138@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 4559700a0a99 - main - ffs_snapblkfree(): add a comment explaining lockmgr invocation 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/main X-Git-Reftype: branch X-Git-Commit: 4559700a0a99376640a8913d08bdf0cfb0124d4a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643597219; 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=bS4wPD6Exv+uWgAdB3zxCeNa+939ltvccVL5Cpc2do8=; b=gSlV0LSmu015/IM1uJrOos7Dyq5NDRG48FdYJBQLhyrYPWwAWw5lSF62esPDaiyzi7Niz2 aTwekgBAgoGmOoUIb6eB5nKND2Qde/Ttq85aV4JlAeg/d6hxx9Roe2KO758VVTajzgDq2e Ow0Qctbn9sjAyco0glmoLuJeTyWxp0wWpilaMTCKBY5AXbUJbNVDMzp9RanSswNWmD+NJT fZNpiIGVsCSrSfQvvmn004dCX1uQINEOYvsbRVwnxwrPRcryDzjUayPxGJiMY3WiaCFvz/ yi0FgeOgljkXRcc18xJfoShAzQ/cSoX7B9zrZCXi1AlIL2aLPXC1Zp3PN8Q5NQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643597219; a=rsa-sha256; cv=none; b=rRTF+CpYiHVujMNFrtU2tym4ZjvtgzomSbxoHaucJgC/OL09INLxLLRgjnPyIuXgBxrXqD aw0MEY/ANhWPmYDNE7WUd8xcqavDNw4A3z13QQG3pT+wfSZB7h6YWuswLIdRkJkflFIeWD DeWoO4F3F0pHa0ShY5wHNpe8+/rgGb1gJ/xoCVf5YJ7VJPKgbL4sYLr1qbg7gMgIGKIA32 a0rTdzfcT0NzplUuQuL5cyg2Tdo3ZEh0XaoW2yh85ZKEyKCOQ+NSjtELLjXq78pHm7qLpo 62gdlmW8YT5yCwENwezQgXvaRuDSIogt9ydkg4m10VX9sR3GOxexwzJDVrPBKg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4559700a0a99376640a8913d08bdf0cfb0124d4a commit 4559700a0a99376640a8913d08bdf0cfb0124d4a Author: Konstantin Belousov AuthorDate: 2022-01-23 00:33:18 +0000 Commit: Konstantin Belousov CommitDate: 2022-01-31 02:46:21 +0000 ffs_snapblkfree(): add a comment explaining lockmgr invocation Reviewed by: markj, mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D34072 --- sys/ufs/ffs/ffs_snapshot.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index 1257ee8f8f4f..6cda327c8fcd 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -1800,9 +1800,15 @@ retry: VI_UNLOCK(devvp); return (0); } + + /* + * Use LK_SLEEPFAIL because sn might be freed under us while + * both devvp interlock and snaplk are not owned. + */ if (lockmgr(&sn->sn_lock, LK_INTERLOCK | LK_EXCLUSIVE | LK_SLEEPFAIL, VI_MTX(devvp)) != 0) goto retry; + TAILQ_FOREACH(ip, &sn->sn_head, i_nextsnap) { vp = ITOV(ip); if (DOINGSOFTDEP(vp))