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: 13558534 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 621A4C48BC4 for ; Thu, 15 Feb 2024 14:46:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A09D48D001A; Thu, 15 Feb 2024 09:46:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 945518D0014; Thu, 15 Feb 2024 09:46:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74A128D001A; Thu, 15 Feb 2024 09:46:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6155B8D0014 for ; Thu, 15 Feb 2024 09:46:43 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 35B151A03B0 for ; Thu, 15 Feb 2024 14:46:43 +0000 (UTC) X-FDA: 81794314686.05.F132141 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf21.hostedemail.com (Postfix) with ESMTP id 7EA281C0019 for ; Thu, 15 Feb 2024 14:46:41 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b="XTpVv1l/"; spf=pass (imf21.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com; dmarc=pass (policy=none) header.from=efficios.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708008401; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=99RRntZfkjnZKNO4IHwslOkSnOz+slrjRxiaktTh4zQ=; b=Qdff8OH7fGYsnTE1h+86GoTHCFoiXxKQhB3alAzD7c2SKZou+JdJPd3tYR2Vvw8r5d51Ve MHWL4wTJrgsfkZkJGJ3vObiZKlVf0Fw4fAtjtPGtZqiLV58GhQlroXnbmiuRa8UPzr03rO qO4xoD5oCZnQb9w5YJNISB2toEjgbnk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708008401; a=rsa-sha256; cv=none; b=lztlG4RSRPsNZR3397p12wrRX2oPPofuWpbbY184wjKO2OvA+HCWOspZm94MRyMDuSldsl EWHxhsx+tT6vxu/wAZ2caV1f6YrTlWYR54uQ71hmJxBHYrc5FZBefa1+3OIC2koafDxH9S O+cji6tomRCaImDInC4yqFRZfNijWWg= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b="XTpVv1l/"; spf=pass (imf21.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com; dmarc=pass (policy=none) header.from=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> MIME-Version: 1.0 X-Stat-Signature: wosg7w9qjke99igutfq5m19sx8fxew3j X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 7EA281C0019 X-Rspam-User: X-HE-Tag: 1708008401-190325 X-HE-Meta: U2FsdGVkX1+fyz6/GIjxMrdUNUmLZhQxFRBvTFlHOI8OcZhIW7Mulo0wMCka8Magd36sxmAGfJX4YBC6QQjkb2HwgwGt+ldQeHslmWgCRXEg47AWxGPcBdMyqUthj0uh1oEDp6vDSA8KyAdu/zi1uoRip1gurIMHr1AS5hP99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ZRGuFZpgkwh/5JIy9dRUK5OA8du9ASgVvVJhOkqWGGW2UnxecwHxbMpiqqoFwmItBebYMYMSO2u47f4MTz2geaJ6stghvtg9WCQGZpOchdg91PvxQPw7b66j8FqYxr+TRqKrdu01xX8BtMCsiySON+IqGYQXp+brP1LDcH3v4mq/soAGMNtJAZx3yqzC24Hoy4/FqgEiE317Ghc5lk/E5o8MZis0f06K5aNUVrWHSWZ73jacCWv08NqoM+LaVHGPwaOloVoflvkcVhgJcRKmLbZb+JY3r7Geq0JIa/eQ51WxsbJPEo8+uHnhSOYZ5hlgGmBy1tMsFcUZY0bp8UMVGTEinE4esm8leAaNulsO0wxxKzw0l2oopj92RO46gpnVIqXTLC6eHDH0czhwd0A= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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; }