From patchwork Fri Feb 2 21:00:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 196028 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp699236dyc; Fri, 2 Feb 2024 13:07:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHiulPqyTJC+sWNNPITPWq5euqYREbL8pUDi1+3lIxHmygUwQjeKxt72FrwpRTUyc2sE0Yh X-Received: by 2002:a05:6a00:10c6:b0:6dd:a24b:b5f3 with SMTP id d6-20020a056a0010c600b006dda24bb5f3mr10477965pfu.12.1706908030925; Fri, 02 Feb 2024 13:07:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706908030; cv=pass; d=google.com; s=arc-20160816; b=ij18rFA5CZYc/taiCtLAaVn4CkrkeT44r6MevOv40KRDsXesDvWDORJju5X5PYLqMI n6MvLELql0NVIqVDFDr8+2WBkNFfFnwTfL+4+JCuXEDB556Ajxz6ryHh/n+cEc6hXkW9 XDYIMgX2fKcKjXndmsmNFrrczY/NzFn8Atp6V4aRHl+JrTd+YiIVYp/fro2ZrBWCT5bK ZvzkPdaq8qKlYOlgaHlKhfjyGFmCPe4RGsMtrXRvY+BhjFnbWtSHD4FVKATHNeactABU IFsh7neW+ARktqsS6HY2d4RYxnt7oKuFPa32zgBHxWI/fYxpOynObEYWzzjP+KLkvdLu 2XdQ== 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=qoFC8C6ZSnf/nETi8dojk/VMfXsfmFrumNn7+RHaPbE=; fh=Kys1smiWrNDvv5cOtadE80hF5XYyvBIhxU7W/dq6JF4=; b=cSNXi0jNyE2l6hgQKdyPgfMbhS11mXuZtDTeFJZu7/dfvR/pOR/w9kVEUHbUlo5AVX 5/ktWiDZY5UA1Etv50Gx0j/s3t1enZayuI21NfXWEIf87CAQNnw4e9N1ZDB7QTeR0mSv TkhR0L9Gjvy8pPka1O9T0GYpc0TcMSHX+Kk1ntt/Db+bFHKSv0JRSj46UW+6NFMRtyWl NKVktTpLLKmtGlOWZie5f6LkH1bCZN/gM5L6OqouOdL/BPxK/OLVWEvTuPuC5IXzg0NP 4U+En9FO0xDJltU8vgDO+0Uq1OXv4SYp6C+IWn8PRk5cTYftd0opIM7LjnulubYOKCjG xdkA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=uUAHHnSH; 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-50577-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50577-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=1; AJvYcCUw5dyEAK1uCfH+/la3ODG30uEttu9/fT2JzmRy/WHGrv5CBoSuogvxEMiCfvE0pjpuGgLbo4HWmb6HDXM79A2EprB/qw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p1-20020a634f41000000b005dbcf0ff613si2152187pgl.820.2024.02.02.13.07.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 13:07:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50577-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=uUAHHnSH; 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-50577-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50577-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 9625928DD3A for ; Fri, 2 Feb 2024 21:07:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB39A1384A6; 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="uUAHHnSH" 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 9987812C800; 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=TA/h7cd5i0b+KyqtV+/vHms2j3mEqDpm/5GIMcNHArcVIrRCDtRNVH2fifoU/AlldH8FFEM1VC2ygIsGMIPui7xgyv6k8BXQ7u0YGd4bvvcp3khO9LlHCC9ymc1J7m8k/6uIOLitW5nvY34IVLHHkYDdpBvW2FLCRlAqsaj2C+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706907631; c=relaxed/simple; bh=NIplNKYnPiSxsRcYozD6/Em7BpOZVdeSTtUJ6fu0NbI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bMV1HwlhRhtSglYeEZ+l6VAHUkP2eDG+OZUpmAxb1PlnOKBWhCV7wy+V00tq58++KvxJFhsmVkUd1PNccHRscf2zl0DAKUKsagQViJoXnZRmS6JLaTRQ2XXYIS4QCXWJ0VWYouo8IrYdTax/I/UgCPTwVI1Lctn1GPggNPc1Zl0= 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=uUAHHnSH; 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=NIplNKYnPiSxsRcYozD6/Em7BpOZVdeSTtUJ6fu0NbI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uUAHHnSH9qyqiPFbxwBtx0+D9xq4cbcOGLgW4N3moWcT7pudTHalnE5g1pd42JIw1 E3TN3gqn3EUKS2dS9BzMQmTDoF+b7/+Qo4cwDn0a2ByIW+HF+RdPmI8Gicr0hw2PC1 rvL4NM2lV7/3fJAgKuzVhmtLD4sYUctQymj+dRbaw03MRctwLcGdqytl4bAfkLRnmT 4zEaxXtJqlO+Duz6P4JaEGwtf4+/NJP0OjTM0KP4jY3eHJU+9XKKJK07j50wLLNsZI 5soy4VlB1L6a0Mfw3iWgCtncLHEZ7CxNE1IQAbBR3d217g1gnazmhpUoUCZ9XrHKcd Qr321w76PHugg== 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 4TRSph2fcvzX4S; Fri, 2 Feb 2024 16:00:28 -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 04/12] dcssblk: Handle alloc_dax() -EOPNOTSUPP failure Date: Fri, 2 Feb 2024 16:00:11 -0500 Message-Id: <20240202210019.88022-5-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: 1789822795027132605 X-GMAIL-MSGID: 1789822795027132605 In preparation for checking whether the architecture has data cache aliasing within alloc_dax(), modify the error handling of dcssblk dcssblk_add_store() to handle alloc_dax() -EOPNOTSUPP failures. Considering that s390 is not a data cache aliasing architecture, and considering that DCSSBLK selects DAX, a return value of -EOPNOTSUPP from alloc_dax() should make dcssblk_add_store() fail. 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") 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 Cc: linux-s390@vger.kernel.org --- drivers/s390/block/dcssblk.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 4b7ecd4fd431..a3010849bfed 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c @@ -549,6 +549,7 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char int rc, i, j, num_of_segments; struct dcssblk_dev_info *dev_info; struct segment_info *seg_info, *temp; + struct dax_device *dax_dev; char *local_buf; unsigned long seg_byte_size; @@ -677,13 +678,13 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char if (rc) goto put_dev; - dev_info->dax_dev = alloc_dax(dev_info, &dcssblk_dax_ops); - if (IS_ERR(dev_info->dax_dev)) { - rc = PTR_ERR(dev_info->dax_dev); - dev_info->dax_dev = NULL; + dax_dev = alloc_dax(dev_info, &dcssblk_dax_ops); + if (IS_ERR_OR_NULL(dax_dev)) { + rc = IS_ERR(dax_dev) ? PTR_ERR(dax_dev) : -EOPNOTSUPP; goto put_dev; } - set_dax_synchronous(dev_info->dax_dev); + set_dax_synchronous(dax_dev); + dev_info->dax_dev = dax_dev; rc = dax_add_host(dev_info->dax_dev, dev_info->gd); if (rc) goto out_dax;