From patchwork Fri Feb 2 21:00:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 196027 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp699036dyc; Fri, 2 Feb 2024 13:06:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IGwwzzinviiQ/XyayOh+MI2xcl6p8h2W3Hc4VSgjTaLRDdZcaf3c7wAINFoIT1dHAULdalO X-Received: by 2002:a17:906:6a24:b0:a37:20be:b37 with SMTP id qw36-20020a1709066a2400b00a3720be0b37mr1949468ejc.58.1706908006421; Fri, 02 Feb 2024 13:06:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706908006; cv=pass; d=google.com; s=arc-20160816; b=J0XGPDSeB7sUeOCksUHUiqqWgFgyPsD5O7jwhc4g2A4bVoxHDrF5bKbk70NKwMYLEP 6Bja+coqms41DV0J2JiYWuxLCwHQaXE/9xjvyZqcN18mQK/dpCElr3mkTkHDaI6+SBHQ iM17gKydUt8E0lOW6zPk9PH8zoQMLfpELPfhVgSlzb4ei3HpY5tdlHxnFL4jciCnoXTp WZLO8kp1gac+bYZJVhuKeKVEriNAljvdWDNrqHfw1QIYPiQKr4NXqyGgTnmU9sUxoO5n fk6gsI3ao9yTF/bmZ0BKGHOZ3u6nU53temQMye23fUz0Sl5g+Eqj9VYvsy9Fj4riAxLd IaUw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xK83i6t7USeocITc70y4DYr6De00Kwc5YNFwgYpfZGM=; fh=Jw1BCUsxS5uDokYqHEDDDb++C6i/8nLLxU/JJicxxHs=; b=hgeBWIoCfXEA9Pcn25JRretDHInex1zxuYqsQMosQlupQHmvV+wATS8uD4PE/tdL7K bt6iXhFGDoXY3STA6ouUo8Pyx+MHJVN82jXx1GNE1YywQBhcVzh+c6VAA/zzGPoIbl71 UKFeU+UfLK6xo/0Um66tSx8Hdzked6IQ7aRw0HSXQavjg8rcwZXGyN3ngBk5/RJ+y1Ic wiXSCOv9OoRnR7ENYKDfhYSqwT/3tW1FDuYf/OGVn7UWOInrN0VZgqDtvG7yUq9PdHZa 3ulbZGpk5a2DsFh0qpnTQbF4edWRnBiKZlL2XHJJJswCxeMvXgEwgaXe9XRjZhdQlS6W bBrg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=n4HkiezO; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-50575-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50575-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=1; AJvYcCVFh++d95AFltn+OiVJ26wT4lUVc0SXVA3DFkJmCFpZFtmGQs09BflIa1inenIDQZzUq3uX8vKgYi3CLTmcAdSZ2NKpLQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id jw9-20020a17090776a900b00a351b4ca4desi1161245ejc.792.2024.02.02.13.06.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 13:06:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50575-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=n4HkiezO; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-50575-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50575-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2733F1F22CC8 for ; Fri, 2 Feb 2024 21:06:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4655B1369B9; Fri, 2 Feb 2024 21:00:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="n4HkiezO" Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B7528174B; Fri, 2 Feb 2024 21:00:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=167.114.26.122 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706907631; cv=none; b=nUxF3QWL1G6TykHzN50oLihrsy+mco5e314loLTgSH4tGzok6dBzPHHQSHYDr/Tvo6sogzzcv5G18lAqV9Kt19e8HOhwythG3XJ44zkm4s382k0bsd7PqsFpPfEhRT2EUYoWb15qvSRRDhHQwSSXxHfkfIq2UiMW+SbQPX5Z+Q8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706907631; c=relaxed/simple; bh=Cw819/KonN7FOZNMfLR1Ivonx2xW8T4iDPwkWkOj91U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZPcaCraa4QwibBoC2emEy7/KaXxbtX9GOMFj4SJvYwHqjSZDNTQ8YS7vS/dQhu8LPQLg8mRzm6I9AlIMGpOBC6pfCpmd7FGKV6s9nzIo5xcpWUGO/wMFJsRdzP4v9oTMSRyGKF4K705k0IShPE2ekBkVH2U4OPm3OS4tvE71TsI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=n4HkiezO; arc=none smtp.client-ip=167.114.26.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706907628; bh=Cw819/KonN7FOZNMfLR1Ivonx2xW8T4iDPwkWkOj91U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n4HkiezOBThhr+L9DyyXZNtQ3AYY+KR7/dDOpldNT1ICN9K/vq3hURiBfP3xjrM1p OiPZ/R7PyOXUgy+yZquxsBjeck+wbRSmQ3FvrpnUSNOb42bHSDKgFQFfZNXM7fZtl+ Ja8yhxmPfFMLTJPyiUNHimX0PAZY+I0Ga4qkzZvU/SoxsvOF4UCbzLwcMsoZOwniLF kyD8uDpxesxBAC801OxUQlPOCQSAQ96tAYfxVFNjmJmPTOEk2N7nyZovgqjYV+lsrz VMrdnB2pvEWd/t6vwTYj41rnS9ymkzrXokyLekwB22A9AkKI5X+WUX2IxomFfmazUt vrYQOPhPSgdIQ== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TRSpg6fNpzX4R; Fri, 2 Feb 2024 16:00:27 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Andrew Morton , Linus Torvalds , Vishal Verma , Dave Jiang , Matthew Wilcox , Russell King , linux-arch@vger.kernel.org, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, dm-devel@lists.linux.dev, nvdimm@lists.linux.dev, linux-s390@vger.kernel.org, Alasdair Kergon , Mike Snitzer , Mikulas Patocka Subject: [RFC PATCH v4 03/12] dm: Treat alloc_dax() -EOPNOTSUPP failure as non-fatal Date: Fri, 2 Feb 2024 16:00:10 -0500 Message-Id: <20240202210019.88022-4-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240202210019.88022-1-mathieu.desnoyers@efficios.com> References: <20240202210019.88022-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789822770140471902 X-GMAIL-MSGID: 1789822770140471902 In preparation for checking whether the architecture has data cache aliasing within alloc_dax(), modify the error handling of dm alloc_dev() to treat alloc_dax() -EOPNOTSUPP failure as non-fatal. For the transition, consider that alloc_dax() returning NULL is the same as returning -EOPNOTSUPP. Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Suggested-by: Dan Williams Signed-off-by: Mathieu Desnoyers Cc: Alasdair Kergon Cc: Mike Snitzer Cc: Mikulas Patocka Cc: Andrew Morton Cc: Linus Torvalds Cc: Dan Williams Cc: Vishal Verma Cc: Dave Jiang Cc: Matthew Wilcox Cc: Arnd Bergmann Cc: Russell King Cc: linux-arch@vger.kernel.org Cc: linux-cxl@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-xfs@vger.kernel.org Cc: dm-devel@lists.linux.dev Cc: nvdimm@lists.linux.dev --- drivers/md/dm.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 23c32cd1f1d8..2fc22cae9089 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2054,6 +2054,7 @@ static void cleanup_mapped_device(struct mapped_device *md) static struct mapped_device *alloc_dev(int minor) { int r, numa_node_id = dm_get_numa_node(); + struct dax_device *dax_dev; struct mapped_device *md; void *old_md; @@ -2122,15 +2123,15 @@ static struct mapped_device *alloc_dev(int minor) md->disk->private_data = md; sprintf(md->disk->disk_name, "dm-%d", minor); - if (IS_ENABLED(CONFIG_FS_DAX)) { - md->dax_dev = alloc_dax(md, &dm_dax_ops); - if (IS_ERR(md->dax_dev)) { - md->dax_dev = NULL; + dax_dev = alloc_dax(md, &dm_dax_ops); + if (IS_ERR_OR_NULL(dax_dev)) { + if (IS_ERR(dax_dev) && PTR_ERR(dax_dev) != -EOPNOTSUPP) goto bad; - } - set_dax_nocache(md->dax_dev); - set_dax_nomc(md->dax_dev); - if (dax_add_host(md->dax_dev, md->disk)) + } else { + set_dax_nocache(dax_dev); + set_dax_nomc(dax_dev); + md->dax_dev = dax_dev; + if (dax_add_host(dax_dev, md->disk)) goto bad; }