From patchwork Thu Feb 8 18:49:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 198531 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp383071dyd; Thu, 8 Feb 2024 10:56:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWFGIha/zIrMERqm0Hi+dNnnlYd5lAL7cqE5ZvQu6wMjHT/je3CCTyo3T1ag98sQGquDH7enuyEP8kD3GjjUC7TsE8Vrg== X-Google-Smtp-Source: AGHT+IHPTajfzutYIfzkeLxRArH7fGq12O7iNlTengaln8Cd8OvTfaYz0zh2b2NOMherE81iEklF X-Received: by 2002:a25:aa84:0:b0:dc2:5274:fd3a with SMTP id t4-20020a25aa84000000b00dc25274fd3amr412045ybi.23.1707418613960; Thu, 08 Feb 2024 10:56:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707418613; cv=pass; d=google.com; s=arc-20160816; b=q755YZOfJ07W2qUqDPg/Lkkb8EB8ibkvCtzPI+xAmEX+y7OxCn2V3HqTuJkLbFQr+v 90+T7PywitmeTcaqbZgLQ5SqfT0Wmz+XnxVI2C+Zk+cdgKuhVHm4NerjoW2kc6YCXxbT gP/bgxN531a6UmuaCkWvnNRH2jZTYlY+E5x3dfKBy20zuiXjCZDm3iqgnzMGdGARWodK oCaB/B16+caRWOtNDj+4QRQH9hmgNdkM96RQVOvSp6OQoVL6cPmXiGtKFgPCafd2YGpx oeRaVXYKNaK7poCqMwBYnNfvGsWIIwQBzPTjxauZmWZPHFYtF/k3eXGA+FIbmcR3lZg1 mOgg== 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=0iAhiuMJia2WHjoOWpniD5VbHjrc87WOmaKwGggWkh0=; b=VES9PNB7SgPuEHYP08O8lRPi6yNaFywyLVCuHONPWmbkBp+ipGPOPiUW3SxUdNlwtB jfJEKLdtoIHa3OvaBw1I7JTjeZl15wQg0NNU0GHZJkT9x48txaYtWrpG21nQm3DQiyOA vCBxu2KPXCIpJEQjO21n/w+kNqiWclUGZLVfdvTtmPW2sLIxOj0CMZYA4sLR9e4gLJQA Oyq5LdQWa308juNkVpFhaFKmhA3FaWXmBSYmNgxrDzrvbSPZ1QU+lPPf59RxTo9h/nwE GQxPA81c1aGdB938+AZBLHCVv06BWVFmJ1mM71z9pom7d/HI61pIi/ARjcJano4aeiY1 CiwA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=UblpDhvf; 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-58568-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58568-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=2; AJvYcCW6D/YSIcqUYFi6DwhvMuePXsakZ2PBvRsMiVgQApvvRLP8MINQZyyaCMv74jyBuGff5FQkrAbrMijQ9onkW6izCwIigw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q1-20020ad45ca1000000b0068c9315e811si172500qvh.90.2024.02.08.10.56.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 10:56:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58568-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=UblpDhvf; 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-58568-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58568-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 64BD11C29757 for ; Thu, 8 Feb 2024 18:55:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 747562562A; Thu, 8 Feb 2024 18:49:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="UblpDhvf" 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 C03C128DDC; Thu, 8 Feb 2024 18:49:30 +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=1707418173; cv=none; b=L3eNWTaiifm2oAMIUDov/GMe+1Q4X7cKD0n+5Xn2zsvZ21TGt4F+YmtvTEkiDxkn5j09LbOxXiwlF+3mu6DM6USXLqDa+I6HzLiQe1WyXbnKjW7YuBdOApsVihHtj7KUZRCVWTkLbRy1KUoU0akKj/8mUHlFZP6PGl6yFkFhP5c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418173; c=relaxed/simple; bh=Cw819/KonN7FOZNMfLR1Ivonx2xW8T4iDPwkWkOj91U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ajnIP2axxyb7WQ2hVq+IqlbPRcotQ3GxoTtI9+KjvXTkQ64kuHxmlmMmTimQgYWZ3z44/CwG7kiaE0L7f1S8nO8fa+iYv/9qZR7BntBbi9Lmk5DZOcelmLPJ8nzBFdQp/VwoUIC97tI+bitm6oQHEpNYEuD0RT97SGIh+517BHU= 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=UblpDhvf; 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=1707418164; bh=Cw819/KonN7FOZNMfLR1Ivonx2xW8T4iDPwkWkOj91U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UblpDhvfHANKqJFQHeaHwkIpXUAIYpC9oPLq0TvfWfeRXeTXyN+gn3/3ZipKcpRL4 eL3OcfWoFDAmV1IC2qHFKtps99Jv9WaIB34f3niYgPevHxifDv2iVq2oe1H8HJ7VY+ OXS0FYiaAgd+LT/r4tnoX+2TAAL0JEi+bOVAMyUtknBxHB/5sMW6AKhnI7xTUrvyRe 1esVYyBFR2R+W7fxyIfhFzUjx358IVx4OTM22EMYEIi6AWNv92bRBLshKWZ2Uhecrn LmOjnmnM7mNgo8jd3iGTu7S7JpDScrW0M2MFW/F0ToU0paCORuAOPQK8zLKt+kMQa0 nRRCOKzwzHRQw== 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 4TW5cg4y4VzY5M; Thu, 8 Feb 2024 13:49:23 -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: [PATCH v4 03/12] dm: Treat alloc_dax() -EOPNOTSUPP failure as non-fatal Date: Thu, 8 Feb 2024 13:49:04 -0500 Message-Id: <20240208184913.484340-4-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> References: <20240208184913.484340-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: 1790358180395012553 X-GMAIL-MSGID: 1790358180395012553 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; }