Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp502240rdb; Thu, 15 Feb 2024 06:49:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWEIBKRfp9IPKqdGOwKBa9yCfpIivMdr2fpa2O7PfIeJCsl6hypPS6paK0DWipInxW14MZyxVaaOdrJLT71IPrz5yaePKAorfeNtgo2qA== X-Google-Smtp-Source: AGHT+IGciNWD8ydDd562JAqFWWgyowhvKQ9eDESpW4wGtOkGRQrm3Opakt+GEV4IeOdiDcDaB8aJ X-Received: by 2002:a17:903:110c:b0:1d9:a2b1:8693 with SMTP id n12-20020a170903110c00b001d9a2b18693mr2478887plh.23.1708008563754; Thu, 15 Feb 2024 06:49:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708008563; cv=pass; d=google.com; s=arc-20160816; b=KPnbSMTUIr9bJak7A+BzkEwyrH4BFL8q2XW1Amx4ARjhrijqEzoHHs/ygRYoLVSL7o 2VH+/dU1hrpwqg+FH1nv1Oh9LX3Kg1zHetTy0ZIMlHmLb8dkNa4vKKeHjRw86kMluYl4 I6BdvtQe/r12RKpnFVmOF9bH3+clFmWASNU7mc/3i2tVdX3sPli0+Bb+sGo1r0mhflfz 61yKz6ds0BFfIVOYt78Vz34fSe2hYycIdK2jyh1gouYpR7iW2KgU+sz6tTWvThLZUPS0 OmVnheS5VkBcnq97WDHYbMxtb/D6Viz1J3S+8nW13+z77D01W7flG1rO4nbYgzFlfxyx XQVA== 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=JykYcfv7Mzdwlbzj2ZQRAHwkWbMzk5SbkQQkUJQcWEE=; fh=vB3mjx618UEkjhkr0KlPmbcjzb/dBtVqarMo/Lep1XI=; b=PRNRjFh8LFOzGh6RB+WogDICXdDRfXRclNf2FMri0dsM7tuzUaL56qPw2p7i3VTtyx 0/VchUSWmel7VwVtL5YOo/BpztvVIJRaF/e3D9n8xhDhVAicWBs1CgRe5YTp1PGFhpSO IFU804vpdUWFo4qONwMupB00pMFF83a5pQ/hzrlgr1+ISPiAPnoRQZPgau5Lh9dr8zzW BGbnlX3gi7KrI1VKPKpW+jqaNvI2u3ZxoQL2dsDVjZoqerAn2ZteakQGRnE9zJfNKD1o 3CtM45sgFtAXNaXerkUr+4dqIAsczmeltF0IcJ3Dl/g+noz9GDfHtjv/DIvNlSz0NZmq kXdg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=dwDnURMs; 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-67101-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67101-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k12-20020a170902c40c00b001d9d44403bbsi1228986plk.583.2024.02.15.06.49.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:49:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67101-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=dwDnURMs; 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-67101-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67101-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 61FDE28B85C for ; Thu, 15 Feb 2024 14:49:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9DC421350EC; Thu, 15 Feb 2024 14:46:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="dwDnURMs" 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 C48BB132C1B; Thu, 15 Feb 2024 14:46:42 +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=1708008405; cv=none; b=VivlC26EUb/Q8Mju9pZKP0fuPfMk10zsb29IiooepSlzOqu0ZSefGaL45sJDurgB1xmujghQRtc+SXJ4/gn7A7SGqAjaFn6zGBwgZ5r4JUBDIqyKZbuTYF6ER4DToHgvVOf2tftvZJRkV8To3AQqEJEsyy6g7WIIIytTrlEWGbw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708008405; c=relaxed/simple; bh=2UjvX1mPA15gxdiokNXtijzapjvmSFS/ZT8DpOJxoxg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aRk5scEFD0Qg6i3yCv5BXlg13vig7vF4rUrbw0IPpAiLad9Xl52It28mcaqKCYGDc34o2bl97LRylAcSa4k84U9Tq07J3H4/Juor4cHPZUlQabdtTkjblEXlTwkIITKbGgpM6zrhxWWhTrZHKiMok2ipakRWB8Dm0CM0Mo5/ARE= 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=dwDnURMs; 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=1708008401; bh=2UjvX1mPA15gxdiokNXtijzapjvmSFS/ZT8DpOJxoxg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dwDnURMsq/o0lx0Luqzr1eCWXZ6boSyn/PfHtqDhE9di0Yaeh5hFvXFEVnscxnwfB HdULKMvpUjxPrHcBrTSGCxUwc/6SKwFKs6LIT6fdL/3ftEXXPNiekWJr8nj/gR/q9c QcJBv7vckhsKbvWsfM+JqX/J6Slwnjxs8oF1mRxEaLbXjTzM69QiXhCzPziHI7SjRZ bfQ2k8dVK3JMDOxaloIr8P2vxfpEjYX+4JMzi/nhiXnedDHYNxMyX9plrBx81pB+lk 4J5KT5pg0LUHw7A5CJ4FjkzPPBOeznzJE4IHyW1ws0jLeHOWwAUQUPnQw3UWpBbAKv XmDk4Tq5SBp/A== 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 4TbHvP2F7YzZKl; Thu, 15 Feb 2024 09:46:41 -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 6/9] virtio: Treat alloc_dax() -EOPNOTSUPP failure as non-fatal Date: Thu, 15 Feb 2024 09:46:30 -0500 Message-Id: <20240215144633.96437-7-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 Content-Transfer-Encoding: 8bit In preparation for checking whether the architecture has data cache aliasing within alloc_dax(), modify the error handling of virtio virtio_fs_setup_dax() to treat alloc_dax() -EOPNOTSUPP failure as non-fatal. Co-developed-by: Dan Williams Signed-off-by: Dan Williams Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") 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 --- fs/fuse/virtio_fs.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c index 5f1be1da92ce..a28466c2da71 100644 --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "fuse_i.h" @@ -795,8 +796,11 @@ static void virtio_fs_cleanup_dax(void *data) put_dax(dax_dev); } +DEFINE_FREE(cleanup_dax, struct dax_dev *, if (!IS_ERR_OR_NULL(_T)) virtio_fs_cleanup_dax(_T)) + static int virtio_fs_setup_dax(struct virtio_device *vdev, struct virtio_fs *fs) { + struct dax_device *dax_dev __free(cleanup_dax) = NULL; struct virtio_shm_region cache_reg; struct dev_pagemap *pgmap; bool have_cache; @@ -804,6 +808,12 @@ static int virtio_fs_setup_dax(struct virtio_device *vdev, struct virtio_fs *fs) if (!IS_ENABLED(CONFIG_FUSE_DAX)) return 0; + dax_dev = alloc_dax(fs, &virtio_fs_dax_ops); + if (IS_ERR(dax_dev)) { + int rc = PTR_ERR(dax_dev); + return rc == -EOPNOTSUPP ? 0 : rc; + } + /* Get cache region */ have_cache = virtio_get_shm_region(vdev, &cache_reg, (u8)VIRTIO_FS_SHMCAP_ID_CACHE); @@ -849,10 +859,7 @@ static int virtio_fs_setup_dax(struct virtio_device *vdev, struct virtio_fs *fs) dev_dbg(&vdev->dev, "%s: window kaddr 0x%px phys_addr 0x%llx len 0x%llx\n", __func__, fs->window_kaddr, cache_reg.addr, cache_reg.len); - fs->dax_dev = alloc_dax(fs, &virtio_fs_dax_ops); - if (IS_ERR(fs->dax_dev)) - return PTR_ERR(fs->dax_dev); - + fs->dax_dev = no_free_ptr(dax_dev); return devm_add_action_or_reset(&vdev->dev, virtio_fs_cleanup_dax, fs->dax_dev); } -- 2.39.2