Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3291360pxk; Mon, 21 Sep 2020 09:50:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwg4ggmo6ugPwi/DmGjpm+G2Ga17Kb+L5yTerzU2c+sNOEy8ibANgroXb2HVRHDLsukKPjm X-Received: by 2002:a17:907:7206:: with SMTP id dr6mr358040ejc.546.1600707042883; Mon, 21 Sep 2020 09:50:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600707042; cv=none; d=google.com; s=arc-20160816; b=FO7Sk4THXuv481+q66Dxe4Og/+c4ajneGzI59wmx53oXUZHISskUHyZeMJ1bKCcEzJ ax0AQAKt8tjEykQaWJE2pePx9JeAyILstC0vuHaaSK8+CnVBtU3Y138UWNA6evLrzByM 5ZEi4+flDKrZeSHmnpwzzVSDo2u0Gsi3O3kd3qJu+z3iqYHv4QOImgg6/0ZghD3o1bp/ JBf0xaGnBhjQwVtrmw7wWGdfbei7Av+6ZD8EtUFa6i2cOzCwGQ1pLxEYBKxwRLFRoh/L DghQbRqGoME050YeKNgQFFdbgqQjS29UxaYc6/1e7LNfrThCRj0oRNwzOwe57Bamk15Q 1V9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pt7WbSsa+TDWKdDH+Zit7rnDtRcO1VEexvL4D5k6gQs=; b=Trr/TC0MCc/eEYXFwXuoNNbk9D4uJhmSRmmsJdoVjMxvrc3ZXAnN+2/ciUlIQfjiqj V8pbEPdNKFR0lL2OTCfrOrXT/S+V4DV+dQAYDaps4oPgIkeVbrwppjw+EtIXN8X2OK06 lUgEW+ZhupB6LWJhNvlDXuImYjmjYpdO9j+pJY16R7CPwlwhI7DWYnVCsTgaMABNaS4F 26xuu+dMXhd5c3dJvc4Rh3n9vueodhYjNLcQs6pZN7qT2m6dvrkWhZcw+lLHd6kHPGB6 R4pRm4jef7POVjxVghqgZu2I7uGDsPQrN9FaqfrRTeK6ZAq+9herv0tAZ9MQng/KseoF 3lkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=y8u6n7Ln; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c24si8703520edw.144.2020.09.21.09.50.18; Mon, 21 Sep 2020 09:50:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=y8u6n7Ln; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729704AbgIUQrT (ORCPT + 99 others); Mon, 21 Sep 2020 12:47:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:54016 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728100AbgIUQrR (ORCPT ); Mon, 21 Sep 2020 12:47:17 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0AE7E2389F; Mon, 21 Sep 2020 16:47:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706836; bh=gVPWHHVsRgwOVX6wf9/4LT+JI3nRH5Pmckx3O+v6esA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y8u6n7LnxusZnG902U6w1b17tnyNJlo4LKMWZeqg7fhpzti5s8RODVWTuZjotm1jM D8kDyxbRIDcKEwSx/o9UrpjhgX4NI+70TquvdNdSRmzflRMuZ6MKUfIdBfMgqBjsEO JXzpm7HxlZYwld7KBUldluhR7LCFahixjV2Sjo3A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Alasdair Kergon , Mike Snitzer , Adrian Huang , Ira Weiny , Dan Williams Subject: [PATCH 5.8 113/118] dm/dax: Fix table reference counts Date: Mon, 21 Sep 2020 18:28:45 +0200 Message-Id: <20200921162041.637820805@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162036.324813383@linuxfoundation.org> References: <20200921162036.324813383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Williams commit 02186d8897d49b0afd3c80b6cf23437d91024065 upstream. A recent fix to the dm_dax_supported() flow uncovered a latent bug. When dm_get_live_table() fails it is still required to drop the srcu_read_lock(). Without this change the lvm2 test-suite triggers this warning: # lvm2-testsuite --only pvmove-abort-all.sh WARNING: lock held when returning to user space! 5.9.0-rc5+ #251 Tainted: G OE ------------------------------------------------ lvm/1318 is leaving the kernel with locks still held! 1 lock held by lvm/1318: #0: ffff9372abb5a340 (&md->io_barrier){....}-{0:0}, at: dm_get_live_table+0x5/0xb0 [dm_mod] ...and later on this hang signature: INFO: task lvm:1344 blocked for more than 122 seconds. Tainted: G OE 5.9.0-rc5+ #251 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:lvm state:D stack: 0 pid: 1344 ppid: 1 flags:0x00004000 Call Trace: __schedule+0x45f/0xa80 ? finish_task_switch+0x249/0x2c0 ? wait_for_completion+0x86/0x110 schedule+0x5f/0xd0 schedule_timeout+0x212/0x2a0 ? __schedule+0x467/0xa80 ? wait_for_completion+0x86/0x110 wait_for_completion+0xb0/0x110 __synchronize_srcu+0xd1/0x160 ? __bpf_trace_rcu_utilization+0x10/0x10 __dm_suspend+0x6d/0x210 [dm_mod] dm_suspend+0xf6/0x140 [dm_mod] Fixes: 7bf7eac8d648 ("dax: Arrange for dax_supported check to span multiple devices") Cc: Cc: Jan Kara Cc: Alasdair Kergon Cc: Mike Snitzer Reported-by: Adrian Huang Reviewed-by: Ira Weiny Tested-by: Adrian Huang Link: https://lore.kernel.org/r/160045867590.25663.7548541079217827340.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1136,15 +1136,16 @@ static bool dm_dax_supported(struct dax_ { struct mapped_device *md = dax_get_private(dax_dev); struct dm_table *map; + bool ret = false; int srcu_idx; - bool ret; map = dm_get_live_table(md, &srcu_idx); if (!map) - return false; + goto out; ret = dm_table_supports_dax(map, device_supports_dax, &blocksize); +out: dm_put_live_table(md, srcu_idx); return ret;