From owner-svn-src-all@freebsd.org Tue Aug 4 23:09:16 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A6CB3A2CFD; Tue, 4 Aug 2020 23:09:16 +0000 (UTC) (envelope-from mjg@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BLr6h29myz41g4; Tue, 4 Aug 2020 23:09:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E105CDA6; Tue, 4 Aug 2020 23:09:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 074N9Gcx027103; Tue, 4 Aug 2020 23:09:16 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 074N9Gao027102; Tue, 4 Aug 2020 23:09:16 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008042309.074N9Gao027102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 4 Aug 2020 23:09:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r363875 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 363875 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2020 23:09:16 -0000 Author: mjg Date: Tue Aug 4 23:09:15 2020 New Revision: 363875 URL: https://svnweb.freebsd.org/changeset/base/363875 Log: ufs: only pass LK_ADAPTIVE if LK_NODDLKTREAT is set This restores the pre-adaptive spinning state for SU which livelocks otherwise. Note this is a bug in SU. Reported by: pho Modified: head/sys/ufs/ffs/ffs_vnops.c Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Tue Aug 4 23:07:42 2020 (r363874) +++ head/sys/ufs/ffs/ffs_vnops.c Tue Aug 4 23:09:15 2020 (r363875) @@ -445,7 +445,13 @@ ffs_lock(ap) struct lock *lkp; int result; - ap->a_flags |= LK_ADAPTIVE; + /* + * Adaptive spinning mixed with SU leads to trouble. use a giant hammer + * and only use it when LK_NODDLKTREAT is set. Currently this means it + * is only used during path lookup. + */ + if ((ap->a_flags & LK_NODDLKTREAT) != 0) + ap->a_flags |= LK_ADAPTIVE; switch (ap->a_flags & LK_TYPE_MASK) { case LK_SHARED: case LK_UPGRADE: @@ -483,7 +489,11 @@ ffs_lock(ap) } return (result); #else - ap->a_flags |= LK_ADAPTIVE; + /* + * See above for an explanation. + */ + if ((ap->a_flags & LK_NODDLKTREAT) != 0) + ap->a_flags |= LK_ADAPTIVE; return (VOP_LOCK1_APV(&ufs_vnodeops, ap)); #endif }