From patchwork Thu Feb 15 14:46:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 201531 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp470857dyb; Thu, 15 Feb 2024 07:20:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUUS3FS3HWY8HvEiZSrhUJps9Ps/+3ziYA+sHwlxvwO5QfZH+vxzHLWQ846arRDVlAFlC7syLyCJSW672pzZI8x2O38BA== X-Google-Smtp-Source: AGHT+IHopWEnvMc5vgFv8KfwbM0AJdjV0kp8ifLBpTkqg/HID/oKo3zXOUk2lhiZY8zqJo9y6nTb X-Received: by 2002:a05:6a21:e85:b0:19e:aaba:a6a5 with SMTP id ma5-20020a056a210e8500b0019eaabaa6a5mr2233340pzb.40.1708010408875; Thu, 15 Feb 2024 07:20:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708010408; cv=pass; d=google.com; s=arc-20160816; b=bVCcbI1H4CqYNtw90eeE98YPw8Y3us/jYtOvdyzjlPxWgk/jiidwNxL7YwQfeN+E29 XPS/y6QTtpXL+HHzfUYhNGNWyQ89Ge7MOXpy2kVMHGs5KoNVJvvf9KsbbVTYICXeaC63 kePcgK9qw0yEi0cI0SwHzK/ouLd63DdBEbdS2x2qOzf73qHUlsioSI6IOf981vp0AeOw 4o3TUhSg22bGd0Cqg50IBjx1fWw3hOmloqQGFbY/NGgiFxavnVIdgxdEmgYdPTd/pmeg c2gja76dWdfd1Q3Y9OtzTiq7OnYKOZU5FSggmHpDiAi/89lG3w1QchvgKATn4oqGxlS2 2EfQ== 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=99RRntZfkjnZKNO4IHwslOkSnOz+slrjRxiaktTh4zQ=; fh=vB3mjx618UEkjhkr0KlPmbcjzb/dBtVqarMo/Lep1XI=; b=JDRpRYNC7u4vvEzRa/74uTES3Jjoa0HIpwIC3Sr0VxhRG7UOnGPg3duVAudINjT54i 3lwU6JzN9wjvxP2wn9F2/BVSJtPq2fhwSLkMCTsLaNYWNmn7bWONnXaqhBLGNgriv29+ JyzykPCYISa8/V8r6PxTkm0FllKYspPlLHr3tOXWz3K+JkE3xwhtGGGSHn07krlC5GlF fbAo5MqhcSQIa4Vak/wpxsa86OGJ0orQGWli2vvkGVcKHv2zz1N47r3i0FpMAsa7b1aK 6//VRNl6FfGsfynU/9FarminVYseifSnuBIHdgHXtkNmTc/+yGdl3h/crqOXAq7v0c5C VLNQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b="XTpVv1l/"; 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-67098-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67098-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id w190-20020a6382c7000000b005dcae4c1ff8si1247741pgd.131.2024.02.15.07.20.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 07:20:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67098-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b="XTpVv1l/"; 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-67098-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67098-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 11CB2B258BF for ; Thu, 15 Feb 2024 14:49:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C5F74134CF5; Thu, 15 Feb 2024 14:46:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="XTpVv1l/" 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 8F181132478; Thu, 15 Feb 2024 14:46:41 +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=1708008403; cv=none; b=B3xy5vUlZOdzWx9BaGQu79ZLqn/bIZu8D+4M/hjXVSyKTGHgireohcfVBsCF2vc/eXJ7wH+LcZYFkBm52aJkjfz0xMeH6r758wB5H9Vofb5FGRFeM+0tMSsjH8380hLM8cTUq4nbJAQIYQ1PSVoPV1qJSWhmaplkf/61tF8d1DQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708008403; c=relaxed/simple; bh=CbAyr+xbx+4Y3FlaBdF7mHOoD3AcNitxApGii8uR9rc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XBhfMTcdYsJBmY6fV+lWhctVryYp4EqqoqYyNkfCO9UbB/w8yVkKpiBK9/CUdavbrmh3tcEmBmXSjegKv+3u5o4EldeHpWrLyLxfi+GuKQ+QRSzt+d36elndTgX4kuCMCo+eEcyAzmBwWm0NGjnOkhzKzOL9f2/8VESD+enkoCo= 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=XTpVv1l/; 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=1708008400; bh=CbAyr+xbx+4Y3FlaBdF7mHOoD3AcNitxApGii8uR9rc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XTpVv1l/pjHHNr/U9lGiMvjnyzdscOhWEb6ykHzU4BnNVVGkTiYLd4Tx5bn9wJpuY 1xnc3pkwfg+M3BljN/02HFFNaMUAyD6Boz06M9Rh8HV2mNyDQisIGkcZVpbJ0IzpdR dXrC+dgmbqmUM7NRnW85PlvvKT1jYCmr001F7dcL7aw9qiFtxBRP+16AAaISFw2SnV lYhbueW3D0I3zXcZNv6tl6dVUeIRfK7mpePFkwjLo5kJySt2w5nujyfKoofo705W08 GXlnb6d0rF+7PrW3/qID36u/xvDuI+DfEUxSj3H4A1AShvd5J30FnvinHMurIpGs+m hhRboYpCWg3VA== 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 4TbHvN3GlZzZS7; Thu, 15 Feb 2024 09:46:40 -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 v6 4/9] dm: Treat alloc_dax() -EOPNOTSUPP failure as non-fatal Date: Thu, 15 Feb 2024 09:46:28 -0500 Message-Id: <20240215144633.96437-5-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215144633.96437-1-mathieu.desnoyers@efficios.com> References: <20240215144633.96437-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: 1790978722486143591 X-GMAIL-MSGID: 1790978722486143591 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. Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Suggested-by: Dan Williams Signed-off-by: Mathieu Desnoyers Reviewed-by: Dan Williams 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..acdc00bc05be 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(dax_dev)) { + if (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; }